Browse Source

ios - rename createLayout to createLayoutAndSaveToStore

Ran Greenberg 8 years ago
parent
commit
d6b613913f
3 changed files with 11 additions and 12 deletions
  1. 3
    3
      ios/RNNBridgeModule.m
  2. 1
    1
      ios/RNNControllerFactory.h
  3. 7
    8
      ios/RNNControllerFactory.m

+ 3
- 3
ios/RNNBridgeModule.m View File

18
 {
18
 {
19
 	[self assertReady];
19
 	[self assertReady];
20
 	RNNControllerFactory *factory = [[RNNControllerFactory alloc] initWithRootViewCreator:[RNNReactRootViewCreator new] store:[RNN instance].store];
20
 	RNNControllerFactory *factory = [[RNNControllerFactory alloc] initWithRootViewCreator:[RNNReactRootViewCreator new] store:[RNN instance].store];
21
-	UIViewController *vc = [factory createLayout:layout];
21
+	UIViewController *vc = [factory createLayoutAndSaveToStore:layout];
22
 	
22
 	
23
 	UIApplication.sharedApplication.delegate.window.rootViewController = vc;
23
 	UIApplication.sharedApplication.delegate.window.rootViewController = vc;
24
 	[UIApplication.sharedApplication.delegate.window makeKeyAndVisible];
24
 	[UIApplication.sharedApplication.delegate.window makeKeyAndVisible];
28
 {
28
 {
29
 	[self assertReady];
29
 	[self assertReady];
30
 	RNNControllerFactory *factory = [[RNNControllerFactory alloc] initWithRootViewCreator:[RNNReactRootViewCreator new] store:[RNN instance].store];
30
 	RNNControllerFactory *factory = [[RNNControllerFactory alloc] initWithRootViewCreator:[RNNReactRootViewCreator new] store:[RNN instance].store];
31
-	UIViewController *newVc = [factory createLayout:layout];
31
+	UIViewController *newVc = [factory createLayoutAndSaveToStore:layout];
32
 	UIViewController *vc = [[RNN instance].store findContainerForId:containerId];
32
 	UIViewController *vc = [[RNN instance].store findContainerForId:containerId];
33
 	
33
 	
34
 	[[vc navigationController] pushViewController:newVc animated:true];
34
 	[[vc navigationController] pushViewController:newVc animated:true];
47
 {
47
 {
48
 	[self assertReady];
48
 	[self assertReady];
49
 	RNNControllerFactory *factory = [[RNNControllerFactory alloc] initWithRootViewCreator:[RNNReactRootViewCreator new] store:[RNN instance].store];
49
 	RNNControllerFactory *factory = [[RNNControllerFactory alloc] initWithRootViewCreator:[RNNReactRootViewCreator new] store:[RNN instance].store];
50
-	UIViewController *newVc = [factory createLayout:layout];
50
+	UIViewController *newVc = [factory createLayoutAndSaveToStore:layout];
51
 	
51
 	
52
 	[UIApplication.sharedApplication.delegate.window.rootViewController presentViewController:newVc animated:YES completion:^{
52
 	[UIApplication.sharedApplication.delegate.window.rootViewController presentViewController:newVc animated:YES completion:^{
53
 		
53
 		

+ 1
- 1
ios/RNNControllerFactory.h View File

11
 
11
 
12
 -(instancetype)initWithRootViewCreator:(id <RNNRootViewCreator>)creator store:(RNNStore*)store;
12
 -(instancetype)initWithRootViewCreator:(id <RNNRootViewCreator>)creator store:(RNNStore*)store;
13
 
13
 
14
--(UIViewController*)createLayout:(NSDictionary*)layout;
14
+-(UIViewController*)createLayoutAndSaveToStore:(NSDictionary*)layout;
15
 
15
 
16
 @end
16
 @end

+ 7
- 8
ios/RNNControllerFactory.m View File

16
 # pragma mark public
16
 # pragma mark public
17
 
17
 
18
 
18
 
19
--(instancetype)initWithRootViewCreator:(id <RNNRootViewCreator>)creator store:(RNNStore *)store {
19
+- (instancetype)initWithRootViewCreator:(id <RNNRootViewCreator>)creator store:(RNNStore *)store {
20
 	
20
 	
21
 	self = [super init];
21
 	self = [super init];
22
 	self.creator = creator;
22
 	self.creator = creator;
25
 	return self;
25
 	return self;
26
 }
26
 }
27
 
27
 
28
--(UIViewController *)createLayout:(NSDictionary *)layout
28
+- (UIViewController*)createLayoutAndSaveToStore:(NSDictionary*)layout
29
 {
29
 {
30
 	return [self fromTree:layout];
30
 	return [self fromTree:layout];
31
 }
31
 }
32
 
32
 
33
 # pragma mark private
33
 # pragma mark private
34
 
34
 
35
--(UIViewController*)fromTree:(NSDictionary*)json
35
+- (UIViewController*)fromTree:(NSDictionary*)json
36
 {
36
 {
37
 	RNNLayoutNode* node = [RNNLayoutNode create:json];
37
 	RNNLayoutNode* node = [RNNLayoutNode create:json];
38
 	
38
 	
74
 	return result;
74
 	return result;
75
 }
75
 }
76
 
76
 
77
--(RNNRootViewController*)createContainer:(RNNLayoutNode*)node
77
+- (RNNRootViewController*)createContainer:(RNNLayoutNode*)node
78
 {
78
 {
79
 	return [[RNNRootViewController alloc] initWithNode:node rootViewCreator:self.creator];
79
 	return [[RNNRootViewController alloc] initWithNode:node rootViewCreator:self.creator];
80
 }
80
 }
81
 
81
 
82
--(UINavigationController*)createContainerStack:(RNNLayoutNode*)node
82
+- (UINavigationController*)createContainerStack:(RNNLayoutNode*)node
83
 {
83
 {
84
 	UINavigationController* vc = [[UINavigationController alloc] init];
84
 	UINavigationController* vc = [[UINavigationController alloc] init];
85
 	
85
 	
109
 	return vc;
109
 	return vc;
110
 }
110
 }
111
 
111
 
112
--(UIViewController*)createSideMenu:(RNNLayoutNode*)node
112
+- (UIViewController*)createSideMenu:(RNNLayoutNode*)node
113
 {
113
 {
114
 	NSMutableArray* childrenVCs = [NSMutableArray new];
114
 	NSMutableArray* childrenVCs = [NSMutableArray new];
115
 	
115
 	
124
 }
124
 }
125
 
125
 
126
 
126
 
127
--(UIViewController*)createSideMenuChild:(RNNLayoutNode*)node type:(RNNSideMenuChildType)type {
127
+- (UIViewController*)createSideMenuChild:(RNNLayoutNode*)node type:(RNNSideMenuChildType)type {
128
 	UIViewController* child = [self fromTree:node.children[0]];
128
 	UIViewController* child = [self fromTree:node.children[0]];
129
 	RNNSideMenuChildVC *sideMenuChild = [[RNNSideMenuChildVC alloc] initWithChild: child type:type];
129
 	RNNSideMenuChildVC *sideMenuChild = [[RNNSideMenuChildVC alloc] initWithChild: child type:type];
130
 	
130
 	
133
 
133
 
134
 
134
 
135
 
135
 
136
-
137
 @end
136
 @end