Browse Source

ios - rename createLayout to createLayoutAndSaveToStore

Ran Greenberg 7 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,7 +18,7 @@ RCT_EXPORT_METHOD(setRoot:(NSDictionary*)layout)
18 18
 {
19 19
 	[self assertReady];
20 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 23
 	UIApplication.sharedApplication.delegate.window.rootViewController = vc;
24 24
 	[UIApplication.sharedApplication.delegate.window makeKeyAndVisible];
@@ -28,7 +28,7 @@ RCT_EXPORT_METHOD(push:(NSString*)containerId layout:(NSDictionary*)layout)
28 28
 {
29 29
 	[self assertReady];
30 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 32
 	UIViewController *vc = [[RNN instance].store findContainerForId:containerId];
33 33
 	
34 34
 	[[vc navigationController] pushViewController:newVc animated:true];
@@ -47,7 +47,7 @@ RCT_EXPORT_METHOD(showModal:(NSDictionary*)layout)
47 47
 {
48 48
 	[self assertReady];
49 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 52
 	[UIApplication.sharedApplication.delegate.window.rootViewController presentViewController:newVc animated:YES completion:^{
53 53
 		

+ 1
- 1
ios/RNNControllerFactory.h View File

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

+ 7
- 8
ios/RNNControllerFactory.m View File

@@ -16,7 +16,7 @@
16 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 21
 	self = [super init];
22 22
 	self.creator = creator;
@@ -25,14 +25,14 @@
25 25
 	return self;
26 26
 }
27 27
 
28
--(UIViewController *)createLayout:(NSDictionary *)layout
28
+- (UIViewController*)createLayoutAndSaveToStore:(NSDictionary*)layout
29 29
 {
30 30
 	return [self fromTree:layout];
31 31
 }
32 32
 
33 33
 # pragma mark private
34 34
 
35
--(UIViewController*)fromTree:(NSDictionary*)json
35
+- (UIViewController*)fromTree:(NSDictionary*)json
36 36
 {
37 37
 	RNNLayoutNode* node = [RNNLayoutNode create:json];
38 38
 	
@@ -74,12 +74,12 @@
74 74
 	return result;
75 75
 }
76 76
 
77
--(RNNRootViewController*)createContainer:(RNNLayoutNode*)node
77
+- (RNNRootViewController*)createContainer:(RNNLayoutNode*)node
78 78
 {
79 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 84
 	UINavigationController* vc = [[UINavigationController alloc] init];
85 85
 	
@@ -109,7 +109,7 @@
109 109
 	return vc;
110 110
 }
111 111
 
112
--(UIViewController*)createSideMenu:(RNNLayoutNode*)node
112
+- (UIViewController*)createSideMenu:(RNNLayoutNode*)node
113 113
 {
114 114
 	NSMutableArray* childrenVCs = [NSMutableArray new];
115 115
 	
@@ -124,7 +124,7 @@
124 124
 }
125 125
 
126 126
 
127
--(UIViewController*)createSideMenuChild:(RNNLayoutNode*)node type:(RNNSideMenuChildType)type {
127
+- (UIViewController*)createSideMenuChild:(RNNLayoutNode*)node type:(RNNSideMenuChildType)type {
128 128
 	UIViewController* child = [self fromTree:node.children[0]];
129 129
 	RNNSideMenuChildVC *sideMenuChild = [[RNNSideMenuChildVC alloc] initWithChild: child type:type];
130 130
 	
@@ -133,5 +133,4 @@
133 133
 
134 134
 
135 135
 
136
-
137 136
 @end