Browse Source

refactoring

Daniel Zlotin 8 years ago
parent
commit
5d3299acdc

+ 0
- 2
ios/RNN.h View File

6
 
6
 
7
 @interface RNN : NSObject
7
 @interface RNN : NSObject
8
 
8
 
9
-+(id<UIApplicationDelegate>)appDelegate;
10
-
11
 +(instancetype)instance;
9
 +(instancetype)instance;
12
 
10
 
13
 -(void)init:(NSURL*)jsCodeLocation launchOptions:(NSDictionary*)launchOptions;
11
 -(void)init:(NSURL*)jsCodeLocation launchOptions:(NSDictionary*)launchOptions;

+ 5
- 9
ios/RNN.m View File

8
 
8
 
9
 @end
9
 @end
10
 
10
 
11
-@implementation RNN {
11
+@implementation RNN
12
+{
12
     RCTBridge* bridge;
13
     RCTBridge* bridge;
13
 }
14
 }
14
 
15
 
26
     return sharedInstance;
27
     return sharedInstance;
27
 }
28
 }
28
 
29
 
29
-+(id<UIApplicationDelegate>)appDelegate
30
-{
31
-    return UIApplication.sharedApplication.delegate;
32
-}
33
-
34
 -(void)init:(NSURL *)jsCodeLocation launchOptions:(NSDictionary *)launchOptions
30
 -(void)init:(NSURL *)jsCodeLocation launchOptions:(NSDictionary *)launchOptions
35
 {
31
 {
36
-    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onBridgeFinishedLoading) name:RCTJavaScriptDidLoadNotification object:nil];
32
+    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onJavaScriptLoaded) name:RCTJavaScriptDidLoadNotification object:nil];
37
     // this will load the JS bundle
33
     // this will load the JS bundle
38
     bridge = [[RCTBridge alloc] initWithBundleURL:jsCodeLocation moduleProvider:nil launchOptions:launchOptions];
34
     bridge = [[RCTBridge alloc] initWithBundleURL:jsCodeLocation moduleProvider:nil launchOptions:launchOptions];
39
 }
35
 }
40
 
36
 
41
--(void)onBridgeFinishedLoading
37
+-(void)onJavaScriptLoaded
42
 {
38
 {
43
-    [[bridge moduleForClass:[RNNEventEmitter class]] sendEventWithName:RNNEventOnAppLaunched body:nil];
39
+    [RNNEventEmitter sendOnAppLaunched];
44
 }
40
 }
45
 
41
 
46
 -(RCTBridge *)bridge
42
 -(RCTBridge *)bridge

+ 0
- 6
ios/RNNAssert.h View File

1
-
2
-#import <Foundation/Foundation.h>
3
-
4
-@interface RNNAssert : NSObject
5
-
6
-@end

+ 0
- 6
ios/RNNAssert.m View File

1
-
2
-#import "RNNAssert.h"
3
-
4
-@implementation RNNAssert
5
-
6
-@end

+ 2
- 2
ios/RNNBridgeModule.m View File

14
 
14
 
15
 RCT_EXPORT_METHOD(startApp:(NSDictionary*)layout)
15
 RCT_EXPORT_METHOD(startApp:(NSDictionary*)layout)
16
 {
16
 {
17
-    RNN.appDelegate.window.rootViewController = [RNNControllerFactory createRootViewController:layout];
18
-    [RNN.appDelegate.window makeKeyAndVisible];
17
+    UIApplication.sharedApplication.delegate.window.rootViewController = [RNNControllerFactory createRootViewController:layout];
18
+    [UIApplication.sharedApplication.delegate.window makeKeyAndVisible];
19
 }
19
 }
20
 
20
 
21
 @end
21
 @end

+ 2
- 2
ios/RNNEventEmitter.h View File

4
 #import "RCTEventEmitter.h"
4
 #import "RCTEventEmitter.h"
5
 #import "RCTBridgeModule.h"
5
 #import "RCTBridgeModule.h"
6
 
6
 
7
-extern NSString* const RNNEventOnAppLaunched;
8
-
9
 @interface RNNEventEmitter : RCTEventEmitter <RCTBridgeModule>
7
 @interface RNNEventEmitter : RCTEventEmitter <RCTBridgeModule>
10
 
8
 
9
++(void)sendOnAppLaunched;
10
+
11
 @end
11
 @end

+ 13
- 2
ios/RNNEventEmitter.m View File

1
 
1
 
2
 #import "RNNEventEmitter.h"
2
 #import "RNNEventEmitter.h"
3
+#import "RNN.h"
3
 
4
 
4
 @implementation RNNEventEmitter
5
 @implementation RNNEventEmitter
5
 
6
 
6
 RCT_EXPORT_MODULE();
7
 RCT_EXPORT_MODULE();
7
 
8
 
8
-NSString* const RNNEventOnAppLaunched = @"onAppLaunched";
9
+static NSString* const onAppLaunched = @"onAppLaunched";
9
 
10
 
10
 -(NSArray<NSString *> *)supportedEvents
11
 -(NSArray<NSString *> *)supportedEvents
11
 {
12
 {
12
-    return @[RNNEventOnAppLaunched];
13
+    return @[onAppLaunched];
14
+}
15
+
16
++(void)sendOnAppLaunched
17
+{
18
+    [RNNEventEmitter send:onAppLaunched body:nil];
19
+}
20
+
21
++(void)send:(NSString *)eventName body:(id)body
22
+{
23
+    [[RNN.instance.bridge moduleForClass:[RNNEventEmitter class]] sendEventWithName:eventName body:body];
13
 }
24
 }
14
 
25
 
15
 @end
26
 @end

+ 3
- 2
ios/ReactNativeNavigation.m View File

1
 
1
 
2
 #import "ReactNativeNavigation.h"
2
 #import "ReactNativeNavigation.h"
3
+
3
 #import "RNNSplashScreen.h"
4
 #import "RNNSplashScreen.h"
4
 #import "RNN.h"
5
 #import "RNN.h"
5
 
6
 
12
 
13
 
13
 +(void)bootstrap:(NSURL *)jsCodeLocation launchOptions:(NSDictionary *)launchOptions
14
 +(void)bootstrap:(NSURL *)jsCodeLocation launchOptions:(NSDictionary *)launchOptions
14
 {
15
 {
15
-    RNN.appDelegate.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
16
-    RNN.appDelegate.window.backgroundColor = [UIColor whiteColor];
16
+    UIApplication.sharedApplication.delegate.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
17
+    UIApplication.sharedApplication.delegate.window.backgroundColor = [UIColor whiteColor];
17
     
18
     
18
     [RNNSplashScreen show];
19
     [RNNSplashScreen show];
19
     
20
     

+ 15
- 15
ios/ReactNativeNavigation.xcodeproj/project.pbxproj View File

7
 	objects = {
7
 	objects = {
8
 
8
 
9
 /* Begin PBXBuildFile section */
9
 /* Begin PBXBuildFile section */
10
-		7B11269D1E2D1D4800F9B03B /* RNNAssert.m in Sources */ = {isa = PBXBuildFile; fileRef = 7B11269C1E2D1D4800F9B03B /* RNNAssert.m */; };
11
 		7B1126A01E2D263F00F9B03B /* RNNEventEmitter.m in Sources */ = {isa = PBXBuildFile; fileRef = 7B11269F1E2D263F00F9B03B /* RNNEventEmitter.m */; };
10
 		7B1126A01E2D263F00F9B03B /* RNNEventEmitter.m in Sources */ = {isa = PBXBuildFile; fileRef = 7B11269F1E2D263F00F9B03B /* RNNEventEmitter.m */; };
12
 		7B1126A31E2D2B6C00F9B03B /* RNNSplashScreen.h in Headers */ = {isa = PBXBuildFile; fileRef = 7BA500761E254908001B9E1B /* RNNSplashScreen.h */; };
11
 		7B1126A31E2D2B6C00F9B03B /* RNNSplashScreen.h in Headers */ = {isa = PBXBuildFile; fileRef = 7BA500761E254908001B9E1B /* RNNSplashScreen.h */; };
13
 		7B1126A41E2D2B6C00F9B03B /* ReactNativeNavigation.h in Headers */ = {isa = PBXBuildFile; fileRef = 7BA500731E2544B9001B9E1B /* ReactNativeNavigation.h */; settings = {ATTRIBUTES = (Public, ); }; };
12
 		7B1126A41E2D2B6C00F9B03B /* ReactNativeNavigation.h in Headers */ = {isa = PBXBuildFile; fileRef = 7BA500731E2544B9001B9E1B /* ReactNativeNavigation.h */; settings = {ATTRIBUTES = (Public, ); }; };
14
 		7B1126A51E2D2B6C00F9B03B /* RNN.h in Headers */ = {isa = PBXBuildFile; fileRef = 7BBFE55F1E253F97002A6182 /* RNN.h */; };
13
 		7B1126A51E2D2B6C00F9B03B /* RNN.h in Headers */ = {isa = PBXBuildFile; fileRef = 7BBFE55F1E253F97002A6182 /* RNN.h */; };
15
 		7B1126A61E2D2B6C00F9B03B /* RNNBridgeModule.h in Headers */ = {isa = PBXBuildFile; fileRef = 7BBFE5421E25330E002A6182 /* RNNBridgeModule.h */; };
14
 		7B1126A61E2D2B6C00F9B03B /* RNNBridgeModule.h in Headers */ = {isa = PBXBuildFile; fileRef = 7BBFE5421E25330E002A6182 /* RNNBridgeModule.h */; };
16
 		7B1126A71E2D2B6C00F9B03B /* RNNEventEmitter.h in Headers */ = {isa = PBXBuildFile; fileRef = 7B11269E1E2D263F00F9B03B /* RNNEventEmitter.h */; };
15
 		7B1126A71E2D2B6C00F9B03B /* RNNEventEmitter.h in Headers */ = {isa = PBXBuildFile; fileRef = 7B11269E1E2D263F00F9B03B /* RNNEventEmitter.h */; };
17
-		7B1126A81E2D2B6C00F9B03B /* RNNAssert.h in Headers */ = {isa = PBXBuildFile; fileRef = 7B11269B1E2D1D4800F9B03B /* RNNAssert.h */; };
18
 		7B1126A91E2D2B6C00F9B03B /* RNNControllerFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = 7BC9346C1E26886E00EFA125 /* RNNControllerFactory.h */; };
16
 		7B1126A91E2D2B6C00F9B03B /* RNNControllerFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = 7BC9346C1E26886E00EFA125 /* RNNControllerFactory.h */; };
19
 		7BA500751E2544B9001B9E1B /* ReactNativeNavigation.m in Sources */ = {isa = PBXBuildFile; fileRef = 7BA500741E2544B9001B9E1B /* ReactNativeNavigation.m */; };
17
 		7BA500751E2544B9001B9E1B /* ReactNativeNavigation.m in Sources */ = {isa = PBXBuildFile; fileRef = 7BA500741E2544B9001B9E1B /* ReactNativeNavigation.m */; };
20
 		7BA500781E254908001B9E1B /* RNNSplashScreen.m in Sources */ = {isa = PBXBuildFile; fileRef = 7BA500771E254908001B9E1B /* RNNSplashScreen.m */; };
18
 		7BA500781E254908001B9E1B /* RNNSplashScreen.m in Sources */ = {isa = PBXBuildFile; fileRef = 7BA500771E254908001B9E1B /* RNNSplashScreen.m */; };
36
 /* End PBXCopyFilesBuildPhase section */
34
 /* End PBXCopyFilesBuildPhase section */
37
 
35
 
38
 /* Begin PBXFileReference section */
36
 /* Begin PBXFileReference section */
39
-		7B11269B1E2D1D4800F9B03B /* RNNAssert.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNNAssert.h; sourceTree = "<group>"; };
40
-		7B11269C1E2D1D4800F9B03B /* RNNAssert.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNNAssert.m; sourceTree = "<group>"; };
41
 		7B11269E1E2D263F00F9B03B /* RNNEventEmitter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNNEventEmitter.h; sourceTree = "<group>"; };
37
 		7B11269E1E2D263F00F9B03B /* RNNEventEmitter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNNEventEmitter.h; sourceTree = "<group>"; };
42
 		7B11269F1E2D263F00F9B03B /* RNNEventEmitter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNNEventEmitter.m; sourceTree = "<group>"; };
38
 		7B11269F1E2D263F00F9B03B /* RNNEventEmitter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNNEventEmitter.m; sourceTree = "<group>"; };
43
 		7BA500731E2544B9001B9E1B /* ReactNativeNavigation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ReactNativeNavigation.h; sourceTree = "<group>"; };
39
 		7BA500731E2544B9001B9E1B /* ReactNativeNavigation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ReactNativeNavigation.h; sourceTree = "<group>"; };
69
 			children = (
65
 			children = (
70
 				7BA500761E254908001B9E1B /* RNNSplashScreen.h */,
66
 				7BA500761E254908001B9E1B /* RNNSplashScreen.h */,
71
 				7BA500771E254908001B9E1B /* RNNSplashScreen.m */,
67
 				7BA500771E254908001B9E1B /* RNNSplashScreen.m */,
68
+				7BC9346C1E26886E00EFA125 /* RNNControllerFactory.h */,
69
+				7BC9346D1E26886E00EFA125 /* RNNControllerFactory.m */,
72
 			);
70
 			);
73
 			name = Controllers;
71
 			name = Controllers;
74
 			sourceTree = "<group>";
72
 			sourceTree = "<group>";
75
 		};
73
 		};
74
+		7BD721F31E2D3AA100724059 /* Bridge */ = {
75
+			isa = PBXGroup;
76
+			children = (
77
+				7BBFE5421E25330E002A6182 /* RNNBridgeModule.h */,
78
+				7BBFE5431E25330E002A6182 /* RNNBridgeModule.m */,
79
+				7B11269E1E2D263F00F9B03B /* RNNEventEmitter.h */,
80
+				7B11269F1E2D263F00F9B03B /* RNNEventEmitter.m */,
81
+			);
82
+			name = Bridge;
83
+			sourceTree = "<group>";
84
+		};
76
 		D8AFADB41BEE6F3F00A4592D = {
85
 		D8AFADB41BEE6F3F00A4592D = {
77
 			isa = PBXGroup;
86
 			isa = PBXGroup;
78
 			children = (
87
 			children = (
79
-				7B1E4C4B1E2D173700C3A525 /* Controllers */,
80
 				7BA500731E2544B9001B9E1B /* ReactNativeNavigation.h */,
88
 				7BA500731E2544B9001B9E1B /* ReactNativeNavigation.h */,
81
 				7BA500741E2544B9001B9E1B /* ReactNativeNavigation.m */,
89
 				7BA500741E2544B9001B9E1B /* ReactNativeNavigation.m */,
90
+				7BD721F31E2D3AA100724059 /* Bridge */,
91
+				7B1E4C4B1E2D173700C3A525 /* Controllers */,
82
 				7BBFE55F1E253F97002A6182 /* RNN.h */,
92
 				7BBFE55F1E253F97002A6182 /* RNN.h */,
83
 				7BBFE5601E253F97002A6182 /* RNN.m */,
93
 				7BBFE5601E253F97002A6182 /* RNN.m */,
84
-				7BBFE5421E25330E002A6182 /* RNNBridgeModule.h */,
85
-				7BBFE5431E25330E002A6182 /* RNNBridgeModule.m */,
86
-				7B11269E1E2D263F00F9B03B /* RNNEventEmitter.h */,
87
-				7B11269F1E2D263F00F9B03B /* RNNEventEmitter.m */,
88
-				7B11269B1E2D1D4800F9B03B /* RNNAssert.h */,
89
-				7B11269C1E2D1D4800F9B03B /* RNNAssert.m */,
90
-				7BC9346C1E26886E00EFA125 /* RNNControllerFactory.h */,
91
-				7BC9346D1E26886E00EFA125 /* RNNControllerFactory.m */,
92
 				D8AFADBE1BEE6F3F00A4592D /* Products */,
94
 				D8AFADBE1BEE6F3F00A4592D /* Products */,
93
 			);
95
 			);
94
 			sourceTree = "<group>";
96
 			sourceTree = "<group>";
113
 				7B1126A51E2D2B6C00F9B03B /* RNN.h in Headers */,
115
 				7B1126A51E2D2B6C00F9B03B /* RNN.h in Headers */,
114
 				7B1126A61E2D2B6C00F9B03B /* RNNBridgeModule.h in Headers */,
116
 				7B1126A61E2D2B6C00F9B03B /* RNNBridgeModule.h in Headers */,
115
 				7B1126A71E2D2B6C00F9B03B /* RNNEventEmitter.h in Headers */,
117
 				7B1126A71E2D2B6C00F9B03B /* RNNEventEmitter.h in Headers */,
116
-				7B1126A81E2D2B6C00F9B03B /* RNNAssert.h in Headers */,
117
 				7B1126A91E2D2B6C00F9B03B /* RNNControllerFactory.h in Headers */,
118
 				7B1126A91E2D2B6C00F9B03B /* RNNControllerFactory.h in Headers */,
118
 			);
119
 			);
119
 			runOnlyForDeploymentPostprocessing = 0;
120
 			runOnlyForDeploymentPostprocessing = 0;
176
 			buildActionMask = 2147483647;
177
 			buildActionMask = 2147483647;
177
 			files = (
178
 			files = (
178
 				7B1126A01E2D263F00F9B03B /* RNNEventEmitter.m in Sources */,
179
 				7B1126A01E2D263F00F9B03B /* RNNEventEmitter.m in Sources */,
179
-				7B11269D1E2D1D4800F9B03B /* RNNAssert.m in Sources */,
180
 				7BA500751E2544B9001B9E1B /* ReactNativeNavigation.m in Sources */,
180
 				7BA500751E2544B9001B9E1B /* ReactNativeNavigation.m in Sources */,
181
 				7BBFE5441E25330E002A6182 /* RNNBridgeModule.m in Sources */,
181
 				7BBFE5441E25330E002A6182 /* RNNBridgeModule.m in Sources */,
182
 				7BA500781E254908001B9E1B /* RNNSplashScreen.m in Sources */,
182
 				7BA500781E254908001B9E1B /* RNNSplashScreen.m in Sources */,

+ 0
- 8
playground/ios/playground.xcodeproj/project.pbxproj View File

21
 		13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; };
21
 		13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; };
22
 		13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; };
22
 		13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; };
23
 		146834051AC3E58100842450 /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 146834041AC3E56700842450 /* libReact.a */; };
23
 		146834051AC3E58100842450 /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 146834041AC3E56700842450 /* libReact.a */; };
24
-		2636F1CD1E11309B007ABB09 /* RNNViewControllerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 2636F1CC1E11309B007ABB09 /* RNNViewControllerTests.m */; };
25
 		2647D65F1DB175C200B23722 /* libReactNativeNavigation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2647D65E1DB175B300B23722 /* libReactNativeNavigation.a */; };
24
 		2647D65F1DB175C200B23722 /* libReactNativeNavigation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2647D65E1DB175B300B23722 /* libReactNativeNavigation.a */; };
26
 		7B9B39861DEB4091004A6281 /* libRCTAnimation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 7B9B39631DEB4076004A6281 /* libRCTAnimation.a */; };
25
 		7B9B39861DEB4091004A6281 /* libRCTAnimation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 7B9B39631DEB4076004A6281 /* libRCTAnimation.a */; };
27
-		7BC934871E268CF600EFA125 /* RNNControllerFactoryTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 7BC934861E268CF600EFA125 /* RNNControllerFactoryTest.m */; };
28
 		832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 832341B51AAA6A8300B99B32 /* libRCTText.a */; };
26
 		832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 832341B51AAA6A8300B99B32 /* libRCTText.a */; };
29
 /* End PBXBuildFile section */
27
 /* End PBXBuildFile section */
30
 
28
 
204
 		13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
202
 		13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
205
 		13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
203
 		13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
206
 		146833FF1AC3E56700842450 /* React.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = React.xcodeproj; path = "../node_modules/react-native/React/React.xcodeproj"; sourceTree = "<group>"; };
204
 		146833FF1AC3E56700842450 /* React.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = React.xcodeproj; path = "../node_modules/react-native/React/React.xcodeproj"; sourceTree = "<group>"; };
207
-		2636F1CC1E11309B007ABB09 /* RNNViewControllerTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNNViewControllerTests.m; sourceTree = "<group>"; };
208
 		2647D6591DB175B300B23722 /* ReactNativeNavigation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = ReactNativeNavigation.xcodeproj; path = "../node_modules/react-native-navigation/ios/ReactNativeNavigation.xcodeproj"; sourceTree = "<group>"; };
205
 		2647D6591DB175B300B23722 /* ReactNativeNavigation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = ReactNativeNavigation.xcodeproj; path = "../node_modules/react-native-navigation/ios/ReactNativeNavigation.xcodeproj"; sourceTree = "<group>"; };
209
 		78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTLinking.xcodeproj; path = "../node_modules/react-native/Libraries/LinkingIOS/RCTLinking.xcodeproj"; sourceTree = "<group>"; };
206
 		78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTLinking.xcodeproj; path = "../node_modules/react-native/Libraries/LinkingIOS/RCTLinking.xcodeproj"; sourceTree = "<group>"; };
210
 		7B9B395C1DEB4076004A6281 /* RCTAnimation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTAnimation.xcodeproj; path = "../node_modules/react-native/Libraries/NativeAnimation/RCTAnimation.xcodeproj"; sourceTree = "<group>"; };
207
 		7B9B395C1DEB4076004A6281 /* RCTAnimation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTAnimation.xcodeproj; path = "../node_modules/react-native/Libraries/NativeAnimation/RCTAnimation.xcodeproj"; sourceTree = "<group>"; };
211
-		7BC934861E268CF600EFA125 /* RNNControllerFactoryTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNNControllerFactoryTest.m; sourceTree = "<group>"; };
212
 		832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTText.xcodeproj; path = "../node_modules/react-native/Libraries/Text/RCTText.xcodeproj"; sourceTree = "<group>"; };
208
 		832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTText.xcodeproj; path = "../node_modules/react-native/Libraries/Text/RCTText.xcodeproj"; sourceTree = "<group>"; };
213
 /* End PBXFileReference section */
209
 /* End PBXFileReference section */
214
 
210
 
288
 			isa = PBXGroup;
284
 			isa = PBXGroup;
289
 			children = (
285
 			children = (
290
 				00E356F21AD99517003FC87E /* playgroundTests.m */,
286
 				00E356F21AD99517003FC87E /* playgroundTests.m */,
291
-				2636F1CC1E11309B007ABB09 /* RNNViewControllerTests.m */,
292
-				7BC934861E268CF600EFA125 /* RNNControllerFactoryTest.m */,
293
 				00E356F01AD99517003FC87E /* Supporting Files */,
287
 				00E356F01AD99517003FC87E /* Supporting Files */,
294
 			);
288
 			);
295
 			path = playgroundTests;
289
 			path = playgroundTests;
745
 			buildActionMask = 2147483647;
739
 			buildActionMask = 2147483647;
746
 			files = (
740
 			files = (
747
 				00E356F31AD99517003FC87E /* playgroundTests.m in Sources */,
741
 				00E356F31AD99517003FC87E /* playgroundTests.m in Sources */,
748
-				2636F1CD1E11309B007ABB09 /* RNNViewControllerTests.m in Sources */,
749
-				7BC934871E268CF600EFA125 /* RNNControllerFactoryTest.m in Sources */,
750
 			);
742
 			);
751
 			runOnlyForDeploymentPostprocessing = 0;
743
 			runOnlyForDeploymentPostprocessing = 0;
752
 		};
744
 		};

+ 0
- 32
playground/ios/playgroundTests/RNNControllerFactoryTest.m View File

1
-
2
-#import <XCTest/XCTest.h>
3
-#import "RNNControllerFactory.h"
4
-#import "RCTRootView.h"
5
-
6
-@interface RNNControllerFactoryTest : XCTestCase
7
-
8
-@end
9
-
10
-@implementation RNNControllerFactoryTest
11
-
12
-- (void)setUp {
13
-    [super setUp];
14
-    // Put setup code here. This method is called before the invocation of each test method in the class.
15
-}
16
-
17
-- (void)tearDown {
18
-    [super tearDown];
19
-}
20
-
21
-- (void)testExample {
22
-  NSDictionary* layout = @{
23
-                           @"container": @{
24
-                               @"name": @"myName",
25
-                               @"id": @"my-id"
26
-                               }
27
-                           };
28
-  UIViewController* rootViewController = [RNNControllerFactory createRootViewController:layout];
29
-  XCTAssert([((RCTRootView*)rootViewController.view).moduleName isEqualToString:@"myName"]);
30
-}
31
-
32
-@end

+ 0
- 114
playground/ios/playgroundTests/RNNViewControllerTests.m View File

1
-////
2
-////  RNNViewControllerTests.m
3
-////
4
-////  Created by Ran Greenberg on 26/12/2016.
5
-////  Copyright © 2016 Facebook. All rights reserved.
6
-////
7
-//
8
-//#import <XCTest/XCTest.h>
9
-//#import "RCCManager.h"
10
-//#import "RNNViewController.h"
11
-//#import "MMDrawerController.h"
12
-//
13
-//#define COMMAND_SINGLE_SCREEN_APP               @"singleScreenApp"
14
-//#define COMMAND_TAB_BASED_APP                   @"tabBasedApp"
15
-//#define COMMAND_SINGLE_WITH_LEFT_SIDE_MENU      @"singleWithLeftSideMenu"
16
-//#define COMMAND_SINGLE_WITH_RIGHT_SIDE_MENU     @"singleWithRightSideMenu"
17
-//#define COMMAND_SINGLE_WITH_BOTH_SIDE_MENU      @"singleWithBothMenus"
18
-//#define COMMAND_TAB_BASED_WITH_SIDE_MENT        @"tabBasedWithSideMenu"
19
-//
20
-//
21
-//@interface RNNViewControllerTests : XCTestCase
22
-//@property (nonatomic, strong) RCTBridge *bridge;
23
-//@property (nonatomic, strong) NSDictionary *jsonCommands;
24
-//@end
25
-//
26
-//@implementation RNNViewControllerTests
27
-//
28
-//- (void)setUp {
29
-//  [super setUp];
30
-//  // Put setup code here. This method is called before the invocation of each test method in the class.
31
-//  self.bridge = [[RCCManager sharedInstance] getBridge];
32
-//  self.jsonCommands = [self loadCommandsJsonAsDictionary];
33
-//}
34
-//
35
-//- (void)tearDown {
36
-//  // Put teardown code here. This method is called after the invocation of each test method in the class.
37
-//  self.bridge = nil;
38
-//  self.jsonCommands = nil;
39
-//  [super tearDown];
40
-//}
41
-//
42
-//-(NSDictionary*)loadCommandsJsonAsDictionary {
43
-//  NSString *filePath = [[NSBundle mainBundle] pathForResource:@"commands" ofType:@"json"];
44
-//  NSData *data = [NSData dataWithContentsOfFile:filePath];
45
-//  NSDictionary *json = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:nil];
46
-//  return json;
47
-//}
48
-//
49
-//- (void)testWrongSyntax {
50
-//  
51
-//  NSDictionary *layout = @{@"key": @"com.example.FirstTabScreen"};
52
-//  id vc = [RNNViewController controllerWithLayout:layout bridge:self.bridge];
53
-//  XCTAssertNil(vc);
54
-//}
55
-//
56
-//-(void)testSingleScreenApp {
57
-//  id vc = [RNNViewController controllerWithLayout:self.jsonCommands[COMMAND_SINGLE_SCREEN_APP] bridge:self.bridge];
58
-//  XCTAssertTrue([vc isKindOfClass:[UINavigationController class]]);
59
-//}
60
-//
61
-//-(void)testTabBasedApp {
62
-//  id vc = [RNNViewController controllerWithLayout:self.jsonCommands[COMMAND_TAB_BASED_APP] bridge:self.bridge];
63
-//  XCTAssertTrue([vc isKindOfClass:[UITabBarController class]]);
64
-//  UITabBarController *tabsController = (UITabBarController*)vc;
65
-//  for (id tab in tabsController.viewControllers) {
66
-//    XCTAssertTrue([tab isKindOfClass:[UINavigationController class]]);
67
-//  }
68
-//}
69
-//
70
-//-(void)testSingleWithLeftSideMenu {
71
-//  id vc = [RNNViewController controllerWithLayout:self.jsonCommands[COMMAND_SINGLE_WITH_LEFT_SIDE_MENU] bridge:self.bridge];
72
-//  XCTAssertTrue([vc isKindOfClass:[MMDrawerController class]]);
73
-//  MMDrawerController *sideMenuLeft = (MMDrawerController*)vc;
74
-//  XCTAssertNotNil(sideMenuLeft.leftDrawerViewController);
75
-//  XCTAssertNotNil(sideMenuLeft.centerViewController);
76
-//  XCTAssertNil(sideMenuLeft.rightDrawerViewController);
77
-//}
78
-//
79
-//-(void)testSingleWithRightSideMenu {
80
-//  id vc = [RNNViewController controllerWithLayout:self.jsonCommands[COMMAND_SINGLE_WITH_RIGHT_SIDE_MENU] bridge:self.bridge];
81
-//  XCTAssertTrue([vc isKindOfClass:[MMDrawerController class]]);
82
-//  MMDrawerController *sideMenuRight = (MMDrawerController*)vc;
83
-//  XCTAssertNil(sideMenuRight.leftDrawerViewController);
84
-//  XCTAssertNotNil(sideMenuRight.centerViewController);
85
-//  XCTAssertNotNil(sideMenuRight.rightDrawerViewController);
86
-//
87
-//}
88
-//
89
-//-(void)testSingleWithBothSideMenu {
90
-//  id vc = [RNNViewController controllerWithLayout:self.jsonCommands[COMMAND_SINGLE_WITH_BOTH_SIDE_MENU] bridge:self.bridge];
91
-//  XCTAssertTrue([vc isKindOfClass:[MMDrawerController class]]);
92
-//  MMDrawerController *sideMenuBoth = (MMDrawerController*)vc;
93
-//  XCTAssertNotNil(sideMenuBoth.leftDrawerViewController);
94
-//  XCTAssertNotNil(sideMenuBoth.centerViewController);
95
-//  XCTAssertNotNil(sideMenuBoth.rightDrawerViewController);
96
-//}
97
-//
98
-//-(void)testTabBasedWithBothSideMenu {
99
-//  id vc = [RNNViewController controllerWithLayout:self.jsonCommands[COMMAND_TAB_BASED_WITH_SIDE_MENT] bridge:self.bridge];
100
-//  XCTAssertTrue([vc isKindOfClass:[MMDrawerController class]]);
101
-//  MMDrawerController *sideMenuBothWithTabs = (MMDrawerController*)vc;
102
-//  XCTAssertNotNil(sideMenuBothWithTabs.leftDrawerViewController);
103
-//  XCTAssertNotNil(sideMenuBothWithTabs.centerViewController);
104
-//  XCTAssertNotNil(sideMenuBothWithTabs.rightDrawerViewController);
105
-//  XCTAssertTrue([sideMenuBothWithTabs.centerViewController isKindOfClass:[UITabBarController class]]);
106
-//}
107
-////- (void)testPerformanceExample {
108
-////  // This is an example of a performance test case.
109
-////  [self measureBlock:^{
110
-////    // Put the code you want to measure the time of here.
111
-////  }];
112
-////}
113
-//
114
-//@end