Skip to content

Instantly share code, notes, and snippets.

@dereknelson
Created April 17, 2019 18:22
Show Gist options
  • Save dereknelson/1ee14b472f33cf339cac53828c69d589 to your computer and use it in GitHub Desktop.
Save dereknelson/1ee14b472f33cf339cac53828c69d589 to your computer and use it in GitHub Desktop.
AppDelegate
// Copyright 2015-present 650 Industries. All rights reserved.
#import "AppDelegate.h"
#import <React/RCTPushNotificationManager.h>
#import <RadarSDK/RadarSDK.h>
@implementation AppDelegate
// Put your app delegate methods here. Remember to also call methods from EXStandaloneAppDelegate superclass
// in order to keep Expo working. See example below.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[application registerForRemoteNotifications];
[Radar initializeWithPublishableKey:@"omitted"];
[Radar setPlacesProvider:RadarPlacesProviderFacebook];
return [super application:application didFinishLaunchingWithOptions:launchOptions];
}
- (void)application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings
{
[RCTPushNotificationManager didRegisterUserNotificationSettings:notificationSettings];
}
// Required for the register event.
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
{
[RCTPushNotificationManager didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];
}
// Required for the notification event. You must call the completion handler after handling the remote notification.
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler
{
[RCTPushNotificationManager didReceiveRemoteNotification:userInfo fetchCompletionHandler:completionHandler];
}
// Required for the registrationError event.
- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error
{
[RCTPushNotificationManager didFailToRegisterForRemoteNotificationsWithError:error];
}
// Required for the localNotification event.
- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification
{
[RCTPushNotificationManager didReceiveLocalNotification:notification];
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment