diff --git a/lib/logic/session_timer.dart b/lib/logic/session_timer.dart index a456a1e..a8d69cb 100644 --- a/lib/logic/session_timer.dart +++ b/lib/logic/session_timer.dart @@ -189,6 +189,23 @@ class SessionTimer extends ChangeNotifier { _syncWithHivemind(); } + // ── Update notification every tick for smooth countdown ───────────── + // Uses the locally-decremented time so the notification stays in sync + // with the in-app display, not gated behind the 5 s server poll. + if (_hasSyncedOnce) { + final speedText = _currentSpeedKBps > 0.5 + ? '${_currentSpeedKBps.toStringAsFixed(1)} KB/s' + : 'Idle'; + if (formatted != _lastNotifTime || speedText != _lastNotifSpeed) { + _lastNotifTime = formatted; + _lastNotifSpeed = speedText; + VpnNotificationManager.showOrUpdateStatus( + timeLeft: formatted, + speedKbps: speedText, + ); + } + } + notifyListeners(); } @@ -250,19 +267,6 @@ class SessionTimer extends ChangeNotifier { _offlineSeconds = 0; _hasSyncedOnce = true; - // ── Update notification (only when values actually change) ───────── - final speedText = _currentSpeedKBps > 0.5 - ? '${_currentSpeedKBps.toStringAsFixed(1)} KB/s' - : 'Idle'; - if (formatted != _lastNotifTime || speedText != _lastNotifSpeed) { - _lastNotifTime = formatted; - _lastNotifSpeed = speedText; - VpnNotificationManager.showOrUpdateStatus( - timeLeft: formatted, - speedKbps: speedText, - ); - } - notifyListeners(); } else if (response.statusCode == 404) { // Peer not found on server (expired / deleted natively) diff --git a/pubspec.yaml b/pubspec.yaml index 77d8734..eeccb1c 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -15,7 +15,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 1.0.5+8 +version: 1.0.5+9 environment: sdk: ">=3.0.0 <4.0.0"