|
@@ -3,9 +3,10 @@
|
3
|
3
|
#import "RNNEventEmitter.h"
|
4
|
4
|
|
5
|
5
|
#import "RCTBridge.h"
|
|
6
|
+#import "RNNSplashScreen.h"
|
6
|
7
|
|
7
|
8
|
@interface RNN()
|
8
|
|
-
|
|
9
|
+@property RNNEventEmitter* eventEmitter;
|
9
|
10
|
@end
|
10
|
11
|
|
11
|
12
|
@implementation RNN
|
|
@@ -28,19 +29,32 @@
|
28
|
29
|
}
|
29
|
30
|
|
30
|
31
|
-(void)bootstrap:(NSURL *)jsCodeLocation launchOptions:(NSDictionary *)launchOptions
|
|
32
|
+{
|
|
33
|
+ self.eventEmitter = [RNNEventEmitter new];
|
|
34
|
+
|
|
35
|
+ UIApplication.sharedApplication.delegate.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
|
|
36
|
+ UIApplication.sharedApplication.delegate.window.backgroundColor = [UIColor whiteColor];
|
|
37
|
+
|
|
38
|
+ [RNNSplashScreen show];
|
|
39
|
+
|
|
40
|
+ [self registerForJsEvents];
|
|
41
|
+ // this will load the JS bundle
|
|
42
|
+ bridge = [[RCTBridge alloc] initWithBundleURL:jsCodeLocation moduleProvider:nil launchOptions:launchOptions];
|
|
43
|
+}
|
|
44
|
+
|
|
45
|
+-(void)registerForJsEvents
|
31
|
46
|
{
|
32
|
47
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onJavaScriptLoaded) name:RCTJavaScriptDidLoadNotification object:nil];
|
|
48
|
+
|
33
|
49
|
#pragma GCC diagnostic push
|
34
|
50
|
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
35
|
51
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onJavaScriptDevReload) name:RCTReloadNotification object:nil];
|
36
|
52
|
#pragma GCC diagnostic pop
|
37
|
|
- // this will load the JS bundle
|
38
|
|
- bridge = [[RCTBridge alloc] initWithBundleURL:jsCodeLocation moduleProvider:nil launchOptions:launchOptions];
|
39
|
53
|
}
|
40
|
54
|
|
41
|
55
|
-(void)onJavaScriptLoaded
|
42
|
56
|
{
|
43
|
|
- [RNNEventEmitter sendOnAppLaunched];
|
|
57
|
+ [self.eventEmitter sendOnAppLaunched];
|
44
|
58
|
}
|
45
|
59
|
|
46
|
60
|
-(void)onJavaScriptDevReload
|