|
@@ -14,12 +14,6 @@
|
14
|
14
|
#import <UMReactNativeAdapter/UMNativeModulesProxy.h>
|
15
|
15
|
#import <UMReactNativeAdapter/UMModuleRegistryAdapter.h>
|
16
|
16
|
|
17
|
|
-@interface AppDelegate ()
|
18
|
|
-
|
19
|
|
-@property (nonatomic, strong) NSDictionary *launchOptions;
|
20
|
|
-
|
21
|
|
-@end
|
22
|
|
-
|
23
|
17
|
@implementation AppDelegate
|
24
|
18
|
|
25
|
19
|
@synthesize window = _window;
|
|
@@ -27,34 +21,20 @@
|
27
|
21
|
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
|
28
|
22
|
{
|
29
|
23
|
self.moduleRegistryAdapter = [[UMModuleRegistryAdapter alloc] initWithModuleRegistryProvider:[[UMModuleRegistryProvider alloc] init]];
|
30
|
|
- self.launchOptions = launchOptions;
|
31
|
|
-
|
32
|
|
- self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
|
33
|
|
-#ifdef DEBUG
|
34
|
|
- [self initializeReactNativeApp];
|
35
|
|
-#else
|
36
|
|
- EXUpdatesAppController *controller = [EXUpdatesAppController sharedInstance];
|
37
|
|
- controller.delegate = self;
|
38
|
|
- [controller startAndShowLaunchScreen:self.window];
|
39
|
|
-#endif
|
40
|
|
-
|
41
|
|
- [super application:application didFinishLaunchingWithOptions:launchOptions];
|
42
|
24
|
|
43
|
|
- return YES;
|
44
|
|
-}
|
45
|
|
-
|
46
|
|
-- (RCTBridge *)initializeReactNativeApp
|
47
|
|
-{
|
48
|
25
|
RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:self.launchOptions];
|
49
|
26
|
RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge moduleName:@"main" initialProperties:nil];
|
50
|
27
|
rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];
|
51
|
28
|
|
|
29
|
+ self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
|
52
|
30
|
UIViewController *rootViewController = [UIViewController new];
|
53
|
31
|
rootViewController.view = rootView;
|
54
|
32
|
self.window.rootViewController = rootViewController;
|
55
|
33
|
[self.window makeKeyAndVisible];
|
56
|
34
|
|
57
|
|
- return bridge;
|
|
35
|
+ [super application:application didFinishLaunchingWithOptions:launchOptions];
|
|
36
|
+
|
|
37
|
+ return YES;
|
58
|
38
|
}
|
59
|
39
|
|
60
|
40
|
- (NSArray<id<RCTBridgeModule>> *)extraModulesForBridge:(RCTBridge *)bridge
|
|
@@ -69,13 +49,8 @@
|
69
|
49
|
#ifdef DEBUG
|
70
|
50
|
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
|
71
|
51
|
#else
|
72
|
|
- return [[EXUpdatesAppController sharedInstance] launchAssetUrl];
|
|
52
|
+ return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
|
73
|
53
|
#endif
|
74
|
54
|
}
|
75
|
55
|
|
76
|
|
-- (void)appController:(EXUpdatesAppController *)appController didStartWithSuccess:(BOOL)success
|
77
|
|
-{
|
78
|
|
- appController.bridge = [self initializeReactNativeApp];
|
79
|
|
-}
|
80
|
|
-
|
81
|
56
|
@end
|