Browse Source

ios refactoring

Daniel Zlotin 7 years ago
parent
commit
5fc49c4895

+ 3
- 0
ios/RNN.m View File

71
 -(void)onJavaScriptWillLoad
71
 -(void)onJavaScriptWillLoad
72
 {
72
 {
73
 	self.store = [RNNStore new];
73
 	self.store = [RNNStore new];
74
+	[self resetRootViewControllerOnlyOnJSDevReload];
75
+}
74
 
76
 
77
+-(void)resetRootViewControllerOnlyOnJSDevReload {
75
 	if(![UIApplication.sharedApplication.delegate.window.rootViewController isKindOfClass:[RNNSplashScreen class]]) {
78
 	if(![UIApplication.sharedApplication.delegate.window.rootViewController isKindOfClass:[RNNSplashScreen class]]) {
76
 		UIApplication.sharedApplication.delegate.window.rootViewController = nil;
79
 		UIApplication.sharedApplication.delegate.window.rootViewController = nil;
77
 	}
80
 	}

+ 0
- 2
ios/RNNReactRootViewCreator.m View File

14
 
14
 
15
  - (UIView*)createRootView:(NSString*)name rootViewId:(NSString*)rootViewId
15
  - (UIView*)createRootView:(NSString*)name rootViewId:(NSString*)rootViewId
16
 {
16
 {
17
-	
18
 	if (!rootViewId) {
17
 	if (!rootViewId) {
19
 		@throw [NSException exceptionWithName:@"MissingViewId" reason:@"Missing view id" userInfo:nil];
18
 		@throw [NSException exceptionWithName:@"MissingViewId" reason:@"Missing view id" userInfo:nil];
20
 	}
19
 	}
22
 	UIView *view = [[RCTRootView alloc] initWithBridge:[RNN instance].bridge
21
 	UIView *view = [[RCTRootView alloc] initWithBridge:[RNN instance].bridge
23
 										 moduleName:name
22
 										 moduleName:name
24
 								  initialProperties:@{@"id": rootViewId}];
23
 								  initialProperties:@{@"id": rootViewId}];
25
-	
26
 	return view;
24
 	return view;
27
 }
25
 }
28
 
26
 

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

256
 		D8AFADB41BEE6F3F00A4592D = {
256
 		D8AFADB41BEE6F3F00A4592D = {
257
 			isa = PBXGroup;
257
 			isa = PBXGroup;
258
 			children = (
258
 			children = (
259
-				263905881E4C6F440023D7D3 /* RNNSideMenu */,
260
 				7BA500731E2544B9001B9E1B /* ReactNativeNavigation.h */,
259
 				7BA500731E2544B9001B9E1B /* ReactNativeNavigation.h */,
261
 				7BA500741E2544B9001B9E1B /* ReactNativeNavigation.m */,
260
 				7BA500741E2544B9001B9E1B /* ReactNativeNavigation.m */,
262
 				7BBFE55F1E253F97002A6182 /* RNN.h */,
261
 				7BBFE55F1E253F97002A6182 /* RNN.h */,
263
 				7BBFE5601E253F97002A6182 /* RNN.m */,
262
 				7BBFE5601E253F97002A6182 /* RNN.m */,
264
 				7BD721F31E2D3AA100724059 /* Bridge */,
263
 				7BD721F31E2D3AA100724059 /* Bridge */,
265
 				7B1E4C4B1E2D173700C3A525 /* Controllers */,
264
 				7B1E4C4B1E2D173700C3A525 /* Controllers */,
265
+				263905881E4C6F440023D7D3 /* RNNSideMenu */,
266
 				D8AFADBE1BEE6F3F00A4592D /* Products */,
266
 				D8AFADBE1BEE6F3F00A4592D /* Products */,
267
 			);
267
 			);
268
 			sourceTree = "<group>";
268
 			sourceTree = "<group>";

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

28
 }
28
 }
29
 
29
 
30
 - (void)tearDown {
30
 - (void)tearDown {
31
-	// Put teardown code here. This method is called after the invocation of each test method in the class.
32
 	[super tearDown];
31
 	[super tearDown];
33
 }
32
 }
34
 
33
 

+ 3
- 3
playground/ios/playgroundTests/RNNStoreTest.m View File

80
 	[self setContainerAndRelease:vcId];
80
 	[self setContainerAndRelease:vcId];
81
 	
81
 	
82
 	
82
 	
83
-	XCTAssertNil([self.store findContainerForId:vcId]); // PASS
83
+	XCTAssertNil([self.store findContainerForId:vcId]);
84
 }
84
 }
85
 
85
 
86
--(void) setContainerAndRelease:(NSString*)vcId {
86
+-(void)setContainerAndRelease:(NSString*)vcId {
87
 	@autoreleasepool {
87
 	@autoreleasepool {
88
 		UIViewController *vc2 = [UIViewController new];
88
 		UIViewController *vc2 = [UIViewController new];
89
 		[self.store setContainer:vc2 containerId:vcId];
89
 		[self.store setContainer:vc2 containerId:vcId];
90
 		
90
 		
91
-		XCTAssertNotNil([self.store findContainerForId:vcId]); // PASS
91
+		XCTAssertNotNil([self.store findContainerForId:vcId]);
92
 	}
92
 	}
93
 }
93
 }
94
 
94