From 8810ecf360fbd121ca1b6fbad5ae24e0755e8e06 Mon Sep 17 00:00:00 2001 From: otsmr Date: Mon, 6 Apr 2026 01:53:42 +0200 Subject: [PATCH] lower lastExecutionInSecondsLimit --- CHANGELOG.md | 1 + .../services/background/callback_dispatcher.background.dart | 5 +++-- lib/src/services/notifications/fcm.notifications.dart | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5cc3423..6cefb55 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ - Improve: Improved troubleshooting for issues with push notifications - Fix: Flash not activated when starting a video recording - Fix: Problem sending media when a recipient has deleted their account. +- Fix: Receive push notifications without receiving an in-app message (Android) - Fix: Incorrect processing of messages that have already been fetched from the server causes the UI to freeze ## 0.1.1 diff --git a/lib/src/services/background/callback_dispatcher.background.dart b/lib/src/services/background/callback_dispatcher.background.dart index 0286c11..a146026 100644 --- a/lib/src/services/background/callback_dispatcher.background.dart +++ b/lib/src/services/background/callback_dispatcher.background.dart @@ -82,7 +82,7 @@ Future initBackgroundExecution() async { final Mutex _keyValueMutex = Mutex(); -Future handlePeriodicTask() async { +Future handlePeriodicTask({int lastExecutionInSecondsLimit = 120}) async { final shouldBeExecuted = await exclusiveAccess( lockName: 'periodic_task', mutex: _keyValueMutex, @@ -96,7 +96,8 @@ Future handlePeriodicTask() async { final lastExecutionDate = DateTime.fromMillisecondsSinceEpoch( lastExecutionTime, ); - if (DateTime.now().difference(lastExecutionDate).inMinutes < 2) { + if (DateTime.now().difference(lastExecutionDate).inSeconds < + lastExecutionInSecondsLimit) { return false; } } diff --git a/lib/src/services/notifications/fcm.notifications.dart b/lib/src/services/notifications/fcm.notifications.dart index ce257a7..89b70e4 100644 --- a/lib/src/services/notifications/fcm.notifications.dart +++ b/lib/src/services/notifications/fcm.notifications.dart @@ -127,7 +127,7 @@ Future _firebaseMessagingBackgroundHandler(RemoteMessage message) async { if (Platform.isAndroid) { if (isInitialized) { - await handlePeriodicTask(); + await handlePeriodicTask(lastExecutionInSecondsLimit: 10); } } else { // make sure every thing run...