AppDelegate.m 1.68 KB
Newer Older
Lidan Hifi's avatar
Lidan Hifi committed
1
#import "AppDelegate.h"
2

yogevbd's avatar
yogevbd committed
3 4 5
#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>
#import <RNNotifications/RNNotifications.h>
6

7 8
#import <PushKit/PushKit.h>

Lidan Hifi's avatar
Lidan Hifi committed
9 10 11 12 13
@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  NSURL *jsCodeLocation;
14

15
  jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
16

Lidan Hifi's avatar
Lidan Hifi committed
17
  RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
Lidan Hifi's avatar
Lidan Hifi committed
18
                                                      moduleName:@"NotificationsExampleApp"
Lidan Hifi's avatar
Lidan Hifi committed
19 20
                                               initialProperties:nil
                                                   launchOptions:launchOptions];
21
  rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];
22

Lidan Hifi's avatar
Lidan Hifi committed
23 24 25 26 27
  self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
  UIViewController *rootViewController = [UIViewController new];
  rootViewController.view = rootView;
  self.window.rootViewController = rootViewController;
  [self.window makeKeyAndVisible];
28 29 30
  
  [[RNNotifications sharedInstance] initialize];
  
Lidan Hifi's avatar
Lidan Hifi committed
31 32 33
  return YES;
}

34 35
// Required to register for notifications
- (void)application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings
Lidan Hifi's avatar
Lidan Hifi committed
36
{
yogevbd's avatar
yogevbd committed
37
//  [[RNNotifications sharedInstance] didRegisterUserNotificationSettings:notificationSettings];
Lidan Hifi's avatar
Lidan Hifi committed
38
}
39

Lidan Hifi's avatar
Lidan Hifi committed
40 41
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
{
yogevbd's avatar
yogevbd committed
42
  [[RNNotifications sharedInstance] didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];
Lidan Hifi's avatar
Lidan Hifi committed
43 44 45
}

@end