mirror of
https://github.com/dz0ny/meshcore-sar.git
synced 2026-08-11 16:30:28 +00:00
Update MeshCoreBleService calls
This commit is contained in:
@@ -173,7 +173,15 @@ class _ImageMessageBubbleState extends State<ImageMessageBubble> {
|
||||
|
||||
Future<void> _requestAndFetch(ImageEnvelope envelope) async {
|
||||
if (_isRequesting) return;
|
||||
final sender = _resolveSender(envelope);
|
||||
var sender = _resolveSender(envelope);
|
||||
if (sender == null) {
|
||||
final conn = context.read<ConnectionProvider>();
|
||||
// Retry once after refreshing contacts; resumable sessions may outlive
|
||||
// the in-memory contact cache.
|
||||
await conn.getContacts();
|
||||
if (!mounted) return;
|
||||
sender = _resolveSender(envelope);
|
||||
}
|
||||
if (sender == null) {
|
||||
setState(() => _errorText = 'Sender not reachable');
|
||||
return;
|
||||
@@ -223,7 +231,21 @@ class _ImageMessageBubbleState extends State<ImageMessageBubble> {
|
||||
);
|
||||
if (c != null) return c;
|
||||
}
|
||||
return contactsProvider.findContactByPrefixHex(envelope.senderKey6);
|
||||
final contact = contactsProvider.findContactByPrefixHex(
|
||||
envelope.senderKey6,
|
||||
);
|
||||
if (contact != null) return contact;
|
||||
|
||||
final senderName = widget.message.senderName?.trim();
|
||||
if (senderName != null && senderName.isNotEmpty) {
|
||||
for (final c in contactsProvider.contacts) {
|
||||
if (c.advName.trim().toLowerCase() == senderName.toLowerCase()) {
|
||||
return c;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
static String _statusText({
|
||||
|
||||
@@ -176,7 +176,15 @@ class _VoiceMessageBubbleState extends State<VoiceMessageBubble> {
|
||||
|
||||
Future<void> _requestAndPlayVoice(String sessionId) async {
|
||||
if (_isRequesting) return;
|
||||
final sender = _resolveSenderContact();
|
||||
var sender = _resolveSenderContact();
|
||||
if (sender == null) {
|
||||
final connectionProvider = context.read<ConnectionProvider>();
|
||||
// Retry once after refreshing contacts; resumable sessions may outlive
|
||||
// the in-memory contact cache.
|
||||
await connectionProvider.getContacts();
|
||||
if (!mounted) return;
|
||||
sender = _resolveSenderContact();
|
||||
}
|
||||
if (sender == null) {
|
||||
_setUnavailable();
|
||||
return;
|
||||
@@ -243,6 +251,15 @@ class _VoiceMessageBubbleState extends State<VoiceMessageBubble> {
|
||||
if (contact != null) return contact;
|
||||
}
|
||||
|
||||
final senderName = widget.message.senderName?.trim();
|
||||
if (senderName != null && senderName.isNotEmpty) {
|
||||
for (final contact in contactsProvider.contacts) {
|
||||
if (contact.advName.trim().toLowerCase() == senderName.toLowerCase()) {
|
||||
return contact;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user