Ver código fonte

Remove push overload

Guy Carmeli 6 anos atrás
pai
commit
67755362e5

+ 2
- 1
lib/android/app/src/main/java/com/reactnativenavigation/parse/LayoutFactory.java Ver arquivo

@@ -3,6 +3,7 @@ package com.reactnativenavigation.parse;
3 3
 import android.app.Activity;
4 4
 
5 5
 import com.facebook.react.ReactInstanceManager;
6
+import com.reactnativenavigation.utils.CommandListenerAdapter;
6 7
 import com.reactnativenavigation.utils.ImageLoader;
7 8
 import com.reactnativenavigation.utils.TypefaceLoader;
8 9
 import com.reactnativenavigation.viewcontrollers.ComponentViewController;
@@ -136,7 +137,7 @@ public class LayoutFactory {
136 137
 
137 138
     private void addChildrenToStack(List<LayoutNode> children, StackController stackController) {
138 139
         for (LayoutNode child : children) {
139
-            stackController.push(create(child));
140
+            stackController.push(create(child), new CommandListenerAdapter());
140 141
         }
141 142
     }
142 143
 

+ 0
- 4
lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/StackController.java Ver arquivo

@@ -89,10 +89,6 @@ public class StackController extends ParentController<StackLayout> {
89 89
         topBarController.clear();
90 90
     }
91 91
 
92
-    public void push(ViewController child) {
93
-        push(child, new CommandListenerAdapter());
94
-    }
95
-
96 92
     public void push(ViewController child, CommandListener listener) {
97 93
         final ViewController toRemove = stack.peek();
98 94
         child.setParentController(this);

+ 1
- 1
lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/BottomTabsControllerTest.java Ver arquivo

@@ -137,7 +137,7 @@ public class BottomTabsControllerTest extends BaseTest {
137 137
 
138 138
         StackController stack = spy(createStack("stack"));
139 139
         stack.ensureViewIsCreated();
140
-        stack.push(uut);
140
+        stack.push(uut, new CommandListenerAdapter());
141 141
 
142 142
         child1.onViewAppeared();
143 143
         ArgumentCaptor<Options> optionsCaptor = ArgumentCaptor.forClass(Options.class);

+ 8
- 8
lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/FloatingActionButtonTest.java Ver arquivo

@@ -83,25 +83,25 @@ public class FloatingActionButtonTest extends BaseTest {
83 83
 
84 84
     @Test
85 85
     public void showOnPush() {
86
-        stackController.push(childFab);
86
+        stackController.push(childFab, new CommandListenerAdapter());
87 87
         childFab.onViewAppeared();
88 88
         assertThat(hasFab()).isTrue();
89 89
     }
90 90
 
91 91
     @Test
92 92
     public void hideOnPush() {
93
-        stackController.push(childFab);
93
+        stackController.push(childFab, new CommandListenerAdapter());
94 94
         childFab.onViewAppeared();
95 95
         assertThat(hasFab()).isTrue();
96
-        stackController.push(childNoFab);
96
+        stackController.push(childNoFab, new CommandListenerAdapter());
97 97
         childNoFab.onViewAppeared();
98 98
         assertThat(hasFab()).isFalse();
99 99
     }
100 100
 
101 101
     @Test
102 102
     public void hideOnPop() {
103
-        stackController.push(childNoFab);
104
-        stackController.push(childFab);
103
+        stackController.push(childNoFab, new CommandListenerAdapter());
104
+        stackController.push(childFab, new CommandListenerAdapter());
105 105
         childFab.onViewAppeared();
106 106
         assertThat(hasFab()).isTrue();
107 107
         stackController.pop(new CommandListenerAdapter());
@@ -114,8 +114,8 @@ public class FloatingActionButtonTest extends BaseTest {
114 114
         childFab.options.animated = new Bool(false);
115 115
         childNoFab.options.animated = new Bool(false);
116 116
 
117
-        stackController.push(childFab);
118
-        stackController.push(childNoFab);
117
+        stackController.push(childFab, new CommandListenerAdapter());
118
+        stackController.push(childNoFab, new CommandListenerAdapter());
119 119
         childNoFab.onViewAppeared();
120 120
         assertThat(hasFab()).isFalse();
121 121
         stackController.pop(new CommandListenerAdapter());
@@ -126,7 +126,7 @@ public class FloatingActionButtonTest extends BaseTest {
126 126
     @Test
127 127
     public void hasChildren() {
128 128
         childFab = new SimpleViewController(activity, "child1", getOptionsWithFabActions());
129
-        stackController.push(childFab);
129
+        stackController.push(childFab, new CommandListenerAdapter());
130 130
         childFab.onViewAppeared();
131 131
         assertThat(hasFab()).isTrue();
132 132
         assertThat(containsActions()).isTrue();

+ 4
- 4
lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/NavigatorTest.java Ver arquivo

@@ -340,7 +340,7 @@ public class NavigatorTest extends BaseTest {
340 340
     public void pushIntoModal() {
341 341
         uut.setRoot(parentController, new MockPromise());
342 342
         StackController stackController = newStack();
343
-        stackController.push(child1);
343
+        stackController.push(child1, new CommandListenerAdapter());
344 344
         uut.showModal(stackController, new MockPromise());
345 345
         uut.push(stackController.getId(), child2, new CommandListenerAdapter());
346 346
         assertIsChildById(stackController.getView(), child2.getView());
@@ -353,10 +353,10 @@ public class NavigatorTest extends BaseTest {
353 353
         StackController parent = newStack();
354 354
         parent.ensureViewIsCreated();
355 355
         uut.setRoot(parent, new MockPromise());
356
-        parent.push(parentController);
356
+        parent.push(parentController, new CommandListenerAdapter());
357 357
 
358
-        parentController.push(child1);
359
-        parentController.push(child2);
358
+        parentController.push(child1, new CommandListenerAdapter());
359
+        parentController.push(child2, new CommandListenerAdapter());
360 360
         assertThat(parentController.getChildControllers().size()).isEqualTo(2);
361 361
         child1.ensureViewIsCreated();
362 362
         child2.ensureViewIsCreated();

+ 2
- 2
lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/OptionsApplyingTest.java Ver arquivo

@@ -193,7 +193,7 @@ public class OptionsApplyingTest extends BaseTest {
193 193
         json.put("component", new JSONObject().put("name","someComponent").put("componentId", "id"));
194 194
         uut.options.topBarOptions.background = TopBarBackgroundOptions.parse(json);
195 195
         uut.ensureViewIsCreated();
196
-        stackController.push(uut);
196
+        stackController.push(uut, new CommandListenerAdapter());
197 197
         uut.onViewAppeared();
198 198
 
199 199
         assertThat(((ColorDrawable) stackController.getTopBar().getTitleBar().getBackground()).getColor()).isEqualTo(Color.TRANSPARENT);
@@ -206,7 +206,7 @@ public class OptionsApplyingTest extends BaseTest {
206 206
         json.put("text", "sub");
207 207
         uut.options.topBarOptions.subtitle = SubtitleOptions.parse(new TypefaceLoaderMock(), json);
208 208
         uut.ensureViewIsCreated();
209
-        stackController.push(uut);
209
+        stackController.push(uut, new CommandListenerAdapter());
210 210
         uut.onViewAppeared();
211 211
 
212 212
         assertThat(stackController.getTopBar().getTitleBar().getSubtitle()).isEqualTo("sub");

+ 3
- 3
lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/TopTabsViewControllerTest.java Ver arquivo

@@ -64,7 +64,7 @@ public class TopTabsViewControllerTest extends BaseTest {
64 64
         tabControllers.forEach(viewController -> viewController.setParentController(uut));
65 65
 
66 66
         parentController = spy(createStackController("stackId"));
67
-        parentController.push(uut);
67
+        parentController.push(uut, new CommandListenerAdapter());
68 68
         uut.setParentController(parentController);
69 69
     }
70 70
 
@@ -233,8 +233,8 @@ public class TopTabsViewControllerTest extends BaseTest {
233 233
         );
234 234
         first.options.animated = new Bool(false);
235 235
         uut.options.animated = new Bool(false);
236
-        stackController.push(first);
237
-        stackController.push(uut);
236
+        stackController.push(first, new CommandListenerAdapter());
237
+        stackController.push(uut, new CommandListenerAdapter());
238 238
 
239 239
         first.ensureViewIsCreated();
240 240
         uut.ensureViewIsCreated();