From b6f179532dad84414844f362101b7d84b3e8d297 Mon Sep 17 00:00:00 2001 From: dab246 Date: Tue, 17 Jun 2025 12:33:46 +0700 Subject: [PATCH] Increase debounce time receive FCM background message to 30s Signed-off-by: dab246 --- .../presentation/controller/fcm_message_controller.dart | 9 +++++---- .../push_notification/presentation/utils/fcm_utils.dart | 1 + 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/features/push_notification/presentation/controller/fcm_message_controller.dart b/lib/features/push_notification/presentation/controller/fcm_message_controller.dart index 4ac6f86fb..8684648db 100644 --- a/lib/features/push_notification/presentation/controller/fcm_message_controller.dart +++ b/lib/features/push_notification/presentation/controller/fcm_message_controller.dart @@ -54,10 +54,11 @@ class FcmMessageController extends PushBaseController { } void _listenBackgroundMessageStream() { - FcmService.instance.backgroundMessageStreamController - ?.stream - .debounceTime(const Duration(milliseconds: FcmUtils.durationMessageComing)) - .listen(_handleBackgroundMessageAction); + FcmService.instance.backgroundMessageStreamController?.stream + .debounceTime(const Duration( + milliseconds: FcmUtils.durationBackgroundMessageComing, + )) + .listen(_handleBackgroundMessageAction); } void _listenTokenStream() { diff --git a/lib/features/push_notification/presentation/utils/fcm_utils.dart b/lib/features/push_notification/presentation/utils/fcm_utils.dart index 74416fa4a..39b036311 100644 --- a/lib/features/push_notification/presentation/utils/fcm_utils.dart +++ b/lib/features/push_notification/presentation/utils/fcm_utils.dart @@ -33,6 +33,7 @@ class FcmUtils { ]; static const int durationMessageComing = 2000; static const int durationRefreshToken = 2000; + static const int durationBackgroundMessageComing = 30000; StateChange? convertFirebaseDataMessageToStateChange(Map dataMessage) { log('FcmUtils::convertFirebaseDataMessageToStateChange():dataMessage: $dataMessage');