소스 검색

Rename applyOptions(Options, Component) to applyChildOpions

Guy Carmeli 7 년 전
부모
커밋
7206280b92

+ 1
- 1
lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/ComponentViewController.java 파일 보기

62
     public void mergeOptions(Options options) {
62
     public void mergeOptions(Options options) {
63
         this.options = this.options.mergeWith(options);
63
         this.options = this.options.mergeWith(options);
64
         view.applyOptions(this.options);
64
         view.applyOptions(this.options);
65
-        applyOnParentController(parentController -> parentController.applyOptions(this.options, view));
65
+        applyOnParentController(parentController -> parentController.applyChildOptions(this.options, view));
66
     }
66
     }
67
 
67
 
68
     ReactComponent getComponent() {
68
     ReactComponent getComponent() {

+ 1
- 1
lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/ParentController.java 파일 보기

57
     }
57
     }
58
 
58
 
59
     @CallSuper
59
     @CallSuper
60
-    public void applyOptions(Options options, Component childComponent) {
60
+    public void applyChildOptions(Options options, Component child) {
61
         mergeChildOptions(options);
61
         mergeChildOptions(options);
62
     }
62
     }
63
 
63
 

+ 3
- 3
lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/SideMenuController.java 파일 보기

49
 	}
49
 	}
50
 
50
 
51
     @Override
51
     @Override
52
-    public void applyOptions(Options options, Component childComponent) {
53
-        super.applyOptions(options, childComponent);
52
+    public void applyChildOptions(Options options, Component child) {
53
+        super.applyChildOptions(options, child);
54
         applyOnParentController(parentController ->
54
         applyOnParentController(parentController ->
55
-                ((ParentController) parentController).applyOptions(this.options, childComponent)
55
+                ((ParentController) parentController).applyChildOptions(this.options, child)
56
         );
56
         );
57
     }
57
     }
58
 
58
 

+ 6
- 6
lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/StackController.java 파일 보기

42
     }
42
     }
43
 
43
 
44
     @Override
44
     @Override
45
-    public void applyOptions(Options options, Component component) {
46
-        super.applyOptions(options, component);
47
-        getView().applyOptions(this.options, component);
45
+    public void applyChildOptions(Options options, Component child) {
46
+        super.applyChildOptions(options, child);
47
+        getView().applyOptions(this.options, child);
48
         applyOnParentController(parentController ->
48
         applyOnParentController(parentController ->
49
-                ((ParentController) parentController).applyOptions(this.options.copy().clearTopBarOptions(), component)
49
+                ((ParentController) parentController).applyChildOptions(this.options.copy().clearTopBarOptions(), child)
50
         );
50
         );
51
-        if (component instanceof ReactComponent) {
52
-            fabOptionsPresenter.applyOptions(options.fabOptions, (ReactComponent) component, getView());
51
+        if (child instanceof ReactComponent) {
52
+            fabOptionsPresenter.applyOptions(options.fabOptions, (ReactComponent) child, getView());
53
         }
53
         }
54
         animator.setOptions(options.animationsOptions);
54
         animator.setOptions(options.animationsOptions);
55
     }
55
     }

+ 1
- 1
lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/ViewController.java 파일 보기

156
         applyOptions(options);
156
         applyOptions(options);
157
         applyOnParentController(parentController -> {
157
         applyOnParentController(parentController -> {
158
             parentController.clearOptions();
158
             parentController.clearOptions();
159
-            if (getView() instanceof Component) parentController.applyOptions(options, (Component) getView());
159
+            if (getView() instanceof Component) parentController.applyChildOptions(options, (Component) getView());
160
         });
160
         });
161
     }
161
     }
162
 
162
 

+ 4
- 4
lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/bottomtabs/BottomTabsController.java 파일 보기

57
     }
57
     }
58
 
58
 
59
     @Override
59
     @Override
60
-    public void applyOptions(Options options, Component childComponent) {
61
-        super.applyOptions(options, childComponent);
62
-        int tabIndex = bottomTabFinder.findByComponent(childComponent);
60
+    public void applyChildOptions(Options options, Component child) {
61
+        super.applyChildOptions(options, child);
62
+        int tabIndex = bottomTabFinder.findByComponent(child);
63
         if (tabIndex >= 0) new BottomTabsOptionsPresenter(bottomTabs, bottomTabFinder).present(this.options, tabIndex);
63
         if (tabIndex >= 0) new BottomTabsOptionsPresenter(bottomTabs, bottomTabFinder).present(this.options, tabIndex);
64
         applyOnParentController(parentController ->
64
         applyOnParentController(parentController ->
65
-                ((ParentController) parentController).applyOptions(this.options.copy().clearBottomTabsOptions().clearBottomTabOptions(), childComponent)
65
+                ((ParentController) parentController).applyChildOptions(this.options.copy().clearBottomTabsOptions().clearBottomTabOptions(), child)
66
         );
66
         );
67
     }
67
     }
68
 
68
 

+ 3
- 3
lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/toptabs/TopTabsController.java 파일 보기

79
     }
79
     }
80
 
80
 
81
     @Override
81
     @Override
82
-    public void applyOptions(Options options, Component childComponent) {
83
-        super.applyOptions(options, childComponent);
82
+    public void applyChildOptions(Options options, Component child) {
83
+        super.applyChildOptions(options, child);
84
         applyOnParentController(parentController -> {
84
         applyOnParentController(parentController -> {
85
                 Options opt = this.options.copy();
85
                 Options opt = this.options.copy();
86
-                ((ParentController) parentController).applyOptions(opt.clearTopTabOptions().clearTopTabsOptions(), childComponent);
86
+                ((ParentController) parentController).applyChildOptions(opt.clearTopTabOptions().clearTopTabsOptions(), child);
87
             }
87
             }
88
         );
88
         );
89
     }
89
     }

+ 1
- 1
lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/BottomTabsControllerTest.java 파일 보기

139
         child1.onViewAppeared();
139
         child1.onViewAppeared();
140
         ArgumentCaptor<Options> optionsCaptor = ArgumentCaptor.forClass(Options.class);
140
         ArgumentCaptor<Options> optionsCaptor = ArgumentCaptor.forClass(Options.class);
141
         ArgumentCaptor<ReactComponent> viewCaptor = ArgumentCaptor.forClass(ReactComponent.class);
141
         ArgumentCaptor<ReactComponent> viewCaptor = ArgumentCaptor.forClass(ReactComponent.class);
142
-        verify(stack, times(1)).applyOptions(optionsCaptor.capture(), viewCaptor.capture());
142
+        verify(stack, times(1)).applyChildOptions(optionsCaptor.capture(), viewCaptor.capture());
143
         assertThat(viewCaptor.getValue()).isEqualTo(child1.getView());
143
         assertThat(viewCaptor.getValue()).isEqualTo(child1.getView());
144
         assertThat(optionsCaptor.getValue().bottomTabsOptions.tabColor.hasValue()).isFalse();
144
         assertThat(optionsCaptor.getValue().bottomTabsOptions.tabColor.hasValue()).isFalse();
145
     }
145
     }

+ 1
- 1
lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/ParentControllerTest.java 파일 보기

132
         ArgumentCaptor<Options> optionsCaptor = ArgumentCaptor.forClass(Options.class);
132
         ArgumentCaptor<Options> optionsCaptor = ArgumentCaptor.forClass(Options.class);
133
         ArgumentCaptor<ReactComponent> viewCaptor = ArgumentCaptor.forClass(ReactComponent.class);
133
         ArgumentCaptor<ReactComponent> viewCaptor = ArgumentCaptor.forClass(ReactComponent.class);
134
         verify(uut, times(1)).clearOptions();
134
         verify(uut, times(1)).clearOptions();
135
-        verify(uut, times(1)).applyOptions(optionsCaptor.capture(), viewCaptor.capture());
135
+        verify(uut, times(1)).applyChildOptions(optionsCaptor.capture(), viewCaptor.capture());
136
         assertThat(optionsCaptor.getValue().topBarOptions.title.text.get()).isEqualTo("new title");
136
         assertThat(optionsCaptor.getValue().topBarOptions.title.text.get()).isEqualTo("new title");
137
         assertThat(viewCaptor.getValue()).isEqualTo(child1.getView());
137
         assertThat(viewCaptor.getValue()).isEqualTo(child1.getView());
138
     }
138
     }

+ 2
- 2
lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/StackControllerTest.java 파일 보기

88
             @Override
88
             @Override
89
             public void resolve(@Nullable Object value) {
89
             public void resolve(@Nullable Object value) {
90
                 uut.pop(new MockPromise());
90
                 uut.pop(new MockPromise());
91
-                verify(uut, times(1)).applyOptions(uut.options, eq((ReactComponent) child1.getView()));
91
+                verify(uut, times(1)).applyChildOptions(uut.options, eq((ReactComponent) child1.getView()));
92
             }
92
             }
93
         });
93
         });
94
     }
94
     }
432
 
432
 
433
         ArgumentCaptor<Options> optionsCaptor = ArgumentCaptor.forClass(Options.class);
433
         ArgumentCaptor<Options> optionsCaptor = ArgumentCaptor.forClass(Options.class);
434
         ArgumentCaptor<ReactComponent> viewCaptor = ArgumentCaptor.forClass(ReactComponent.class);
434
         ArgumentCaptor<ReactComponent> viewCaptor = ArgumentCaptor.forClass(ReactComponent.class);
435
-        verify(parent, times(1)).applyOptions(optionsCaptor.capture(), viewCaptor.capture());
435
+        verify(parent, times(1)).applyChildOptions(optionsCaptor.capture(), viewCaptor.capture());
436
         assertThat(optionsCaptor.getValue().topBarOptions.title.text.hasValue()).isFalse();
436
         assertThat(optionsCaptor.getValue().topBarOptions.title.text.hasValue()).isFalse();
437
     }
437
     }
438
 
438
 

+ 5
- 5
lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/TopTabsViewControllerTest.java 파일 보기

166
         verify(tabControllers.get(1), times(0)).onViewAppeared();
166
         verify(tabControllers.get(1), times(0)).onViewAppeared();
167
 
167
 
168
         ReactComponent comp = ((ComponentViewController) tabControllers.get(0)).getComponent();
168
         ReactComponent comp = ((ComponentViewController) tabControllers.get(0)).getComponent();
169
-        verify(uut, times(1)).applyOptions(any(Options.class), eq(comp));
169
+        verify(uut, times(1)).applyChildOptions(any(Options.class), eq(comp));
170
     }
170
     }
171
 
171
 
172
     @Test
172
     @Test
178
 
178
 
179
         uut.onViewAppeared();
179
         uut.onViewAppeared();
180
         ReactComponent currentTab = tabView(0);
180
         ReactComponent currentTab = tabView(0);
181
-        verify(uut, times(1)).applyOptions(any(Options.class), eq(currentTab));
181
+        verify(uut, times(1)).applyChildOptions(any(Options.class), eq(currentTab));
182
         assertThat(uut.options.topBarOptions.title.text.get()).isEqualTo(createTabTopBarTitle(0));
182
         assertThat(uut.options.topBarOptions.title.text.get()).isEqualTo(createTabTopBarTitle(0));
183
 
183
 
184
         uut.switchToTab(1);
184
         uut.switchToTab(1);
185
         currentTab = tabView(1);
185
         currentTab = tabView(1);
186
-        verify(uut, times(1)).applyOptions(any(Options.class), eq(currentTab));
186
+        verify(uut, times(1)).applyChildOptions(any(Options.class), eq(currentTab));
187
         assertThat(uut.options.topBarOptions.title.text.get()).isEqualTo(createTabTopBarTitle(1));
187
         assertThat(uut.options.topBarOptions.title.text.get()).isEqualTo(createTabTopBarTitle(1));
188
 
188
 
189
         uut.switchToTab(0);
189
         uut.switchToTab(0);
190
         currentTab = tabView(0);
190
         currentTab = tabView(0);
191
-        verify(uut, times(2)).applyOptions(any(Options.class), eq(currentTab));
191
+        verify(uut, times(2)).applyChildOptions(any(Options.class), eq(currentTab));
192
         assertThat(uut.options.topBarOptions.title.text.get()).isEqualTo(createTabTopBarTitle(0));
192
         assertThat(uut.options.topBarOptions.title.text.get()).isEqualTo(createTabTopBarTitle(0));
193
     }
193
     }
194
 
194
 
213
         tabControllers.get(0).onViewAppeared();
213
         tabControllers.get(0).onViewAppeared();
214
         ArgumentCaptor<Options> optionsCaptor = ArgumentCaptor.forClass(Options.class);
214
         ArgumentCaptor<Options> optionsCaptor = ArgumentCaptor.forClass(Options.class);
215
         ArgumentCaptor<ReactComponent> viewCaptor = ArgumentCaptor.forClass(ReactComponent.class);
215
         ArgumentCaptor<ReactComponent> viewCaptor = ArgumentCaptor.forClass(ReactComponent.class);
216
-        verify(parentController, times(1)).applyOptions(optionsCaptor.capture(), viewCaptor.capture());
216
+        verify(parentController, times(1)).applyChildOptions(optionsCaptor.capture(), viewCaptor.capture());
217
         assertThat(optionsCaptor.getValue().topTabOptions.title.hasValue()).isFalse();
217
         assertThat(optionsCaptor.getValue().topTabOptions.title.hasValue()).isFalse();
218
     }
218
     }
219
 
219