Browse Source

Revert "Support passing mergeOptions to pop and dismissModal commands"

This reverts commit aabd9e4248.
Guy Carmeli 6 years ago
parent
commit
5c2c1ce8c3

+ 0
- 1
lib/android/app/src/main/java/com/reactnativenavigation/parse/Options.java View File

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

+ 15
- 20
lib/android/app/src/main/java/com/reactnativenavigation/react/NavigationModule.java View File

69
 
69
 
70
 	@ReactMethod
70
 	@ReactMethod
71
 	public void setDefaultOptions(ReadableMap options) {
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
 	@ReactMethod
76
 	@ReactMethod
76
 	public void mergeOptions(String onComponentId, ReadableMap options) {
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
 	@ReactMethod
82
 	@ReactMethod
96
     }
98
     }
97
 
99
 
98
 	@ReactMethod
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
 	@ReactMethod
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
 	@ReactMethod
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
 	@ReactMethod
115
 	@ReactMethod
120
 	}
122
 	}
121
 
123
 
122
 	@ReactMethod
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
 	@ReactMethod
134
 	@ReactMethod
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
 	private Map<String, ExternalComponentCreator> externalComponentCreator() {
163
 	private Map<String, ExternalComponentCreator> externalComponentCreator() {
169
         return ((NavigationApplication) activity().getApplication()).getExternalComponents();
164
         return ((NavigationApplication) activity().getApplication()).getExternalComponents();
170
     }
165
     }

+ 8
- 13
lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/Navigator.java View File

156
         applyOnStack(id, listener, stack -> stack.setRoot(viewController, listener));
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
         ViewController target = findControllerById(id);
168
         ViewController target = findControllerById(id);
172
         if (target != null) {
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
         } else {
171
         } else {
177
             listener.onError("Failed to execute stack command. Stack by " + id + " not found.");
172
             listener.onError("Failed to execute stack command. Stack by " + id + " not found.");
178
         }
173
         }
190
         modalStack.dismissModal(componentId, root, listener);
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
     public void showOverlay(ViewController overlay, CommandListener listener) {
192
     public void showOverlay(ViewController overlay, CommandListener listener) {

+ 1
- 1
lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/ViewController.java View File

149
         return false;
149
         return false;
150
     }
150
     }
151
 
151
 
152
-    void performOnParentStack(Task<StackController> accept, Runnable reject) {
152
+    void performOnParentStack(Task accept, Runnable reject) {
153
         if (!performOnParentStack(accept)) {
153
         if (!performOnParentStack(accept)) {
154
             reject.run();
154
             reject.run();
155
         }
155
         }

+ 1
- 3
lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/modal/ModalStack.java View File

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
         if (modals.isEmpty()) {
82
         if (modals.isEmpty()) {
83
             listener.onError("Nothing to dismiss");
83
             listener.onError("Nothing to dismiss");
84
             return;
84
             return;
87
         String topModalId = peek().getId();
87
         String topModalId = peek().getId();
88
         int modalsDismissed = size();
88
         int modalsDismissed = size();
89
 
89
 
90
-        peek().mergeOptions(mergeOptions);
91
-
92
         while (!modals.isEmpty()) {
90
         while (!modals.isEmpty()) {
93
             if (modals.size() == 1) {
91
             if (modals.size() == 1) {
94
                 dismissModal(modals.get(0).getId(), root, new CommandListenerAdapter(listener) {
92
                 dismissModal(modals.get(0).getId(), root, new CommandListenerAdapter(listener) {

+ 3
- 6
lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/StackController.java View File

221
         listener.onSuccess(disappearing.getId());
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
             listener.onError("Nothing to pop");
226
             listener.onError("Nothing to pop");
227
             return;
227
             return;
228
         }
228
         }
229
 
229
 
230
-        peek().mergeOptions(mergeOptions);
231
-
232
         Iterator<String> iterator = stack.iterator();
230
         Iterator<String> iterator = stack.iterator();
233
         String currentControlId = iterator.next();
231
         String currentControlId = iterator.next();
234
         while (!viewController.getId().equals(currentControlId)) {
232
         while (!viewController.getId().equals(currentControlId)) {
243
         pop(listener);
241
         pop(listener);
244
     }
242
     }
245
 
243
 
246
-    public void popToRoot(Options mergeOptions, CommandListener listener) {
244
+    public void popToRoot(CommandListener listener) {
247
         if (!canPop()) {
245
         if (!canPop()) {
248
             listener.onError("Nothing to pop");
246
             listener.onError("Nothing to pop");
249
             return;
247
             return;
250
         }
248
         }
251
 
249
 
252
-        peek().mergeOptions(mergeOptions);
253
         Iterator<String> iterator = stack.iterator();
250
         Iterator<String> iterator = stack.iterator();
254
         while (stack.size() > 2) {
251
         while (stack.size() > 2) {
255
             ViewController controller = stack.get(iterator.next());
252
             ViewController controller = stack.get(iterator.next());

+ 12
- 12
lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/NavigatorTest.java View File

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

+ 5
- 18
lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/modal/ModalStackTest.java View File

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

+ 8
- 35
lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/stack/StackControllerTest.java View File

453
                 assertThat(uut.size()).isEqualTo(3);
453
                 assertThat(uut.size()).isEqualTo(3);
454
                 assertThat(uut.peek()).isEqualTo(child3);
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
                 assertThat(uut.size()).isEqualTo(1);
458
                 assertThat(uut.size()).isEqualTo(1);
459
                 assertThat(uut.peek()).isEqualTo(child1);
459
                 assertThat(uut.peek()).isEqualTo(child1);
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
     @Test
464
     @Test
480
     public void popTo_NotAChildOfThisStack_DoesNothing() {
465
     public void popTo_NotAChildOfThisStack_DoesNothing() {
481
         uut.push(child1, new CommandListenerAdapter());
466
         uut.push(child1, new CommandListenerAdapter());
482
         uut.push(child3, new CommandListenerAdapter());
467
         uut.push(child3, new CommandListenerAdapter());
483
         assertThat(uut.size()).isEqualTo(2);
468
         assertThat(uut.size()).isEqualTo(2);
484
-        uut.popTo(child2, Options.EMPTY, new CommandListenerAdapter());
469
+        uut.popTo(child2, new CommandListenerAdapter());
485
         assertThat(uut.size()).isEqualTo(2);
470
         assertThat(uut.size()).isEqualTo(2);
486
     }
471
     }
487
 
472
 
493
         uut.push(child4, new CommandListenerAdapter() {
478
         uut.push(child4, new CommandListenerAdapter() {
494
             @Override
479
             @Override
495
             public void onSuccess(String childId) {
480
             public void onSuccess(String childId) {
496
-                uut.popTo(child2, Options.EMPTY, new CommandListenerAdapter() {
481
+                uut.popTo(child2, new CommandListenerAdapter() {
497
                     @Override
482
                     @Override
498
                     public void onSuccess(String childId) {
483
                     public void onSuccess(String childId) {
499
                         verify(animator, times(0)).pop(eq(child1.getView()), any(), any());
484
                         verify(animator, times(0)).pop(eq(child1.getView()), any(), any());
518
                 assertThat(uut.size()).isEqualTo(3);
503
                 assertThat(uut.size()).isEqualTo(3);
519
                 assertThat(uut.peek()).isEqualTo(child3);
504
                 assertThat(uut.peek()).isEqualTo(child3);
520
 
505
 
521
-                uut.popToRoot(Options.EMPTY, new CommandListenerAdapter() {
506
+                uut.popToRoot(new CommandListenerAdapter() {
522
                     @Override
507
                     @Override
523
                     public void onSuccess(String childId) {
508
                     public void onSuccess(String childId) {
524
                         assertThat(uut.size()).isEqualTo(1);
509
                         assertThat(uut.size()).isEqualTo(1);
539
         uut.push(child3, new CommandListenerAdapter() {
524
         uut.push(child3, new CommandListenerAdapter() {
540
             @Override
525
             @Override
541
             public void onSuccess(String childId) {
526
             public void onSuccess(String childId) {
542
-                uut.popToRoot(Options.EMPTY, new CommandListenerAdapter() {
527
+                uut.popToRoot(new CommandListenerAdapter() {
543
                     @Override
528
                     @Override
544
                     public void onSuccess(String childId) {
529
                     public void onSuccess(String childId) {
545
                         verify(animator, times(1)).pop(eq(child3.getView()), eq(child3.options.animations.pop), any());
530
                         verify(animator, times(1)).pop(eq(child3.getView()), eq(child3.options.animations.pop), any());
559
         uut.push(child2, new CommandListenerAdapter());
544
         uut.push(child2, new CommandListenerAdapter());
560
         uut.push(child3, new CommandListenerAdapter());
545
         uut.push(child3, new CommandListenerAdapter());
561
 
546
 
562
-        uut.popToRoot(Options.EMPTY, new CommandListenerAdapter() {
547
+        uut.popToRoot(new CommandListenerAdapter() {
563
             @Override
548
             @Override
564
             public void onSuccess(String childId) {
549
             public void onSuccess(String childId) {
565
                 verify(child1, times(0)).destroy();
550
                 verify(child1, times(0)).destroy();
573
     public void popToRoot_EmptyStackDoesNothing() {
558
     public void popToRoot_EmptyStackDoesNothing() {
574
         assertThat(uut.isEmpty()).isTrue();
559
         assertThat(uut.isEmpty()).isTrue();
575
         CommandListenerAdapter listener = spy(new CommandListenerAdapter());
560
         CommandListenerAdapter listener = spy(new CommandListenerAdapter());
576
-        uut.popToRoot(Options.EMPTY, listener);
561
+        uut.popToRoot(listener);
577
         assertThat(uut.isEmpty()).isTrue();
562
         assertThat(uut.isEmpty()).isTrue();
578
         verify(listener, times(1)).onError(any());
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
     @Test
566
     @Test
594
     public void findControllerById_ReturnsSelfOrChildrenById() {
567
     public void findControllerById_ReturnsSelfOrChildrenById() {
595
         assertThat(uut.findControllerById("123")).isNull();
568
         assertThat(uut.findControllerById("123")).isNull();
700
                 verify(child2, times(0)).destroy();
673
                 verify(child2, times(0)).destroy();
701
                 verify(child3, times(0)).destroy();
674
                 verify(child3, times(0)).destroy();
702
 
675
 
703
-                uut.popTo(child1, Options.EMPTY, new CommandListenerAdapter() {
676
+                uut.popTo(child1, new CommandListenerAdapter() {
704
                     @Override
677
                     @Override
705
                     public void onSuccess(String childId) {
678
                     public void onSuccess(String childId) {
706
                         verify(child2, times(1)).destroy();
679
                         verify(child2, times(1)).destroy();

+ 8
- 8
lib/src/adapters/NativeCommandsSender.ts View File

26
     return this.nativeCommandsModule.pop(commandId, componentId, options);
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
   setStackRoot(commandId: string, onComponentId: string, layout: object) {
37
   setStackRoot(commandId: string, onComponentId: string, layout: object) {
42
     return this.nativeCommandsModule.showModal(commandId, layout);
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
   showOverlay(commandId: string, layout: object) {
53
   showOverlay(commandId: string, layout: object) {

+ 14
- 14
lib/src/commands/Commands.ts View File

62
     return result;
62
     return result;
63
   }
63
   }
64
 
64
 
65
-  public dismissModal(componentId, mergeOptions) {
65
+  public dismissModal(componentId) {
66
     const commandId = this.uniqueIdProvider.generate('dismissModal');
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
     return result;
69
     return result;
70
   }
70
   }
71
 
71
 
72
-  public dismissAllModals(mergeOptions) {
72
+  public dismissAllModals() {
73
     const commandId = this.uniqueIdProvider.generate('dismissAllModals');
73
     const commandId = this.uniqueIdProvider.generate('dismissAllModals');
74
-    const result = this.nativeCommandsSender.dismissAllModals(commandId, mergeOptions);
74
+    const result = this.nativeCommandsSender.dismissAllModals(commandId);
75
     this.commandsObserver.notify('dismissAllModals', { commandId });
75
     this.commandsObserver.notify('dismissAllModals', { commandId });
76
     return result;
76
     return result;
77
   }
77
   }
88
     return result;
88
     return result;
89
   }
89
   }
90
 
90
 
91
-  public pop(componentId, mergeOptions) {
91
+  public pop(componentId, options) {
92
     const commandId = this.uniqueIdProvider.generate('pop');
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
     return result;
95
     return result;
96
   }
96
   }
97
 
97
 
98
-  public popTo(componentId, mergeOptions) {
98
+  public popTo(componentId) {
99
     const commandId = this.uniqueIdProvider.generate('popTo');
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
     return result;
102
     return result;
103
   }
103
   }
104
 
104
 
105
-  public popToRoot(componentId, mergeOptions) {
105
+  public popToRoot(componentId) {
106
     const commandId = this.uniqueIdProvider.generate('popToRoot');
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
     return result;
109
     return result;
110
   }
110
   }
111
 
111