From e1a169bd0c6e3e8384a84839c91643be53a03fe4 Mon Sep 17 00:00:00 2001 From: MrAlders0n Date: Mon, 19 Oct 2026 07:02:43 -0400 Subject: [PATCH] Keep Offline Mode pings when a radio drop ends the drive The cleanup after an abandoned reconnect stored the Session History entry but never wrote the offline pings, so a drive could sit in History with no offline file. It now saves them the way Disconnect does, using the remembered radio config and device name since the connection is already gone. A save also stopped the 60 s auto-save, and only toggling Offline Mode restarted it, so every later connect or mode start in the same Offline Mode stint ran without one. The auto-save now runs until Offline Mode is turned off. --- DEVELOPMENT.md | 1 + lib/providers/app_state_provider.dart | 20 +++++++++++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index c6f6524..1df1988 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -1078,6 +1078,7 @@ The app never checks its own version: it sends `APP-` (store) or `APP- _isAnonymousRenamed ? 'Anonymous' : (_meshCoreConnection?.selfInfo?.name ?? - connectedDeviceName?.replaceFirst('MeshCore-', '')); + connectedDeviceName?.replaceFirst('MeshCore-', '') ?? + // A reconnect that gave up has already dropped the connection. + _displayDeviceName); /// Save accumulated offline pings to a session file Future _saveOfflineSession() async { @@ -9492,7 +9502,9 @@ class AppStateProvider extends ChangeNotifier with WidgetsBindingObserver { devicePublicKey: _devicePublicKey, deviceName: offlineDeviceName, contactUri: _offlineContactUri, - radioConfig: _meshCoreConnection?.selfInfo?.radioConfigApi, + // The remembered config covers a reconnect that gave up, which has + // already dropped the connection. + radioConfig: liveRadioConfig ?? _lastRadioConfig, deviceModel: _meshCoreConnection?.deviceModel?.manufacturer ?? _meshCoreConnection?.deviceInfo?.manufacturer ?? _manufacturerString, @@ -9501,7 +9513,9 @@ class AppStateProvider extends ChangeNotifier with WidgetsBindingObserver { ); _offlineSessionService.finalizeCurrentSession(); debugLog('[APP] Saved offline session with ${pings.length} pings'); - _stopOfflineAutoSaveTimer(); + // The auto-save keeps running: Offline Mode is still on, and the next + // connect or mode start in this stint needs it. It stops when Offline + // Mode is turned off. notifyListeners(); }