Browse Source

iOS - refactoring side menu

Ran Greenberg 7 years ago
parent
commit
c35e42d2bb

+ 1
- 3
ios/RNNControllerFactory.h View File

4
 #import "RNNRootViewCreator.h"
4
 #import "RNNRootViewCreator.h"
5
 #import "RNNRootViewController.h"
5
 #import "RNNRootViewController.h"
6
 #import "RNNSideMenuController.h"
6
 #import "RNNSideMenuController.h"
7
-#import "RNNSideMenuCenterVC.h"
8
-#import "RNNSideMenuLeftVC.h"
9
-#import "RNNSideMenuRightVC.h"
7
+#import "RNNSideMenuChildVC.h"
10
 
8
 
11
 @interface RNNControllerFactory : NSObject
9
 @interface RNNControllerFactory : NSObject
12
 
10
 

+ 7
- 4
ios/RNNControllerFactory.m View File

141
 	return sideMenu;
141
 	return sideMenu;
142
 }
142
 }
143
 
143
 
144
+
144
 -(UIViewController*)createSideMenuCenter:(RNNLayoutNode*)node {
145
 -(UIViewController*)createSideMenuCenter:(RNNLayoutNode*)node {
145
 	UIViewController* child = [self fromTree:node.children[0]];
146
 	UIViewController* child = [self fromTree:node.children[0]];
146
-	RNNSideMenuCenterVC *center = [[RNNSideMenuCenterVC alloc] initWithChild: child];
147
+	RNNSideMenuChildVC *center = [[RNNSideMenuChildVC alloc] initWithChild: child type:RNNSideMenuChildTypeCenter];
148
+	
147
 	return center;
149
 	return center;
148
 }
150
 }
149
 
151
 
152
+
150
 -(UIViewController*)createSideMenuLeft:(RNNLayoutNode*)node {
153
 -(UIViewController*)createSideMenuLeft:(RNNLayoutNode*)node {
151
 	UIViewController* child = [self fromTree:node.children[0]];
154
 	UIViewController* child = [self fromTree:node.children[0]];
152
-	RNNSideMenuLeftVC *left = [[RNNSideMenuLeftVC alloc] initWithChild:child];
155
+	RNNSideMenuChildVC *left = [[RNNSideMenuChildVC alloc] initWithChild: child type:RNNSideMenuChildTypeLeft];
153
 	
156
 	
154
 	return left;
157
 	return left;
155
 }
158
 }
156
 
159
 
160
+
157
 -(UIViewController*)createSideMenuRight:(RNNLayoutNode*)node {
161
 -(UIViewController*)createSideMenuRight:(RNNLayoutNode*)node {
158
 	UIViewController* child = [self fromTree:node.children[0]];
162
 	UIViewController* child = [self fromTree:node.children[0]];
159
-	RNNSideMenuRightVC *right = [[RNNSideMenuRightVC alloc] initWithChild:child];
163
+	RNNSideMenuChildVC *right = [[RNNSideMenuChildVC alloc] initWithChild: child type:RNNSideMenuChildTypeRight];
160
 	
164
 	
161
 	return right;
165
 	return right;
162
-
163
 }
166
 }
164
 
167
 
165
 
168
 

+ 0
- 17
ios/RNNSideMenuCenterVC.h View File

1
-//
2
-//  RNNSideMenuCenterVC.h
3
-//  ReactNativeNavigation
4
-//
5
-//  Created by Ran Greenberg on 09/02/2017.
6
-//  Copyright © 2017 Wix. All rights reserved.
7
-//
8
-
9
-#import <UIKit/UIKit.h>
10
-
11
-@interface RNNSideMenuCenterVC : UIViewController
12
-
13
-@property (readonly) UIViewController* child;
14
-
15
--(instancetype)initWithChild:(UIViewController*)child;
16
-
17
-@end

+ 0
- 24
ios/RNNSideMenuCenterVC.m View File

1
-//
2
-//  RNNSideMenuCenterVC.m
3
-//  ReactNativeNavigation
4
-//
5
-//  Created by Ran Greenberg on 09/02/2017.
6
-//  Copyright © 2017 Wix. All rights reserved.
7
-//
8
-
9
-#import "RNNSideMenuCenterVC.h"
10
-
11
-@interface RNNSideMenuCenterVC ()
12
-@property (readwrite) UIViewController* child;
13
-@end
14
-
15
-@implementation RNNSideMenuCenterVC
16
-
17
--(instancetype)initWithChild:(UIViewController *)child
18
-{
19
-	self = [super init];
20
-	self.child = child;
21
-	return self;
22
-}
23
-
24
-@end

+ 25
- 0
ios/RNNSideMenuChildVC.h View File

1
+//
2
+//  RNNSideMenuChildVC.h
3
+//  ReactNativeNavigation
4
+//
5
+//  Created by Ran Greenberg on 09/02/2017.
6
+//  Copyright © 2017 Wix. All rights reserved.
7
+//
8
+
9
+#import <UIKit/UIKit.h>
10
+
11
+typedef NS_ENUM(NSInteger, RNNSideMenuChildType) {
12
+	RNNSideMenuChildTypeCenter,
13
+	RNNSideMenuChildTypeLeft,
14
+	RNNSideMenuChildTypeRight,
15
+};
16
+
17
+
18
+@interface RNNSideMenuChildVC : UIViewController
19
+
20
+@property (readonly) RNNSideMenuChildType type;
21
+@property (readonly) UIViewController *child;
22
+
23
+-(instancetype) initWithChild:(UIViewController*)child type:(RNNSideMenuChildType)type;
24
+
25
+@end

+ 29
- 0
ios/RNNSideMenuChildVC.m View File

1
+//
2
+//  RNNSideMenuChildVC.m
3
+//  ReactNativeNavigation
4
+//
5
+//  Created by Ran Greenberg on 09/02/2017.
6
+//  Copyright © 2017 Wix. All rights reserved.
7
+//
8
+
9
+#import "RNNSideMenuChildVC.h"
10
+
11
+@interface RNNSideMenuChildVC ()
12
+
13
+@property (readwrite) RNNSideMenuChildType type;
14
+@property (readwrite) UIViewController *child;
15
+
16
+@end
17
+
18
+@implementation RNNSideMenuChildVC
19
+
20
+-(instancetype) initWithChild:(UIViewController*)child type:(RNNSideMenuChildType)type {
21
+	self = [super init];
22
+	
23
+	self.child = child;
24
+	self.type = type;
25
+	
26
+	return self;
27
+}
28
+
29
+@end

+ 4
- 6
ios/RNNSideMenuController.h View File

7
 //
7
 //
8
 
8
 
9
 #import <UIKit/UIKit.h>
9
 #import <UIKit/UIKit.h>
10
-#import "RNNSideMenuCenterVC.h"
11
-#import "RNNSideMenuLeftVC.h"
12
-#import "RNNSideMenuRightVC.h"
10
+#import "RNNSideMenuChildVC.h"
13
 
11
 
14
 @interface RNNSideMenuController : UIViewController
12
 @interface RNNSideMenuController : UIViewController
15
 
13
 
16
-@property (readonly) RNNSideMenuCenterVC *center;
17
-@property (readonly) RNNSideMenuLeftVC *left;
18
-@property (readonly) RNNSideMenuRightVC *right;
14
+@property (readonly) RNNSideMenuChildVC *center;
15
+@property (readonly) RNNSideMenuChildVC *left;
16
+@property (readonly) RNNSideMenuChildVC *right;
19
 
17
 
20
 -(instancetype)initWithControllers:(NSArray*)controllers;
18
 -(instancetype)initWithControllers:(NSArray*)controllers;
21
 
19
 

+ 17
- 12
ios/RNNSideMenuController.m View File

7
 //
7
 //
8
 
8
 
9
 #import "RNNSideMenuController.h"
9
 #import "RNNSideMenuController.h"
10
-#import "RNNSideMenuCenterVC.h"
10
+#import "RNNSideMenuChildVC.h"
11
 
11
 
12
 @interface RNNSideMenuController ()
12
 @interface RNNSideMenuController ()
13
 
13
 
14
-@property (readwrite) RNNSideMenuCenterVC *center;
15
-@property (readwrite) RNNSideMenuLeftVC *left;
16
-@property (readwrite) RNNSideMenuRightVC *right;
14
+@property (readwrite) RNNSideMenuChildVC *center;
15
+@property (readwrite) RNNSideMenuChildVC *left;
16
+@property (readwrite) RNNSideMenuChildVC *right;
17
 
17
 
18
 @end
18
 @end
19
 
19
 
31
 -(void)setControllers:(NSArray*)controllers {
31
 -(void)setControllers:(NSArray*)controllers {
32
 	for (id controller in controllers) {
32
 	for (id controller in controllers) {
33
 		
33
 		
34
-		if ([controller isKindOfClass:[RNNSideMenuCenterVC class]]) {
35
-			self.center = controller;
36
-		}
37
-		else if ([controller isKindOfClass:[RNNSideMenuLeftVC class]]){
38
-			self.left = controller;
39
-		}
40
-		else if ([controller isKindOfClass:[RNNSideMenuRightVC class]]) {
41
-			self.right = controller;
34
+		if ([controller isKindOfClass:[RNNSideMenuChildVC class]]) {
35
+			RNNSideMenuChildVC *child = (RNNSideMenuChildVC*)controller;
36
+			
37
+			if (child.type == RNNSideMenuChildTypeCenter) {
38
+				self.center = child;
39
+			}
40
+			else if(child.type == RNNSideMenuChildTypeLeft) {
41
+				self.left = child;
42
+			}
43
+			else if(child.type == RNNSideMenuChildTypeRight) {
44
+				self.right = child;
45
+			}
42
 		}
46
 		}
47
+
43
 		else {
48
 		else {
44
 			@throw [NSException exceptionWithName:@"UnknownSideMenuControllerType" reason:[@"Unknown side menu type " stringByAppendingString:[controller description]] userInfo:nil];
49
 			@throw [NSException exceptionWithName:@"UnknownSideMenuControllerType" reason:[@"Unknown side menu type " stringByAppendingString:[controller description]] userInfo:nil];
45
 		}
50
 		}

+ 0
- 17
ios/RNNSideMenuLeftVC.h View File

1
-//
2
-//  RNNSideMenuLeftVC.h
3
-//  ReactNativeNavigation
4
-//
5
-//  Created by Ran Greenberg on 09/02/2017.
6
-//  Copyright © 2017 Wix. All rights reserved.
7
-//
8
-
9
-#import <UIKit/UIKit.h>
10
-
11
-@interface RNNSideMenuLeftVC : UIViewController
12
-
13
-@property (readonly) UIViewController* child;
14
-
15
--(instancetype)initWithChild:(UIViewController*)child;
16
-
17
-@end

+ 0
- 28
ios/RNNSideMenuLeftVC.m View File

1
-//
2
-//  RNNSideMenuLeftVC.m
3
-//  ReactNativeNavigation
4
-//
5
-//  Created by Ran Greenberg on 09/02/2017.
6
-//  Copyright © 2017 Wix. All rights reserved.
7
-//
8
-
9
-#import "RNNSideMenuLeftVC.h"
10
-
11
-@interface RNNSideMenuLeftVC ()
12
-
13
-@property (readwrite) UIViewController *child;
14
-
15
-@end
16
-
17
-@implementation RNNSideMenuLeftVC
18
-
19
-
20
--(instancetype)initWithChild:(UIViewController*)child {
21
-	self = [super init];
22
-	self.child = child;
23
-	
24
-	return self;
25
-}
26
-
27
-
28
-@end

+ 0
- 17
ios/RNNSideMenuRightVC.h View File

1
-//
2
-//  RNNSideMenuRightVC.h
3
-//  ReactNativeNavigation
4
-//
5
-//  Created by Ran Greenberg on 09/02/2017.
6
-//  Copyright © 2017 Wix. All rights reserved.
7
-//
8
-
9
-#import <UIKit/UIKit.h>
10
-
11
-@interface RNNSideMenuRightVC : UIViewController
12
-
13
-@property (readonly) UIViewController *child;
14
-
15
--(instancetype)initWithChild:(UIViewController*)child;
16
-
17
-@end

+ 0
- 26
ios/RNNSideMenuRightVC.m View File

1
-//
2
-//  RNNSideMenuRightVC.m
3
-//  ReactNativeNavigation
4
-//
5
-//  Created by Ran Greenberg on 09/02/2017.
6
-//  Copyright © 2017 Wix. All rights reserved.
7
-//
8
-
9
-#import "RNNSideMenuRightVC.h"
10
-
11
-@interface RNNSideMenuRightVC ()
12
-
13
-@property (readwrite) UIViewController *child;
14
-
15
-@end
16
-
17
-@implementation RNNSideMenuRightVC
18
-
19
-
20
--(instancetype)initWithChild:(UIViewController*)child {
21
-	self = [super init];
22
-	self.child = child;
23
-	return self;
24
-}
25
-
26
-@end

+ 8
- 24
ios/ReactNativeNavigation.xcodeproj/project.pbxproj View File

43
 		263905CF1E4C6F440023D7D3 /* TheSidebarController.m in Sources */ = {isa = PBXBuildFile; fileRef = 263905AD1E4C6F440023D7D3 /* TheSidebarController.m */; };
43
 		263905CF1E4C6F440023D7D3 /* TheSidebarController.m in Sources */ = {isa = PBXBuildFile; fileRef = 263905AD1E4C6F440023D7D3 /* TheSidebarController.m */; };
44
 		263905D61E4C94970023D7D3 /* RNNSideMenuController.h in Headers */ = {isa = PBXBuildFile; fileRef = 263905D41E4C94970023D7D3 /* RNNSideMenuController.h */; };
44
 		263905D61E4C94970023D7D3 /* RNNSideMenuController.h in Headers */ = {isa = PBXBuildFile; fileRef = 263905D41E4C94970023D7D3 /* RNNSideMenuController.h */; };
45
 		263905D71E4C94970023D7D3 /* RNNSideMenuController.m in Sources */ = {isa = PBXBuildFile; fileRef = 263905D51E4C94970023D7D3 /* RNNSideMenuController.m */; };
45
 		263905D71E4C94970023D7D3 /* RNNSideMenuController.m in Sources */ = {isa = PBXBuildFile; fileRef = 263905D51E4C94970023D7D3 /* RNNSideMenuController.m */; };
46
-		263905DA1E4C99C70023D7D3 /* RNNSideMenuCenterVC.h in Headers */ = {isa = PBXBuildFile; fileRef = 263905D81E4C99C70023D7D3 /* RNNSideMenuCenterVC.h */; };
47
-		263905DB1E4C99C70023D7D3 /* RNNSideMenuCenterVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 263905D91E4C99C70023D7D3 /* RNNSideMenuCenterVC.m */; };
48
-		263905DE1E4CA5B70023D7D3 /* RNNSideMenuLeftVC.h in Headers */ = {isa = PBXBuildFile; fileRef = 263905DC1E4CA5B70023D7D3 /* RNNSideMenuLeftVC.h */; };
49
-		263905DF1E4CA5B70023D7D3 /* RNNSideMenuLeftVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 263905DD1E4CA5B70023D7D3 /* RNNSideMenuLeftVC.m */; };
50
-		263905E21E4CA8C70023D7D3 /* RNNSideMenuRightVC.h in Headers */ = {isa = PBXBuildFile; fileRef = 263905E01E4CA8C70023D7D3 /* RNNSideMenuRightVC.h */; };
51
-		263905E31E4CA8C70023D7D3 /* RNNSideMenuRightVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 263905E11E4CA8C70023D7D3 /* RNNSideMenuRightVC.m */; };
46
+		263905E61E4CAC950023D7D3 /* RNNSideMenuChildVC.h in Headers */ = {isa = PBXBuildFile; fileRef = 263905E41E4CAC950023D7D3 /* RNNSideMenuChildVC.h */; };
47
+		263905E71E4CAC950023D7D3 /* RNNSideMenuChildVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 263905E51E4CAC950023D7D3 /* RNNSideMenuChildVC.m */; };
52
 		26916C981E4B9E7700D13680 /* RNNReactRootViewCreator.h in Headers */ = {isa = PBXBuildFile; fileRef = 26916C961E4B9E7700D13680 /* RNNReactRootViewCreator.h */; };
48
 		26916C981E4B9E7700D13680 /* RNNReactRootViewCreator.h in Headers */ = {isa = PBXBuildFile; fileRef = 26916C961E4B9E7700D13680 /* RNNReactRootViewCreator.h */; };
53
 		26916C991E4B9E7700D13680 /* RNNReactRootViewCreator.m in Sources */ = {isa = PBXBuildFile; fileRef = 26916C971E4B9E7700D13680 /* RNNReactRootViewCreator.m */; };
49
 		26916C991E4B9E7700D13680 /* RNNReactRootViewCreator.m in Sources */ = {isa = PBXBuildFile; fileRef = 26916C971E4B9E7700D13680 /* RNNReactRootViewCreator.m */; };
54
 		7B1126A01E2D263F00F9B03B /* RNNEventEmitter.m in Sources */ = {isa = PBXBuildFile; fileRef = 7B11269F1E2D263F00F9B03B /* RNNEventEmitter.m */; };
50
 		7B1126A01E2D263F00F9B03B /* RNNEventEmitter.m in Sources */ = {isa = PBXBuildFile; fileRef = 7B11269F1E2D263F00F9B03B /* RNNEventEmitter.m */; };
118
 		263905AD1E4C6F440023D7D3 /* TheSidebarController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TheSidebarController.m; sourceTree = "<group>"; };
114
 		263905AD1E4C6F440023D7D3 /* TheSidebarController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TheSidebarController.m; sourceTree = "<group>"; };
119
 		263905D41E4C94970023D7D3 /* RNNSideMenuController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNNSideMenuController.h; sourceTree = "<group>"; };
115
 		263905D41E4C94970023D7D3 /* RNNSideMenuController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNNSideMenuController.h; sourceTree = "<group>"; };
120
 		263905D51E4C94970023D7D3 /* RNNSideMenuController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNNSideMenuController.m; sourceTree = "<group>"; };
116
 		263905D51E4C94970023D7D3 /* RNNSideMenuController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNNSideMenuController.m; sourceTree = "<group>"; };
121
-		263905D81E4C99C70023D7D3 /* RNNSideMenuCenterVC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNNSideMenuCenterVC.h; sourceTree = "<group>"; };
122
-		263905D91E4C99C70023D7D3 /* RNNSideMenuCenterVC.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNNSideMenuCenterVC.m; sourceTree = "<group>"; };
123
-		263905DC1E4CA5B70023D7D3 /* RNNSideMenuLeftVC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNNSideMenuLeftVC.h; sourceTree = "<group>"; };
124
-		263905DD1E4CA5B70023D7D3 /* RNNSideMenuLeftVC.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNNSideMenuLeftVC.m; sourceTree = "<group>"; };
125
-		263905E01E4CA8C70023D7D3 /* RNNSideMenuRightVC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNNSideMenuRightVC.h; sourceTree = "<group>"; };
126
-		263905E11E4CA8C70023D7D3 /* RNNSideMenuRightVC.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNNSideMenuRightVC.m; sourceTree = "<group>"; };
117
+		263905E41E4CAC950023D7D3 /* RNNSideMenuChildVC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNNSideMenuChildVC.h; sourceTree = "<group>"; };
118
+		263905E51E4CAC950023D7D3 /* RNNSideMenuChildVC.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNNSideMenuChildVC.m; sourceTree = "<group>"; };
127
 		26916C941E4B9CCC00D13680 /* RNNRootViewCreator.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNNRootViewCreator.h; sourceTree = "<group>"; };
119
 		26916C941E4B9CCC00D13680 /* RNNRootViewCreator.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNNRootViewCreator.h; sourceTree = "<group>"; };
128
 		26916C961E4B9E7700D13680 /* RNNReactRootViewCreator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNNReactRootViewCreator.h; sourceTree = "<group>"; };
120
 		26916C961E4B9E7700D13680 /* RNNReactRootViewCreator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNNReactRootViewCreator.h; sourceTree = "<group>"; };
129
 		26916C971E4B9E7700D13680 /* RNNReactRootViewCreator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNNReactRootViewCreator.m; sourceTree = "<group>"; };
121
 		26916C971E4B9E7700D13680 /* RNNReactRootViewCreator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNNReactRootViewCreator.m; sourceTree = "<group>"; };
238
 				7BEF0D171E437684003E96B0 /* RNNRootViewController.m */,
230
 				7BEF0D171E437684003E96B0 /* RNNRootViewController.m */,
239
 				263905D41E4C94970023D7D3 /* RNNSideMenuController.h */,
231
 				263905D41E4C94970023D7D3 /* RNNSideMenuController.h */,
240
 				263905D51E4C94970023D7D3 /* RNNSideMenuController.m */,
232
 				263905D51E4C94970023D7D3 /* RNNSideMenuController.m */,
241
-				263905D81E4C99C70023D7D3 /* RNNSideMenuCenterVC.h */,
242
-				263905D91E4C99C70023D7D3 /* RNNSideMenuCenterVC.m */,
243
-				263905E01E4CA8C70023D7D3 /* RNNSideMenuRightVC.h */,
244
-				263905E11E4CA8C70023D7D3 /* RNNSideMenuRightVC.m */,
245
-				263905DC1E4CA5B70023D7D3 /* RNNSideMenuLeftVC.h */,
246
-				263905DD1E4CA5B70023D7D3 /* RNNSideMenuLeftVC.m */,
233
+				263905E41E4CAC950023D7D3 /* RNNSideMenuChildVC.h */,
234
+				263905E51E4CAC950023D7D3 /* RNNSideMenuChildVC.m */,
247
 			);
235
 			);
248
 			name = Controllers;
236
 			name = Controllers;
249
 			sourceTree = "<group>";
237
 			sourceTree = "<group>";
294
 				26916C981E4B9E7700D13680 /* RNNReactRootViewCreator.h in Headers */,
282
 				26916C981E4B9E7700D13680 /* RNNReactRootViewCreator.h in Headers */,
295
 				263905B01E4C6F440023D7D3 /* MMDrawerController+Subclass.h in Headers */,
283
 				263905B01E4C6F440023D7D3 /* MMDrawerController+Subclass.h in Headers */,
296
 				7B1126A41E2D2B6C00F9B03B /* ReactNativeNavigation.h in Headers */,
284
 				7B1126A41E2D2B6C00F9B03B /* ReactNativeNavigation.h in Headers */,
297
-				263905DE1E4CA5B70023D7D3 /* RNNSideMenuLeftVC.h in Headers */,
298
 				263905B71E4C6F440023D7D3 /* UIViewController+MMDrawerController.h in Headers */,
285
 				263905B71E4C6F440023D7D3 /* UIViewController+MMDrawerController.h in Headers */,
299
 				263905BB1E4C6F440023D7D3 /* RCCDrawerHelper.h in Headers */,
286
 				263905BB1E4C6F440023D7D3 /* RCCDrawerHelper.h in Headers */,
300
 				263905CC1E4C6F440023D7D3 /* SidebarWunderlistAnimation.h in Headers */,
287
 				263905CC1E4C6F440023D7D3 /* SidebarWunderlistAnimation.h in Headers */,
306
 				7B1126A31E2D2B6C00F9B03B /* RNNSplashScreen.h in Headers */,
293
 				7B1126A31E2D2B6C00F9B03B /* RNNSplashScreen.h in Headers */,
307
 				7B1126A51E2D2B6C00F9B03B /* RNN.h in Headers */,
294
 				7B1126A51E2D2B6C00F9B03B /* RNN.h in Headers */,
308
 				263905C01E4C6F440023D7D3 /* SidebarAirbnbAnimation.h in Headers */,
295
 				263905C01E4C6F440023D7D3 /* SidebarAirbnbAnimation.h in Headers */,
296
+				263905E61E4CAC950023D7D3 /* RNNSideMenuChildVC.h in Headers */,
309
 				263905C41E4C6F440023D7D3 /* SidebarFacebookAnimation.h in Headers */,
297
 				263905C41E4C6F440023D7D3 /* SidebarFacebookAnimation.h in Headers */,
310
 				7BEF0D181E437684003E96B0 /* RNNRootViewController.h in Headers */,
298
 				7BEF0D181E437684003E96B0 /* RNNRootViewController.h in Headers */,
311
 				7B1126A61E2D2B6C00F9B03B /* RNNBridgeModule.h in Headers */,
299
 				7B1126A61E2D2B6C00F9B03B /* RNNBridgeModule.h in Headers */,
312
-				263905DA1E4C99C70023D7D3 /* RNNSideMenuCenterVC.h in Headers */,
313
 				263905BE1E4C6F440023D7D3 /* RCCTheSideBarManagerViewController.h in Headers */,
300
 				263905BE1E4C6F440023D7D3 /* RCCTheSideBarManagerViewController.h in Headers */,
314
 				263905CE1E4C6F440023D7D3 /* TheSidebarController.h in Headers */,
301
 				263905CE1E4C6F440023D7D3 /* TheSidebarController.h in Headers */,
315
 				7B1126A71E2D2B6C00F9B03B /* RNNEventEmitter.h in Headers */,
302
 				7B1126A71E2D2B6C00F9B03B /* RNNEventEmitter.h in Headers */,
316
 				263905CA1E4C6F440023D7D3 /* SidebarLuvocracyAnimation.h in Headers */,
303
 				263905CA1E4C6F440023D7D3 /* SidebarLuvocracyAnimation.h in Headers */,
317
 				263905B11E4C6F440023D7D3 /* MMDrawerController.h in Headers */,
304
 				263905B11E4C6F440023D7D3 /* MMDrawerController.h in Headers */,
318
 				263905B91E4C6F440023D7D3 /* RCCDrawerController.h in Headers */,
305
 				263905B91E4C6F440023D7D3 /* RCCDrawerController.h in Headers */,
319
-				263905E21E4CA8C70023D7D3 /* RNNSideMenuRightVC.h in Headers */,
320
 				263905B31E4C6F440023D7D3 /* MMDrawerVisualState.h in Headers */,
306
 				263905B31E4C6F440023D7D3 /* MMDrawerVisualState.h in Headers */,
321
 				7B1126A91E2D2B6C00F9B03B /* RNNControllerFactory.h in Headers */,
307
 				7B1126A91E2D2B6C00F9B03B /* RNNControllerFactory.h in Headers */,
322
 				263905D61E4C94970023D7D3 /* RNNSideMenuController.h in Headers */,
308
 				263905D61E4C94970023D7D3 /* RNNSideMenuController.h in Headers */,
390
 				263905BF1E4C6F440023D7D3 /* RCCTheSideBarManagerViewController.m in Sources */,
376
 				263905BF1E4C6F440023D7D3 /* RCCTheSideBarManagerViewController.m in Sources */,
391
 				7B1126A01E2D263F00F9B03B /* RNNEventEmitter.m in Sources */,
377
 				7B1126A01E2D263F00F9B03B /* RNNEventEmitter.m in Sources */,
392
 				263905CB1E4C6F440023D7D3 /* SidebarLuvocracyAnimation.m in Sources */,
378
 				263905CB1E4C6F440023D7D3 /* SidebarLuvocracyAnimation.m in Sources */,
379
+				263905E71E4CAC950023D7D3 /* RNNSideMenuChildVC.m in Sources */,
393
 				7BA500751E2544B9001B9E1B /* ReactNativeNavigation.m in Sources */,
380
 				7BA500751E2544B9001B9E1B /* ReactNativeNavigation.m in Sources */,
394
 				263905B21E4C6F440023D7D3 /* MMDrawerController.m in Sources */,
381
 				263905B21E4C6F440023D7D3 /* MMDrawerController.m in Sources */,
395
 				7BBFE5441E25330E002A6182 /* RNNBridgeModule.m in Sources */,
382
 				7BBFE5441E25330E002A6182 /* RNNBridgeModule.m in Sources */,
396
 				7BEF0D1D1E43771B003E96B0 /* RNNLayoutNode.m in Sources */,
383
 				7BEF0D1D1E43771B003E96B0 /* RNNLayoutNode.m in Sources */,
397
 				7BA500781E254908001B9E1B /* RNNSplashScreen.m in Sources */,
384
 				7BA500781E254908001B9E1B /* RNNSplashScreen.m in Sources */,
398
 				263905BA1E4C6F440023D7D3 /* RCCDrawerController.m in Sources */,
385
 				263905BA1E4C6F440023D7D3 /* RCCDrawerController.m in Sources */,
399
-				263905E31E4CA8C70023D7D3 /* RNNSideMenuRightVC.m in Sources */,
400
 				263905BC1E4C6F440023D7D3 /* RCCDrawerHelper.m in Sources */,
386
 				263905BC1E4C6F440023D7D3 /* RCCDrawerHelper.m in Sources */,
401
 				263905C11E4C6F440023D7D3 /* SidebarAirbnbAnimation.m in Sources */,
387
 				263905C11E4C6F440023D7D3 /* SidebarAirbnbAnimation.m in Sources */,
402
 				263905D71E4C94970023D7D3 /* RNNSideMenuController.m in Sources */,
388
 				263905D71E4C94970023D7D3 /* RNNSideMenuController.m in Sources */,
403
 				26916C991E4B9E7700D13680 /* RNNReactRootViewCreator.m in Sources */,
389
 				26916C991E4B9E7700D13680 /* RNNReactRootViewCreator.m in Sources */,
404
 				263905B81E4C6F440023D7D3 /* UIViewController+MMDrawerController.m in Sources */,
390
 				263905B81E4C6F440023D7D3 /* UIViewController+MMDrawerController.m in Sources */,
405
-				263905DB1E4C99C70023D7D3 /* RNNSideMenuCenterVC.m in Sources */,
406
 				263905CD1E4C6F440023D7D3 /* SidebarWunderlistAnimation.m in Sources */,
391
 				263905CD1E4C6F440023D7D3 /* SidebarWunderlistAnimation.m in Sources */,
407
 				263905CF1E4C6F440023D7D3 /* TheSidebarController.m in Sources */,
392
 				263905CF1E4C6F440023D7D3 /* TheSidebarController.m in Sources */,
408
 				263905AF1E4C6F440023D7D3 /* MMDrawerBarButtonItem.m in Sources */,
393
 				263905AF1E4C6F440023D7D3 /* MMDrawerBarButtonItem.m in Sources */,
409
 				7BBFE5611E253F97002A6182 /* RNN.m in Sources */,
394
 				7BBFE5611E253F97002A6182 /* RNN.m in Sources */,
410
 				7BC9346E1E26886E00EFA125 /* RNNControllerFactory.m in Sources */,
395
 				7BC9346E1E26886E00EFA125 /* RNNControllerFactory.m in Sources */,
411
 				263905B61E4C6F440023D7D3 /* MMExampleDrawerVisualStateManager.m in Sources */,
396
 				263905B61E4C6F440023D7D3 /* MMExampleDrawerVisualStateManager.m in Sources */,
412
-				263905DF1E4CA5B70023D7D3 /* RNNSideMenuLeftVC.m in Sources */,
413
 				263905C91E4C6F440023D7D3 /* SidebarFlipboardAnimation.m in Sources */,
397
 				263905C91E4C6F440023D7D3 /* SidebarFlipboardAnimation.m in Sources */,
414
 			);
398
 			);
415
 			runOnlyForDeploymentPostprocessing = 0;
399
 			runOnlyForDeploymentPostprocessing = 0;

+ 8
- 55
playground/ios/playgroundTests/RNNControllerFactoryTest.m View File

98
 	
98
 	
99
 }
99
 }
100
 
100
 
101
-- (void)testCreateLayout_ContainerSideMenuLayoutCenterOnly {
102
-	RNNSideMenuController *ans = (RNNSideMenuController*) [self.factory createLayout:@{@"id": @"cntId",
103
-																					   @"type": @"SideMenuRoot",
104
-																					   @"data": @{},
105
-																					   @"children": @[@{@"id": @"cntI_2",
106
-																										@"type": @"SideMenuCenter",
107
-																										@"data": @{},
108
-																										@"children": @[
109
-																												@{@"id": @"cntId_3",
110
-																												  @"type": @"Container",
111
-																												  @"data": @{},
112
-																												  @"children": @[]}]}]}];
113
-	XCTAssertTrue([ans isMemberOfClass:[RNNSideMenuController class]]);
114
-	XCTAssertTrue([ans isKindOfClass:[UIViewController class]]);
115
-	XCTAssertTrue([ans.center isMemberOfClass:[RNNSideMenuCenterVC class]]);
116
-	XCTAssertTrue([ans.center.child isMemberOfClass:[RNNRootViewController class]]);
117
-}
118
-
119
-
120
-- (void)testCreateLayout_ContainerSideMenuLayoutCenterAndLeft {
121
-	RNNSideMenuController *ans = (RNNSideMenuController*) [self.factory createLayout:@{@"id": @"cntId",
122
-																					   @"type": @"SideMenuRoot",
123
-																					   @"data": @{},
124
-																					   @"children": @[
125
-																							   @{@"id": @"cntI_2",
126
-																								 @"type": @"SideMenuCenter",
127
-																								 @"data": @{},
128
-																								 @"children": @[
129
-																										 @{@"id": @"cntId_3",
130
-																										   @"type": @"Container",
131
-																										   @"data": @{},
132
-																										   @"children": @[]}]},
133
-																							   @{@"id": @"cntI_4",
134
-																								 @"type": @"SideMenuLeft",
135
-																								 @"data": @{},
136
-																								 @"children": @[
137
-																										 @{@"id": @"cntId_5",
138
-																										   @"type": @"Container",
139
-																										   @"data": @{},
140
-																										   @"children": @[]}]}]}];
141
-	XCTAssertTrue([ans isMemberOfClass:[RNNSideMenuController class]]);
142
-	XCTAssertTrue([ans isKindOfClass:[UIViewController class]]);
143
-	XCTAssertTrue([ans.center isMemberOfClass:[RNNSideMenuCenterVC class]]);
144
-	XCTAssertTrue([ans.center.child isMemberOfClass:[RNNRootViewController class]]);
145
-	XCTAssertTrue([ans.left isMemberOfClass:[RNNSideMenuLeftVC class]]);
146
-	
147
-	RNNSideMenuLeftVC *left = (RNNSideMenuLeftVC*)ans.left;
148
-	XCTAssertTrue([left.child isMemberOfClass:[RNNRootViewController class]]);
149
-}
150
 
101
 
151
 - (void)testCreateLayout_ContainerSideMenuLayoutCenterLeftRight {
102
 - (void)testCreateLayout_ContainerSideMenuLayoutCenterLeftRight {
152
 	RNNSideMenuController *ans = (RNNSideMenuController*) [self.factory createLayout:@{@"id": @"cntId",
103
 	RNNSideMenuController *ans = (RNNSideMenuController*) [self.factory createLayout:@{@"id": @"cntId",
179
 																										   @"children": @[]}]}]}];
130
 																										   @"children": @[]}]}]}];
180
 	XCTAssertTrue([ans isMemberOfClass:[RNNSideMenuController class]]);
131
 	XCTAssertTrue([ans isMemberOfClass:[RNNSideMenuController class]]);
181
 	XCTAssertTrue([ans isKindOfClass:[UIViewController class]]);
132
 	XCTAssertTrue([ans isKindOfClass:[UIViewController class]]);
182
-	XCTAssertTrue([ans.center isMemberOfClass:[RNNSideMenuCenterVC class]]);
183
-	XCTAssertTrue([ans.center.child isMemberOfClass:[RNNRootViewController class]]);
184
-	XCTAssertTrue([ans.left isMemberOfClass:[RNNSideMenuLeftVC class]]);
133
+	XCTAssertTrue([ans.center isMemberOfClass:[RNNSideMenuChildVC class]]);
134
+	RNNSideMenuChildVC *center = (RNNSideMenuChildVC*)ans.center;
135
+	XCTAssertTrue(center.type == RNNSideMenuChildTypeCenter);
136
+	XCTAssertTrue([center.child isMemberOfClass:[RNNRootViewController class]]);
185
 	
137
 	
186
-	RNNSideMenuLeftVC *left = (RNNSideMenuLeftVC*)ans.left;
138
+	RNNSideMenuChildVC *left = (RNNSideMenuChildVC*)ans.left;
139
+	XCTAssertTrue(left.type == RNNSideMenuChildTypeLeft);
187
 	XCTAssertTrue([left.child isMemberOfClass:[RNNRootViewController class]]);
140
 	XCTAssertTrue([left.child isMemberOfClass:[RNNRootViewController class]]);
188
 	
141
 	
189
-	XCTAssertTrue([ans.right isMemberOfClass:[RNNSideMenuRightVC class]]);
190
-	RNNSideMenuRightVC *right = (RNNSideMenuRightVC*)ans.right;
142
+	RNNSideMenuChildVC *right = (RNNSideMenuChildVC*)ans.right;
143
+	XCTAssertTrue(right.type == RNNSideMenuChildTypeRight);
191
 	XCTAssertTrue([right.child isMemberOfClass:[RNNRootViewController class]]);
144
 	XCTAssertTrue([right.child isMemberOfClass:[RNNRootViewController class]]);
192
 }
145
 }
193
 
146