Browse Source

launchArgs format

yogevbd 6 years ago
parent
commit
a0d9518117

+ 1
- 1
ios/RCCManager.h View File

13
 -(UIWindow*)getAppWindow;
13
 -(UIWindow*)getAppWindow;
14
 -(void)setAppStyle:(NSDictionary*)appStyle;
14
 -(void)setAppStyle:(NSDictionary*)appStyle;
15
 -(NSDictionary*)getAppStyle;
15
 -(NSDictionary*)getAppStyle;
16
--(NSDictionary*)getInitialProps;
16
+-(NSDictionary*)getLaunchArgs;
17
 
17
 
18
 -(void)registerController:(UIViewController*)controller componentId:(NSString*)componentId componentType:(NSString*)componentType;
18
 -(void)registerController:(UIViewController*)controller componentId:(NSString*)componentId componentType:(NSString*)componentType;
19
 -(id)getControllerWithId:(NSString*)componentId componentType:(NSString*)componentType;
19
 -(id)getControllerWithId:(NSString*)componentId componentType:(NSString*)componentType;

+ 10
- 2
ios/RCCManager.m View File

46
   return self;
46
   return self;
47
 }
47
 }
48
 
48
 
49
-- (NSArray *)getInitialProps {
50
-  return [[NSProcessInfo processInfo] arguments];
49
+- (NSDictionary *)getLaunchArgs {
50
+  NSMutableDictionary* mutableArguments = [[NSMutableDictionary alloc] init];
51
+  NSArray* arguments = [[NSProcessInfo processInfo] arguments];
52
+  for (int i = 0; i < [arguments count]; i+=2) {
53
+    NSString* key = [arguments objectAtIndex:i];
54
+    NSString* value = [arguments objectAtIndex:i+1];
55
+    [mutableArguments setObject:value forKey:key];
56
+  }
57
+  
58
+  return mutableArguments;
51
 }
59
 }
52
 
60
 
53
 -(void)clearModuleRegistry
61
 -(void)clearModuleRegistry

+ 2
- 2
ios/RCCManagerModule.m View File

480
     [RCCManagerModule cancelAllRCCViewControllerReactTouches];
480
     [RCCManagerModule cancelAllRCCViewControllerReactTouches];
481
 }
481
 }
482
 
482
 
483
-RCT_EXPORT_METHOD(getInitialProps:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
483
+RCT_EXPORT_METHOD(getLaunchArgs:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
484
 {
484
 {
485
-    resolve([[RCCManager sharedInstance] getInitialProps]);
485
+    resolve([[RCCManager sharedInstance] getLaunchArgs]);
486
 }
486
 }
487
 
487
 
488
 @end
488
 @end

+ 2
- 2
src/deprecated/controllers/index.js View File

129
       _processProperties(_.get(layout, 'props.appStyle', {}));
129
       _processProperties(_.get(layout, 'props.appStyle', {}));
130
       return await RCCManager.setRootController(layout, animationType, passProps);
130
       return await RCCManager.setRootController(layout, animationType, passProps);
131
     },
131
     },
132
-    getInitialProps: async function() {
133
-      return await RCCManager.getInitialProps();
132
+    getLaunchArgs: async function() {
133
+      return await RCCManager.getLaunchArgs();
134
     }
134
     }
135
   },
135
   },
136
 
136
 

+ 1
- 1
src/deprecated/platformSpecificDeprecated.ios.js View File

694
 }
694
 }
695
 
695
 
696
 async function getLaunchArgs() {
696
 async function getLaunchArgs() {
697
-  return await ControllerRegistry.getInitialProps();
697
+  return await ControllerRegistry.getLaunchArgs();
698
 }
698
 }
699
 
699
 
700
 export default {
700
 export default {