AppDelegate.m 1.89 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
@implementation AppDelegate

yogevbd's avatar
WIP  
yogevbd committed
11
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
Lidan Hifi's avatar
Lidan Hifi committed
12
  NSURL *jsCodeLocation;
13

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

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

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

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

yogevbd's avatar
WIP  
yogevbd committed
38
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
yogevbd's avatar
yogevbd committed
39
  [[RNNotifications sharedInstance] didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];
Lidan Hifi's avatar
Lidan Hifi committed
40 41
}

yogevbd's avatar
WIP  
yogevbd committed
42 43 44 45
- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error {
  [[RNNotifications sharedInstance] didFailToRegisterForRemoteNotificationsWithError:error];
}

Lidan Hifi's avatar
Lidan Hifi committed
46
@end