From 05cd91206a6ce3361097d9eb408a447eae3d120e Mon Sep 17 00:00:00 2001 From: Shravya Ramesh <37447613+shravyaramesh@users.noreply.github.com> Date: Tue, 29 Dec 2020 11:41:57 -0800 Subject: [TMA-288] notifications frontend infra (#154) * Configured settings to enable remote notifications * Added FCM services * Added background message handler + api calls * minor fixes * minor changes requested from pr --- ios/Frontend/AppDelegate.m | 12 ++++++++++++ ios/Frontend/FrontendDebug.entitlements | 8 ++++++++ ios/Frontend/Info.plist | 4 ++++ 3 files changed, 24 insertions(+) create mode 100644 ios/Frontend/FrontendDebug.entitlements (limited to 'ios/Frontend') diff --git a/ios/Frontend/AppDelegate.m b/ios/Frontend/AppDelegate.m index 31f06642..2b52605f 100644 --- a/ios/Frontend/AppDelegate.m +++ b/ios/Frontend/AppDelegate.m @@ -4,6 +4,7 @@ #import #import #import "RNSplashScreen.h" +#import #if DEBUG #import @@ -26,12 +27,23 @@ static void InitializeFlipper(UIApplication *application) { @implementation AppDelegate +- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo + fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler { + // If you are receiving a notification message while your app is in the background, + // this callback will not be fired till the user taps on the notification launching the application. + + completionHandler(UIBackgroundFetchResultNewData); +} + - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { #if DEBUG InitializeFlipper(application); #endif + if ([FIRApp defaultApp] == nil) { + [FIRApp configure]; + } RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions]; RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge moduleName:@"Frontend" diff --git a/ios/Frontend/FrontendDebug.entitlements b/ios/Frontend/FrontendDebug.entitlements new file mode 100644 index 00000000..903def2a --- /dev/null +++ b/ios/Frontend/FrontendDebug.entitlements @@ -0,0 +1,8 @@ + + + + + aps-environment + development + + diff --git a/ios/Frontend/Info.plist b/ios/Frontend/Info.plist index ebd7ab42..0f036f56 100644 --- a/ios/Frontend/Info.plist +++ b/ios/Frontend/Info.plist @@ -58,6 +58,10 @@ Feather.ttf + UIBackgroundModes + + remote-notification + UILaunchStoryboardName LaunchScreen UIRequiredDeviceCapabilities -- cgit v1.2.3-70-g09d2