AppDelegate.m 1.58 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
  
yogevbd's avatar
yogevbd committed
28
  [RNNotifications startMonitorNotifications];
29
  
Lidan Hifi's avatar
Lidan Hifi committed
30 31 32
  return YES;
}

yogevbd's avatar
WIP  
yogevbd committed
33
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
yogevbd's avatar
yogevbd committed
34
  [RNNotifications didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];
Lidan Hifi's avatar
Lidan Hifi committed
35 36
}

yogevbd's avatar
WIP  
yogevbd committed
37
- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error {
yogevbd's avatar
yogevbd committed
38
  [RNNotifications didFailToRegisterForRemoteNotificationsWithError:error];
yogevbd's avatar
WIP  
yogevbd committed
39 40
}

Lidan Hifi's avatar
Lidan Hifi committed
41
@end