yogevbd 6 年 前
コミット
d86a63cd29
共有5 個のファイルを変更した26 個の追加0 個の削除を含む
  1. 5
    0
      lib/ios/RNNBridgeModule.m
  2. 8
    0
      lib/src/Navigation.ts
  3. 4
    0
      lib/src/adapters/NativeCommandsSender.ts
  4. 2
    0
      lib/src/commands/Commands.test.ts
  5. 7
    0
      lib/src/commands/Commands.ts

+ 5
- 0
lib/ios/RNNBridgeModule.m ファイルの表示

96
 	}];
96
 	}];
97
 }
97
 }
98
 
98
 
99
+RCT_EXPORT_METHOD(getLaunchArgs:(NSString*)commandId :(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
100
+	NSArray* args = [[NSProcessInfo processInfo] arguments];
101
+	resolve(args);
102
+}
103
+
99
 @end
104
 @end
100
 
105
 

+ 8
- 0
lib/src/Navigation.ts ファイルの表示

144
     return this.commands.dismissOverlay(componentId);
144
     return this.commands.dismissOverlay(componentId);
145
   }
145
   }
146
 
146
 
147
+  /**
148
+   * 
149
+   * Resolves arguments passed on launch
150
+   */
151
+  public getLaunchArgs(): Promise<any> {
152
+    return this.commands.getLaunchArgs();
153
+  }
154
+
147
   /**
155
   /**
148
    * Obtain the events registry instance
156
    * Obtain the events registry instance
149
    */
157
    */

+ 4
- 0
lib/src/adapters/NativeCommandsSender.ts ファイルの表示

57
   dismissOverlay(commandId: string, componentId: string) {
57
   dismissOverlay(commandId: string, componentId: string) {
58
     return this.nativeCommandsModule.dismissOverlay(commandId, componentId);
58
     return this.nativeCommandsModule.dismissOverlay(commandId, componentId);
59
   }
59
   }
60
+
61
+  getLaunchArgs(commandId: string) {
62
+    return this.nativeCommandsModule.getLaunchArgs(commandId);
63
+  }
60
 }
64
 }

+ 2
- 0
lib/src/commands/Commands.test.ts ファイルの表示

437
         setStackRoot: ['id', {}],
437
         setStackRoot: ['id', {}],
438
         showOverlay: [{}],
438
         showOverlay: [{}],
439
         dismissOverlay: ['id'],
439
         dismissOverlay: ['id'],
440
+        getLaunchArgs: ['id']
440
       };
441
       };
441
       const paramsForMethodName = {
442
       const paramsForMethodName = {
442
         setRoot: { commandId: 'setRoot+UNIQUE_ID', layout: { root: 'parsed', modals: [], overlays: [] } },
443
         setRoot: { commandId: 'setRoot+UNIQUE_ID', layout: { root: 'parsed', modals: [], overlays: [] } },
452
         setStackRoot: { commandId: 'setStackRoot+UNIQUE_ID', componentId: 'id', layout: 'parsed' },
453
         setStackRoot: { commandId: 'setStackRoot+UNIQUE_ID', componentId: 'id', layout: 'parsed' },
453
         showOverlay: { commandId: 'showOverlay+UNIQUE_ID', layout: 'parsed' },
454
         showOverlay: { commandId: 'showOverlay+UNIQUE_ID', layout: 'parsed' },
454
         dismissOverlay: { commandId: 'dismissOverlay+UNIQUE_ID', componentId: 'id' },
455
         dismissOverlay: { commandId: 'dismissOverlay+UNIQUE_ID', componentId: 'id' },
456
+        getLaunchArgs: { commandId: 'getLaunchArgs+UNIQUE_ID' },
455
       };
457
       };
456
       _.forEach(getAllMethodsOfUut(), (m) => {
458
       _.forEach(getAllMethodsOfUut(), (m) => {
457
         it(`for ${m}`, () => {
459
         it(`for ${m}`, () => {

+ 7
- 0
lib/src/commands/Commands.ts ファイルの表示

139
     this.commandsObserver.notify('dismissOverlay', { commandId, componentId });
139
     this.commandsObserver.notify('dismissOverlay', { commandId, componentId });
140
     return result;
140
     return result;
141
   }
141
   }
142
+
143
+  public getLaunchArgs() {
144
+    const commandId = this.uniqueIdProvider.generate('getLaunchArgs');
145
+    const result = this.nativeCommandsSender.getLaunchArgs(commandId);
146
+    this.commandsObserver.notify('getLaunchArgs', { commandId });
147
+    return result;
148
+  }
142
 }
149
 }