-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Expand file tree
/
Copy pathRNNSideMenuSideOptions.m
More file actions
48 lines (41 loc) · 1.58 KB
/
RNNSideMenuSideOptions.m
File metadata and controls
48 lines (41 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#import "RNNSideMenuSideOptions.h"
@implementation RNNSideMenuSideOptions
- (instancetype)initWithDict:(NSDictionary *)dict {
self = [super initWithDict:dict];
self.visible = [BoolParser parse:dict key:@"visible"];
self.enabled = [BoolParser parse:dict key:@"enabled"];
self.width = [DoubleParser parse:dict key:@"width"];
self.shouldStretchDrawer = [BoolParser parse:dict key:@"shouldStretchDrawer"];
self.animationVelocity = [DoubleParser parse:dict key:@"animationVelocity"];
self.openMode = [TextParser parse:dict key:@"openMode"];
return self;
}
- (void)mergeOptions:(RNNSideMenuSideOptions *)options {
if (options.visible.hasValue)
self.visible = options.visible;
if (options.enabled.hasValue)
self.enabled = options.enabled;
if (options.width.hasValue)
self.width = options.width;
if (options.shouldStretchDrawer.hasValue)
self.shouldStretchDrawer = options.shouldStretchDrawer;
if (options.animationVelocity.hasValue)
self.animationVelocity = options.animationVelocity;
if (options.openMode.hasValue)
self.openMode = options.openMode;
}
/**
Converts a string open mode to the equivalent MMDrawerOpenMode enum value
*/
MMDrawerOpenMode MMDrawerOpenModeFromString(NSString *openModeString) {
if (!openModeString) {
return MMDrawerOpenModePushContent; // Default
}
if ([openModeString isEqualToString:@"aboveContent"]) {
return MMDrawerOpenModeAboveContent;
} else {
// Default or explicit "pushContent"
return MMDrawerOpenModePushContent;
}
}
@end