TF-438 Handle show local notification when type is EmailDelivery on background or terminate

This commit is contained in:
dab246
2022-11-24 14:35:05 +07:00
committed by Dat H. Pham
parent 552398006d
commit d42756b4ea
10 changed files with 274 additions and 64 deletions
@@ -3,16 +3,9 @@ import 'package:core/utils/app_logger.dart';
import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:tmail_ui_user/features/push_notification/presentation/services/fcm_service.dart';
int semaphoreBackground = 0;
@pragma('vm:entry-point')
Future<void> handleFirebaseBackgroundMessage(RemoteMessage message) async {
if (semaphoreBackground != 0) {
return;
}
semaphoreBackground = 1;
Future.delayed(const Duration(milliseconds: FcmService.durationMessageComing)).then((_) => semaphoreBackground = 0);
log('FcmReceiver::handleFirebaseBackgroundMessage():messageId: ${message.messageId}');
log('FcmReceiver::handleFirebaseBackgroundMessage(): ${message.data}');
FcmService.instance.handleFirebaseBackgroundMessage(message);
}