AppDelegate.m 3.48 KB
Newer Older
Giang Tran committed
1 2 3 4 5 6
#import "AppDelegate.h"

#import <React/RCTBridge.h>
#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>

7
@import Firebase;
Giang Tran committed
8
  #import <React/RCTLinkingManager.h>
Giang Tran committed
9
#import <AVFoundation/AVFoundation.h>
Giang Tran committed
10
#import "RNBootSplash.h"
Giang Tran committed
11 12 13 14 15 16 17
#if DEBUG
#import <FlipperKit/FlipperClient.h>
#import <FlipperKitLayoutPlugin/FlipperKitLayoutPlugin.h>
#import <FlipperKitUserDefaultsPlugin/FKUserDefaultsPlugin.h>
#import <FlipperKitNetworkPlugin/FlipperKitNetworkPlugin.h>
#import <SKIOSNetworkPlugin/SKIOSNetworkAdapter.h>
#import <FlipperKitReactPlugin/FlipperKitReactPlugin.h>
18
//#import <CallAppSDK/CallAppInterface.h>
Giang Tran committed
19

Giang Tran committed
20

Giang Tran committed
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
static void InitializeFlipper(UIApplication *application) {
  FlipperClient *client = [FlipperClient sharedClient];
  SKDescriptorMapper *layoutDescriptorMapper = [[SKDescriptorMapper alloc] initWithDefaults];
  [client addPlugin:[[FlipperKitLayoutPlugin alloc] initWithRootNode:application withDescriptorMapper:layoutDescriptorMapper]];
  [client addPlugin:[[FKUserDefaultsPlugin alloc] initWithSuiteName:nil]];
  [client addPlugin:[FlipperKitReactPlugin new]];
  [client addPlugin:[[FlipperKitNetworkPlugin alloc] initWithNetworkAdapter:[SKIOSNetworkAdapter new]]];
  [client start];
}
#endif

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
#if DEBUG
  InitializeFlipper(application);
#endif
Giang Tran committed
39
     
Giang Tran committed
40
     [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback error: nil];
Giang Tran committed
41 42 43 44
  RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
  RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
                                                   moduleName:@"Invest"
                                            initialProperties:nil];
45
  [FIRApp configure];
Giang Tran committed
46 47 48 49 50 51 52 53

  rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];

  self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
  UIViewController *rootViewController = [UIViewController new];
  rootViewController.view = rootView;
  self.window.rootViewController = rootViewController;
  [self.window makeKeyAndVisible];
Giang Tran committed
54
  [RNBootSplash initWithStoryboard:@"BootSplash" rootView:rootView];
55
//  [CallAppInterface setHomeViewController:rootViewController];
Giang Tran committed
56 57 58
  return YES;
}

Giang Tran committed
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
 #import <React/RCTLinkingManager.h>

// - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url
//   sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
// {
//   return [RCTLinkingManager application:application openURL:url
//                       sourceApplication:sourceApplication annotation:annotation];
// }


- (BOOL)application:(UIApplication *)application
            openURL:(NSURL *)url
            options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options
{
  return [RCTLinkingManager application:application openURL:url options:options];
}

- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity
 restorationHandler:(void (^)(NSArray * _Nullable))restorationHandler
{
  return [RCTLinkingManager application:application
                   continueUserActivity:userActivity
                     restorationHandler:restorationHandler];
}



Giang Tran committed
86 87 88 89 90 91 92 93 94 95
- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
{
#if DEBUG
  return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
#else
  return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
#endif
}

@end