ソースを参照

Revert "Support passing mergeOptions to pop and dismissModal commands"

This reverts commit aabd9e4248.
Guy Carmeli 6 年 前
コミット
5c2c1ce8c3

+ 0
- 1
lib/android/app/src/main/java/com/reactnativenavigation/parse/Options.java ファイルの表示

@@ -10,7 +10,6 @@ import com.reactnativenavigation.utils.TypefaceLoader;
10 10
 import org.json.JSONObject;
11 11
 
12 12
 public class Options {
13
-    public static final Options EMPTY = new Options();
14 13
 
15 14
     @NonNull
16 15
     public static Options parse(TypefaceLoader typefaceManager, JSONObject json) {

+ 15
- 20
lib/android/app/src/main/java/com/reactnativenavigation/react/NavigationModule.java ファイルの表示

@@ -69,12 +69,14 @@ public class NavigationModule extends ReactContextBaseJavaModule {
69 69
 
70 70
 	@ReactMethod
71 71
 	public void setDefaultOptions(ReadableMap options) {
72
-        handle(() -> navigator().setDefaultOptions(parse(options)));
72
+        final Options defaultOptions = Options.parse(new TypefaceLoader(activity()), JSONParser.parse(options));
73
+        handle(() -> navigator().setDefaultOptions(defaultOptions));
73 74
     }
74 75
 
75 76
 	@ReactMethod
76 77
 	public void mergeOptions(String onComponentId, ReadableMap options) {
77
-		handle(() -> navigator().mergeOptions(onComponentId, parse(options)));
78
+		final Options navOptions = Options.parse(new TypefaceLoader(activity()), JSONParser.parse(options));
79
+		handle(() -> navigator().mergeOptions(onComponentId, navOptions));
78 80
 	}
79 81
 
80 82
 	@ReactMethod
@@ -96,18 +98,18 @@ public class NavigationModule extends ReactContextBaseJavaModule {
96 98
     }
97 99
 
98 100
 	@ReactMethod
99
-	public void pop(String commandId, String componentId, ReadableMap mergeOptions, Promise promise) {
100
-		handle(() -> navigator().pop(componentId, parse(mergeOptions), new NativeCommandListener(commandId, promise, eventEmitter, now)));
101
+	public void pop(String commandId, String componentId, ReadableMap options, Promise promise) {
102
+		handle(() -> navigator().pop(componentId, new NativeCommandListener(commandId, promise, eventEmitter, now)));
101 103
 	}
102 104
 
103 105
 	@ReactMethod
104
-	public void popTo(String commandId, String componentId, ReadableMap mergeOptions, Promise promise) {
105
-		handle(() -> navigator().popTo(componentId, parse(mergeOptions), new NativeCommandListener(commandId, promise, eventEmitter, now)));
106
+	public void popTo(String commandId, String componentId, Promise promise) {
107
+		handle(() -> navigator().popTo(componentId, new NativeCommandListener(commandId, promise, eventEmitter, now)));
106 108
 	}
107 109
 
108 110
 	@ReactMethod
109
-	public void popToRoot(String commandId, String componentId, ReadableMap mergeOptions, Promise promise) {
110
-		handle(() -> navigator().popToRoot(componentId, parse(mergeOptions), new NativeCommandListener(commandId, promise, eventEmitter, now)));
111
+	public void popToRoot(String commandId, String componentId, Promise promise) {
112
+		handle(() -> navigator().popToRoot(componentId, new NativeCommandListener(commandId, promise, eventEmitter, now)));
111 113
 	}
112 114
 
113 115
 	@ReactMethod
@@ -120,16 +122,13 @@ public class NavigationModule extends ReactContextBaseJavaModule {
120 122
 	}
121 123
 
122 124
 	@ReactMethod
123
-	public void dismissModal(String commandId, String componentId, ReadableMap mergeOptions, Promise promise) {
124
-		handle(() -> {
125
-            navigator().mergeOptions(componentId, parse(mergeOptions));
126
-            navigator().dismissModal(componentId, new NativeCommandListener(commandId, promise, eventEmitter, now));
127
-        });
125
+	public void dismissModal(String commandId, String componentId, Promise promise) {
126
+		handle(() -> navigator().dismissModal(componentId, new NativeCommandListener(commandId, promise, eventEmitter, now)));
128 127
 	}
129 128
 
130
-    @ReactMethod
131
-	public void dismissAllModals(String commandId, ReadableMap mergeOptions, Promise promise) {
132
-		handle(() -> navigator().dismissAllModals(parse(mergeOptions), new NativeCommandListener(commandId, promise, eventEmitter, now)));
129
+	@ReactMethod
130
+	public void dismissAllModals(String commandId, Promise promise) {
131
+		handle(() -> navigator().dismissAllModals(new NativeCommandListener(commandId, promise, eventEmitter, now)));
133 132
 	}
134 133
 
135 134
 	@ReactMethod
@@ -161,10 +160,6 @@ public class NavigationModule extends ReactContextBaseJavaModule {
161 160
         );
162 161
 	}
163 162
 
164
-    private Options parse(ReadableMap mergeOptions) {
165
-        return Options.parse(new TypefaceLoader(activity()), JSONParser.parse(mergeOptions));
166
-    }
167
-
168 163
 	private Map<String, ExternalComponentCreator> externalComponentCreator() {
169 164
         return ((NavigationApplication) activity().getApplication()).getExternalComponents();
170 165
     }

+ 8
- 13
lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/Navigator.java ファイルの表示

@@ -156,23 +156,18 @@ public class Navigator extends ParentController {
156 156
         applyOnStack(id, listener, stack -> stack.setRoot(viewController, listener));
157 157
     }
158 158
 
159
-    public void pop(String id, Options mergeOptions, CommandListener listener) {
160
-        applyOnStack(id, listener, stack -> {
161
-            stack.peek().mergeOptions(mergeOptions);
162
-            stack.pop(listener);
163
-        });
159
+    public void pop(String id, CommandListener listener) {
160
+        applyOnStack(id, listener, stack -> stack.pop(listener));
164 161
     }
165 162
 
166
-    public void popToRoot(final String id, Options mergeOptions, CommandListener listener) {
167
-        applyOnStack(id, listener, stack -> stack.popToRoot(mergeOptions, listener));
163
+    public void popToRoot(final String id, CommandListener listener) {
164
+        applyOnStack(id, listener, stack -> stack.popToRoot(listener));
168 165
     }
169 166
 
170
-    public void popTo(final String id, Options mergeOptions, CommandListener listener) {
167
+    public void popTo(final String id, CommandListener listener) {
171 168
         ViewController target = findControllerById(id);
172 169
         if (target != null) {
173
-            target.performOnParentStack(stack -> {
174
-                ((StackController) stack).popTo(target, mergeOptions, listener);
175
-            });
170
+            target.performOnParentStack(stack -> ((StackController) stack).popTo(target, listener));
176 171
         } else {
177 172
             listener.onError("Failed to execute stack command. Stack by " + id + " not found.");
178 173
         }
@@ -190,8 +185,8 @@ public class Navigator extends ParentController {
190 185
         modalStack.dismissModal(componentId, root, listener);
191 186
     }
192 187
 
193
-    public void dismissAllModals(Options mergeOptions, CommandListener listener) {
194
-        modalStack.dismissAllModals(root, mergeOptions, listener);
188
+    public void dismissAllModals(CommandListener listener) {
189
+        modalStack.dismissAllModals(listener, root);
195 190
     }
196 191
 
197 192
     public void showOverlay(ViewController overlay, CommandListener listener) {

+ 1
- 1
lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/ViewController.java ファイルの表示

@@ -149,7 +149,7 @@ public abstract class ViewController<T extends ViewGroup> implements ViewTreeObs
149 149
         return false;
150 150
     }
151 151
 
152
-    void performOnParentStack(Task<StackController> accept, Runnable reject) {
152
+    void performOnParentStack(Task accept, Runnable reject) {
153 153
         if (!performOnParentStack(accept)) {
154 154
             reject.run();
155 155
         }

+ 1
- 3
lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/modal/ModalStack.java ファイルの表示

@@ -78,7 +78,7 @@ public class ModalStack {
78 78
         }
79 79
     }
80 80
 
81
-    public void dismissAllModals(ViewController root, Options mergeOptions, CommandListener listener) {
81
+    public void dismissAllModals(CommandListener listener, ViewController root) {
82 82
         if (modals.isEmpty()) {
83 83
             listener.onError("Nothing to dismiss");
84 84
             return;
@@ -87,8 +87,6 @@ public class ModalStack {
87 87
         String topModalId = peek().getId();
88 88
         int modalsDismissed = size();
89 89
 
90
-        peek().mergeOptions(mergeOptions);
91
-
92 90
         while (!modals.isEmpty()) {
93 91
             if (modals.size() == 1) {
94 92
                 dismissModal(modals.get(0).getId(), root, new CommandListenerAdapter(listener) {

+ 3
- 6
lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/StackController.java ファイルの表示

@@ -221,14 +221,12 @@ public class StackController extends ParentController<StackLayout> {
221 221
         listener.onSuccess(disappearing.getId());
222 222
     }
223 223
 
224
-    public void popTo(ViewController viewController, Options mergeOptions, CommandListener listener) {
225
-        if (!stack.containsId(viewController.getId()) || peek().equals(viewController)) {
224
+    public void popTo(final ViewController viewController, CommandListener listener) {
225
+        if (!stack.containsId(viewController.getId())) {
226 226
             listener.onError("Nothing to pop");
227 227
             return;
228 228
         }
229 229
 
230
-        peek().mergeOptions(mergeOptions);
231
-
232 230
         Iterator<String> iterator = stack.iterator();
233 231
         String currentControlId = iterator.next();
234 232
         while (!viewController.getId().equals(currentControlId)) {
@@ -243,13 +241,12 @@ public class StackController extends ParentController<StackLayout> {
243 241
         pop(listener);
244 242
     }
245 243
 
246
-    public void popToRoot(Options mergeOptions, CommandListener listener) {
244
+    public void popToRoot(CommandListener listener) {
247 245
         if (!canPop()) {
248 246
             listener.onError("Nothing to pop");
249 247
             return;
250 248
         }
251 249
 
252
-        peek().mergeOptions(mergeOptions);
253 250
         Iterator<String> iterator = stack.iterator();
254 251
         while (stack.size() > 2) {
255 252
             ViewController controller = stack.get(iterator.next());

+ 12
- 12
lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/NavigatorTest.java ファイルの表示

@@ -188,9 +188,9 @@ public class NavigatorTest extends BaseTest {
188 188
 
189 189
     @Test
190 190
     public void pop_InvalidDoesNothing() {
191
-        uut.pop("123", Options.EMPTY, new CommandListenerAdapter());
191
+        uut.pop("123", new CommandListenerAdapter());
192 192
         uut.setRoot(child1, new CommandListenerAdapter());
193
-        uut.pop(child1.getId(), Options.EMPTY, new CommandListenerAdapter());
193
+        uut.pop(child1.getId(), new CommandListenerAdapter());
194 194
         assertThat(uut.getChildControllers()).hasSize(1);
195 195
     }
196 196
 
@@ -208,7 +208,7 @@ public class NavigatorTest extends BaseTest {
208 208
                 stack2.push(child4, new CommandListenerAdapter() {
209 209
                             @Override
210 210
                             public void onSuccess(String childId) {
211
-                                uut.pop("child4", Options.EMPTY, new CommandListenerAdapter());
211
+                                uut.pop("child4", new CommandListenerAdapter());
212 212
                                 assertThat(stack2.getChildControllers()).containsOnly(child2, child3);
213 213
                             }
214 214
                         }
@@ -226,7 +226,7 @@ public class NavigatorTest extends BaseTest {
226 226
         stack.push(child1, new CommandListenerAdapter());
227 227
         stack.push(child2, new CommandListenerAdapter());
228 228
 
229
-        uut.pop(stack.getId(), Options.EMPTY, new CommandListenerAdapter());
229
+        uut.pop(stack.getId(), new CommandListenerAdapter());
230 230
         assertThat(stack.getChildControllers()).containsOnly(child1);
231 231
     }
232 232
 
@@ -244,7 +244,7 @@ public class NavigatorTest extends BaseTest {
244 244
         stack2.push(child5, new CommandListenerAdapter() {
245 245
             @Override
246 246
             public void onSuccess(String childId) {
247
-                uut.popTo(child2.getId(), Options.EMPTY, new CommandListenerAdapter());
247
+                uut.popTo(child2.getId(), new CommandListenerAdapter());
248 248
                 assertThat(stack2.getChildControllers()).containsOnly(child2);
249 249
             }
250 250
         });
@@ -264,7 +264,7 @@ public class NavigatorTest extends BaseTest {
264 264
         stack2.push(child5, new CommandListenerAdapter() {
265 265
             @Override
266 266
             public void onSuccess(String childId) {
267
-                uut.popToRoot(child3.getId(), Options.EMPTY, new CommandListenerAdapter());
267
+                uut.popToRoot(child3.getId(), new CommandListenerAdapter());
268 268
                 assertThat(stack2.getChildControllers()).containsOnly(child2);
269 269
             }
270 270
         });
@@ -370,9 +370,9 @@ public class NavigatorTest extends BaseTest {
370 370
 
371 371
     @Test
372 372
     public void pop_InvalidDoesNothing_Promise() {
373
-        uut.pop("123", Options.EMPTY, new CommandListenerAdapter());
373
+        uut.pop("123", new CommandListenerAdapter());
374 374
         uut.setRoot(child1, new CommandListenerAdapter());
375
-        uut.pop(child1.getId(), Options.EMPTY, new CommandListenerAdapter() {
375
+        uut.pop(child1.getId(), new CommandListenerAdapter() {
376 376
             @Override
377 377
             public void onError(String reason) {
378 378
                 assertThat(uut.getChildControllers()).hasSize(1);
@@ -393,7 +393,7 @@ public class NavigatorTest extends BaseTest {
393 393
         stack2.push(child4, new CommandListenerAdapter() {
394 394
             @Override
395 395
             public void onSuccess(String childId) {
396
-                uut.pop("child4", Options.EMPTY, new CommandListenerAdapter());
396
+                uut.pop("child4", new CommandListenerAdapter());
397 397
                 assertThat(stack2.getChildControllers()).containsOnly(child2, child3);
398 398
             }
399 399
         });
@@ -431,7 +431,7 @@ public class NavigatorTest extends BaseTest {
431 431
                 assertThat(spy.getChildControllers().size()).isEqualTo(1);
432 432
             }
433 433
         };
434
-        uut.pop("child2", Options.EMPTY, listener);
434
+        uut.pop("child2", listener);
435 435
         verify(spy, times(1)).pop(listener);
436 436
     }
437 437
 
@@ -505,7 +505,7 @@ public class NavigatorTest extends BaseTest {
505 505
         disablePushAnimation(child2);
506 506
         disableShowModalAnimation(child1);
507 507
 
508
-        uut.dismissAllModals(Options.EMPTY, new CommandListenerAdapter());
508
+        uut.dismissAllModals(new CommandListenerAdapter());
509 509
         verify(parentVisibilityListener, times(0)).onViewAppeared(parentController.getView());
510 510
 
511 511
         uut.setRoot(parentController, new CommandListenerAdapter());
@@ -513,7 +513,7 @@ public class NavigatorTest extends BaseTest {
513 513
 
514 514
         verify(parentVisibilityListener, times(1)).onViewAppeared(parentController.getView());
515 515
         uut.showModal(child1, new CommandListenerAdapter());
516
-        uut.dismissAllModals(Options.EMPTY, new CommandListenerAdapter());
516
+        uut.dismissAllModals(new CommandListenerAdapter());
517 517
 
518 518
         verify(parentVisibilityListener, times(2)).onViewAppeared(parentController.getView());
519 519
     }

+ 5
- 18
lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/modal/ModalStackTest.java ファイルの表示

@@ -141,7 +141,7 @@ public class ModalStackTest extends BaseTest {
141 141
                 assertThat(uut.isEmpty()).isTrue();
142 142
             }
143 143
         });
144
-        uut.dismissAllModals(rootController, Options.EMPTY, listener);
144
+        uut.dismissAllModals(listener, rootController);
145 145
         verify(listener, times(1)).onSuccess(anyString());
146 146
         verifyZeroInteractions(listener);
147 147
     }
@@ -149,23 +149,10 @@ public class ModalStackTest extends BaseTest {
149 149
     @Test
150 150
     public void dismissAllModals_rejectIfEmpty() {
151 151
         CommandListener spy = spy(new CommandListenerAdapter());
152
-        uut.dismissAllModals(rootController, Options.EMPTY, spy);
152
+        uut.dismissAllModals(spy, rootController);
153 153
         verify(spy, times(1)).onError(any());
154 154
     }
155 155
 
156
-    @Test
157
-    public void dismissAllModals_optionsAreMergedOnTopModal() {
158
-        uut.showModal(modal1, rootController, new CommandListenerAdapter());
159
-        uut.showModal(modal2, rootController, new CommandListenerAdapter());
160
-        uut.showModal(modal3, rootController, new CommandListenerAdapter());
161
-
162
-        Options mergeOptions = new Options();
163
-        uut.dismissAllModals(rootController, mergeOptions, new CommandListenerAdapter());
164
-        verify(modal3).mergeOptions(mergeOptions);
165
-        verify(modal1, times(0)).mergeOptions(mergeOptions);
166
-        verify(modal2, times(0)).mergeOptions(mergeOptions);
167
-    }
168
-
169 156
     @SuppressWarnings("Convert2Lambda")
170 157
     @Test
171 158
     public void dismissAllModals_onlyTopModalIsAnimated() {
@@ -175,7 +162,7 @@ public class ModalStackTest extends BaseTest {
175 162
         ViewGroup view1 = modal1.getView();
176 163
         ViewGroup view2 = modal2.getView();
177 164
         CommandListener listener = spy(new CommandListenerAdapter());
178
-        uut.dismissAllModals(rootController, Options.EMPTY, listener);
165
+        uut.dismissAllModals(listener, rootController);
179 166
         verify(presenter, times(1)).dismissTopModal(eq(modal2), eq(rootController), any());
180 167
         verify(listener).onSuccess(modal2.getId());
181 168
         verify(animator, times(0)).dismiss(eq(view1), eq(modal1.options.animations.dismissModal), any());
@@ -188,7 +175,7 @@ public class ModalStackTest extends BaseTest {
188 175
         uut.showModal(modal1, rootController, new CommandListenerAdapter());
189 176
         uut.showModal(modal2, rootController, new CommandListenerAdapter());
190 177
 
191
-        uut.dismissAllModals(rootController, Options.EMPTY, new CommandListenerAdapter());
178
+        uut.dismissAllModals(new CommandListenerAdapter(), rootController);
192 179
 
193 180
         verify(modal1, times(1)).destroy();
194 181
         verify(modal1, times(1)).onViewDisappear();
@@ -200,7 +187,7 @@ public class ModalStackTest extends BaseTest {
200 187
         assertThat(uut.isEmpty()).isTrue();
201 188
         uut.showModal(modal1, rootController, new CommandListenerAdapter());
202 189
         assertThat(uut.isEmpty()).isFalse();
203
-        uut.dismissAllModals(rootController, Options.EMPTY, new CommandListenerAdapter());
190
+        uut.dismissAllModals(new CommandListenerAdapter(), rootController);
204 191
         assertThat(uut.isEmpty()).isTrue();
205 192
     }
206 193
 

+ 8
- 35
lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/stack/StackControllerTest.java ファイルの表示

@@ -453,7 +453,7 @@ public class StackControllerTest extends BaseTest {
453 453
                 assertThat(uut.size()).isEqualTo(3);
454 454
                 assertThat(uut.peek()).isEqualTo(child3);
455 455
 
456
-                uut.popTo(child1, Options.EMPTY, new CommandListenerAdapter());
456
+                uut.popTo(child1, new CommandListenerAdapter());
457 457
 
458 458
                 assertThat(uut.size()).isEqualTo(1);
459 459
                 assertThat(uut.peek()).isEqualTo(child1);
@@ -461,27 +461,12 @@ public class StackControllerTest extends BaseTest {
461 461
         });
462 462
     }
463 463
 
464
-    @Test
465
-    public void popTo_optionsAreMergedOnTopChild() {
466
-        disablePushAnimation(child1, child2);
467
-        uut.push(child1, new CommandListenerAdapter());
468
-
469
-        Options mergeOptions = new Options();
470
-        uut.popTo(child2, mergeOptions, new CommandListenerAdapter());
471
-        uut.popTo(child1, mergeOptions, new CommandListenerAdapter());
472
-        verify(child1, times(0)).mergeOptions(mergeOptions);
473
-
474
-        uut.push(child2, new CommandListenerAdapter());
475
-        uut.popTo(child1, mergeOptions, new CommandListenerAdapter());
476
-        verify(child2).mergeOptions(mergeOptions);
477
-    }
478
-
479 464
     @Test
480 465
     public void popTo_NotAChildOfThisStack_DoesNothing() {
481 466
         uut.push(child1, new CommandListenerAdapter());
482 467
         uut.push(child3, new CommandListenerAdapter());
483 468
         assertThat(uut.size()).isEqualTo(2);
484
-        uut.popTo(child2, Options.EMPTY, new CommandListenerAdapter());
469
+        uut.popTo(child2, new CommandListenerAdapter());
485 470
         assertThat(uut.size()).isEqualTo(2);
486 471
     }
487 472
 
@@ -493,7 +478,7 @@ public class StackControllerTest extends BaseTest {
493 478
         uut.push(child4, new CommandListenerAdapter() {
494 479
             @Override
495 480
             public void onSuccess(String childId) {
496
-                uut.popTo(child2, Options.EMPTY, new CommandListenerAdapter() {
481
+                uut.popTo(child2, new CommandListenerAdapter() {
497 482
                     @Override
498 483
                     public void onSuccess(String childId) {
499 484
                         verify(animator, times(0)).pop(eq(child1.getView()), any(), any());
@@ -518,7 +503,7 @@ public class StackControllerTest extends BaseTest {
518 503
                 assertThat(uut.size()).isEqualTo(3);
519 504
                 assertThat(uut.peek()).isEqualTo(child3);
520 505
 
521
-                uut.popToRoot(Options.EMPTY, new CommandListenerAdapter() {
506
+                uut.popToRoot(new CommandListenerAdapter() {
522 507
                     @Override
523 508
                     public void onSuccess(String childId) {
524 509
                         assertThat(uut.size()).isEqualTo(1);
@@ -539,7 +524,7 @@ public class StackControllerTest extends BaseTest {
539 524
         uut.push(child3, new CommandListenerAdapter() {
540 525
             @Override
541 526
             public void onSuccess(String childId) {
542
-                uut.popToRoot(Options.EMPTY, new CommandListenerAdapter() {
527
+                uut.popToRoot(new CommandListenerAdapter() {
543 528
                     @Override
544 529
                     public void onSuccess(String childId) {
545 530
                         verify(animator, times(1)).pop(eq(child3.getView()), eq(child3.options.animations.pop), any());
@@ -559,7 +544,7 @@ public class StackControllerTest extends BaseTest {
559 544
         uut.push(child2, new CommandListenerAdapter());
560 545
         uut.push(child3, new CommandListenerAdapter());
561 546
 
562
-        uut.popToRoot(Options.EMPTY, new CommandListenerAdapter() {
547
+        uut.popToRoot(new CommandListenerAdapter() {
563 548
             @Override
564 549
             public void onSuccess(String childId) {
565 550
                 verify(child1, times(0)).destroy();
@@ -573,23 +558,11 @@ public class StackControllerTest extends BaseTest {
573 558
     public void popToRoot_EmptyStackDoesNothing() {
574 559
         assertThat(uut.isEmpty()).isTrue();
575 560
         CommandListenerAdapter listener = spy(new CommandListenerAdapter());
576
-        uut.popToRoot(Options.EMPTY, listener);
561
+        uut.popToRoot(listener);
577 562
         assertThat(uut.isEmpty()).isTrue();
578 563
         verify(listener, times(1)).onError(any());
579 564
     }
580 565
 
581
-    @Test
582
-    public void popToRoot_optionsAreMergedOnTopChild() {
583
-        disablePushAnimation(child1, child2);
584
-        uut.push(child1, new CommandListenerAdapter());
585
-        uut.push(child2, new CommandListenerAdapter());
586
-
587
-        Options mergeOptions = new Options();
588
-        uut.popToRoot(mergeOptions, new CommandListenerAdapter());
589
-        verify(child2).mergeOptions(mergeOptions);
590
-        verify(child1, times(0)).mergeOptions(mergeOptions);
591
-    }
592
-
593 566
     @Test
594 567
     public void findControllerById_ReturnsSelfOrChildrenById() {
595 568
         assertThat(uut.findControllerById("123")).isNull();
@@ -700,7 +673,7 @@ public class StackControllerTest extends BaseTest {
700 673
                 verify(child2, times(0)).destroy();
701 674
                 verify(child3, times(0)).destroy();
702 675
 
703
-                uut.popTo(child1, Options.EMPTY, new CommandListenerAdapter() {
676
+                uut.popTo(child1, new CommandListenerAdapter() {
704 677
                     @Override
705 678
                     public void onSuccess(String childId) {
706 679
                         verify(child2, times(1)).destroy();

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

@@ -26,12 +26,12 @@ export class NativeCommandsSender {
26 26
     return this.nativeCommandsModule.pop(commandId, componentId, options);
27 27
   }
28 28
 
29
-  popTo(commandId: string, componentId: string, options: object) {
30
-    return this.nativeCommandsModule.popTo(commandId, componentId, options);
29
+  popTo(commandId: string, componentId: string) {
30
+    return this.nativeCommandsModule.popTo(commandId, componentId);
31 31
   }
32 32
 
33
-  popToRoot(commandId: string, componentId: string, options: object) {
34
-    return this.nativeCommandsModule.popToRoot(commandId, componentId, options);
33
+  popToRoot(commandId: string, componentId: string) {
34
+    return this.nativeCommandsModule.popToRoot(commandId, componentId);
35 35
   }
36 36
 
37 37
   setStackRoot(commandId: string, onComponentId: string, layout: object) {
@@ -42,12 +42,12 @@ export class NativeCommandsSender {
42 42
     return this.nativeCommandsModule.showModal(commandId, layout);
43 43
   }
44 44
 
45
-  dismissModal(commandId: string, componentId: string, options: object) {
46
-    return this.nativeCommandsModule.dismissModal(commandId, componentId, options);
45
+  dismissModal(commandId: string, componentId: string) {
46
+    return this.nativeCommandsModule.dismissModal(commandId, componentId);
47 47
   }
48 48
 
49
-  dismissAllModals(commandId: string, options: object) {
50
-    return this.nativeCommandsModule.dismissAllModals(commandId, options);
49
+  dismissAllModals(commandId: string) {
50
+    return this.nativeCommandsModule.dismissAllModals(commandId);
51 51
   }
52 52
 
53 53
   showOverlay(commandId: string, layout: object) {

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

@@ -62,16 +62,16 @@ export class Commands {
62 62
     return result;
63 63
   }
64 64
 
65
-  public dismissModal(componentId, mergeOptions) {
65
+  public dismissModal(componentId) {
66 66
     const commandId = this.uniqueIdProvider.generate('dismissModal');
67
-    const result = this.nativeCommandsSender.dismissModal(commandId, componentId, mergeOptions);
68
-    this.commandsObserver.notify('dismissModal', { commandId, componentId, mergeOptions});
67
+    const result = this.nativeCommandsSender.dismissModal(commandId, componentId);
68
+    this.commandsObserver.notify('dismissModal', { commandId, componentId });
69 69
     return result;
70 70
   }
71 71
 
72
-  public dismissAllModals(mergeOptions) {
72
+  public dismissAllModals() {
73 73
     const commandId = this.uniqueIdProvider.generate('dismissAllModals');
74
-    const result = this.nativeCommandsSender.dismissAllModals(commandId, mergeOptions);
74
+    const result = this.nativeCommandsSender.dismissAllModals(commandId);
75 75
     this.commandsObserver.notify('dismissAllModals', { commandId });
76 76
     return result;
77 77
   }
@@ -88,24 +88,24 @@ export class Commands {
88 88
     return result;
89 89
   }
90 90
 
91
-  public pop(componentId, mergeOptions) {
91
+  public pop(componentId, options) {
92 92
     const commandId = this.uniqueIdProvider.generate('pop');
93
-    const result = this.nativeCommandsSender.pop(commandId, componentId, mergeOptions);
94
-    this.commandsObserver.notify('pop', { commandId, componentId, mergeOptions });
93
+    const result = this.nativeCommandsSender.pop(commandId, componentId, options);
94
+    this.commandsObserver.notify('pop', { commandId, componentId, options });
95 95
     return result;
96 96
   }
97 97
 
98
-  public popTo(componentId, mergeOptions) {
98
+  public popTo(componentId) {
99 99
     const commandId = this.uniqueIdProvider.generate('popTo');
100
-    const result = this.nativeCommandsSender.popTo(commandId, componentId, mergeOptions);
101
-    this.commandsObserver.notify('popTo', { commandId, componentId, mergeOptions });
100
+    const result = this.nativeCommandsSender.popTo(commandId, componentId);
101
+    this.commandsObserver.notify('popTo', { commandId, componentId });
102 102
     return result;
103 103
   }
104 104
 
105
-  public popToRoot(componentId, mergeOptions) {
105
+  public popToRoot(componentId) {
106 106
     const commandId = this.uniqueIdProvider.generate('popToRoot');
107
-    const result = this.nativeCommandsSender.popToRoot(commandId, componentId, mergeOptions);
108
-    this.commandsObserver.notify('popToRoot', { commandId, componentId, mergeOptions });
107
+    const result = this.nativeCommandsSender.popToRoot(commandId, componentId);
108
+    this.commandsObserver.notify('popToRoot', { commandId, componentId });
109 109
     return result;
110 110
   }
111 111