From 6a2b3feb45c750b1de8663cebe78a140003a2438 Mon Sep 17 00:00:00 2001 From: Sneh Mehta Date: Wed, 19 Jul 2023 18:22:06 +0530 Subject: [PATCH] added firebase messaging into EnsembleService --- lib/generated/EnsembleServices.dart | 37 ++++++++++++++++++++++------- pubspec.yaml | 2 ++ 2 files changed, 31 insertions(+), 8 deletions(-) diff --git a/lib/generated/EnsembleServices.dart b/lib/generated/EnsembleServices.dart index bac70ce..8a6a683 100644 --- a/lib/generated/EnsembleServices.dart +++ b/lib/generated/EnsembleServices.dart @@ -1,6 +1,10 @@ import 'package:ensemble/framework/placeholder/camera_manager.dart'; // Uncomment to enable camera services // import 'package:ensemble_camera/camera_manager.dart'; + +// import 'package:ensemble/util/notification_utils.dart'; +// import 'package:firebase_messaging/firebase_messaging.dart'; + import 'package:get_it/get_it.dart'; /// TODO: This class should be generated to enable selected Services @@ -12,10 +16,14 @@ class EnsembleServices { } void init() { - initServices(useCamera: false, useLocation: false); + initServices( + useCamera: false, useLocation: false, useFirebaseMessaging: false); } - void initServices({required bool useCamera, required bool useLocation}) { + void initServices( + {required bool useCamera, + required bool useLocation, + required bool useFirebaseMessaging}) { // Uncomment to enable camera services // if (useCamera) { // GetIt.I.registerSingleton(CameraManagerImpl()); @@ -24,11 +32,24 @@ class EnsembleServices { // } if (useLocation) { - - } else { - + } else {} + + if (useFirebaseMessaging) { + // FirebaseMessaging.onMessage.listen((RemoteMessage message) { + // Ensemble.externalDataContext.addAll({ + // 'title': message.notification?.title, + // 'body': message.notification?.body, + // }); + // notificationUtils.handleRemoteNotification(); + // }); + + // FirebaseMessaging.onMessageOpenedApp.listen((RemoteMessage message) { + // Ensemble.externalDataContext.addAll({ + // 'title': message.notification?.title, + // 'body': message.notification?.body, + // }); + // notificationUtils.handleRemoteNotificationOpened(); + // }); } } - - -} \ No newline at end of file +} diff --git a/pubspec.yaml b/pubspec.yaml index 56dbe9e..eebb4a9 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -51,6 +51,8 @@ dependencies: # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^1.0.2 + # firebase_messaging: ^14.6.5 + dev_dependencies: flutter_test: sdk: flutter