mirror of
https://github.com/zjs81/meshcore-open.git
synced 2026-07-10 18:47:15 +10:00
feat: enhance location update feedback and improve message retry error handling
This commit is contained in:
@@ -1514,15 +1514,16 @@ class _MapScreenState extends State<MapScreen> {
|
|||||||
title: Text(context.l10n.map_setAsMyLocation),
|
title: Text(context.l10n.map_setAsMyLocation),
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
final messenger = ScaffoldMessenger.of(context);
|
final messenger = ScaffoldMessenger.of(context);
|
||||||
final message = context.l10n.settings_locationUpdated;
|
final successMsg = context.l10n.settings_locationUpdated;
|
||||||
Navigator.pop(sheetContext);
|
Navigator.pop(sheetContext);
|
||||||
|
if (!connector.isConnected) return;
|
||||||
await connector.setNodeLocation(
|
await connector.setNodeLocation(
|
||||||
lat: position.latitude,
|
lat: position.latitude,
|
||||||
lon: position.longitude,
|
lon: position.longitude,
|
||||||
);
|
);
|
||||||
await connector.refreshDeviceInfo();
|
await connector.refreshDeviceInfo();
|
||||||
if (!mounted) return;
|
if (!mounted) return;
|
||||||
messenger.showSnackBar(SnackBar(content: Text(message)));
|
messenger.showSnackBar(SnackBar(content: Text(successMsg)));
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
|
|||||||
@@ -184,7 +184,16 @@ class MessageRetryService extends ChangeNotifier {
|
|||||||
final messageId = queue.removeAt(0);
|
final messageId = queue.removeAt(0);
|
||||||
if (_pendingMessages.containsKey(messageId)) {
|
if (_pendingMessages.containsKey(messageId)) {
|
||||||
_activeMessages.add(messageId);
|
_activeMessages.add(messageId);
|
||||||
_attemptSend(messageId);
|
_attemptSend(messageId).catchError((e) {
|
||||||
|
debugPrint('_attemptSend threw for $messageId: $e');
|
||||||
|
final msg = _pendingMessages[messageId];
|
||||||
|
if (msg != null) {
|
||||||
|
final failed = msg.copyWith(status: MessageStatus.failed);
|
||||||
|
_pendingMessages[messageId] = failed;
|
||||||
|
_updateMessageCallback?.call(failed);
|
||||||
|
}
|
||||||
|
_onMessageResolved(messageId, contactKey);
|
||||||
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Message was cancelled/cleaned up while queued — try next
|
// Message was cancelled/cleaned up while queued — try next
|
||||||
|
|||||||
Reference in New Issue
Block a user