@alaudoni/expo-firebase-extension-plugin
v3.0.8
Published
The Firebase Expo plugin allows you to use Firebase without leaving the managed workflow. Developed in collaboration with SweetGreen.
Downloads
15
Maintainers
Readme
@alaudoni/expo-firebase-extension-plugin
Forked from abstract-cl/expo-firebase-extension-plugin
This plugin automates the setup required to use notification images on iOS with @react-native-firebase/messaging. See the official guide here.
Installation
npm i @alaudoni/expo-firebase-extension-pluginSetup
Create the file
./plugins/NotificationService.mwith the following content:#import "NotificationService.h" #import <UserNotifications/UserNotifications.h> #import <FirebaseMessaging/FirebaseMessaging.h> @interface NotificationService () @property (nonatomic, strong) void (^contentHandler)(UNNotificationContent *contentToDeliver); @property (nonatomic, strong) UNMutableNotificationContent *bestAttemptContent; @end @implementation NotificationService - (void)didReceiveNotificationRequest:(UNNotificationRequest *)request withContentHandler:(void (^)(UNNotificationContent *))contentHandler { self.contentHandler = contentHandler; self.bestAttemptContent = [request.content mutableCopy]; if (self.bestAttemptContent) { [[FIRMessaging extensionHelper] populateNotificationContent:self.bestAttemptContent withContentHandler:contentHandler]; } else { contentHandler(request.content); } } - (void)serviceExtensionTimeWillExpire { if (self.contentHandler && self.bestAttemptContent) { self.contentHandler(self.bestAttemptContent); } } @endAdd the plugin to your
app.config.json:{ "plugins": [ [ "@alaudoni/expo-firebase-extension-plugin", { "mode": "development", "iosNSEFilePath": "./plugins/NotificationService.m" } ] ] }Run Expo commands:
npx expo prebuild npm run ios
