From b62588b1636772599b5cf2339ece5473930b80a0 Mon Sep 17 00:00:00 2001 From: dab246 Date: Tue, 2 Apr 2024 02:18:14 +0700 Subject: [PATCH] Use `debounceTime` instead of `throttleTime` to avoid losing new messages --- .../presentation/controller/fcm_message_controller.dart | 6 +++--- 1 file changed, 3 insertions(+), 3 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 8e7c5f935..a515abba2 100644 --- a/lib/features/push_notification/presentation/controller/fcm_message_controller.dart +++ b/lib/features/push_notification/presentation/controller/fcm_message_controller.dart @@ -69,21 +69,21 @@ class FcmMessageController extends FcmBaseController { void _listenForegroundMessageStream() { FcmService.instance.foregroundMessageStreamController ?.stream - .throttleTime(const Duration(milliseconds: FcmUtils.durationMessageComing)) + .debounceTime(const Duration(milliseconds: FcmUtils.durationMessageComing)) .listen(_handleForegroundMessageAction); } void _listenBackgroundMessageStream() { FcmService.instance.backgroundMessageStreamController ?.stream - .throttleTime(const Duration(milliseconds: FcmUtils.durationMessageComing)) + .debounceTime(const Duration(milliseconds: FcmUtils.durationMessageComing)) .listen(_handleBackgroundMessageAction); } void _listenTokenStream() { FcmService.instance.fcmTokenStreamController ?.stream - .throttleTime(const Duration(milliseconds: FcmUtils.durationRefreshToken)) + .debounceTime(const Duration(milliseconds: FcmUtils.durationRefreshToken)) .listen(FcmTokenController.instance.onFcmTokenChanged); }