Skip to content

Commit 0e594d2

Browse files
committed
Remove unused userId injected by dependency injector through module creation.
1 parent a4f207e commit 0e594d2

File tree

3 files changed

+5
-9
lines changed

3 files changed

+5
-9
lines changed

presentation/src/androidTest/java/com/fernandocejas/android10/sample/test/presenter/UserDetailsPresenterTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public class UserDetailsPresenterTest extends AndroidTestCase {
5555
public void testUserDetailsPresenterInitialize() {
5656
given(mockUserDetailsView.context()).willReturn(mockContext);
5757

58-
userDetailsPresenter.initialize(FAKE_USER_ID);
58+
userDetailsPresenter.initialize();
5959

6060
verify(mockUserDetailsView).hideRetry();
6161
verify(mockUserDetailsView).showLoading();

presentation/src/main/java/com/fernandocejas/android10/sample/presentation/presenter/UserDetailsPresenter.java

+2-6
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* you may not use this file except in compliance with the License.
66
* You may obtain a copy of the License at
77
*
8-
* http://www.apache.org/licenses/LICENSE-2.0
8+
* http://www.apache.org/licenses/LICENSE-2.0
99
*
1010
* Unless required by applicable law or agreed to in writing, software
1111
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -37,9 +37,6 @@
3737
@PerActivity
3838
public class UserDetailsPresenter implements Presenter {
3939

40-
/** id used to retrieve user details */
41-
private int userId;
42-
4340
private UserDetailsView viewDetailsView;
4441

4542
private final UseCase getUserDetailsUseCase;
@@ -68,8 +65,7 @@ public void setView(@NonNull UserDetailsView view) {
6865
/**
6966
* Initializes the presenter by start retrieving user details.
7067
*/
71-
public void initialize(int userId) {
72-
this.userId = userId;
68+
public void initialize() {
7369
this.loadUserDetails();
7470
}
7571

presentation/src/main/java/com/fernandocejas/android10/sample/presentation/view/fragment/UserDetailsFragment.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public static UserDetailsFragment create(int userId) {
7171
super.onViewCreated(view, savedInstanceState);
7272
this.userDetailsPresenter.setView(this);
7373
this.userId = getArguments().getInt(ARGUMENT_KEY_USER_ID);
74-
this.userDetailsPresenter.initialize(this.userId);
74+
this.userDetailsPresenter.initialize();
7575
}
7676

7777
@Override public void onResume() {
@@ -135,7 +135,7 @@ public static UserDetailsFragment create(int userId) {
135135
*/
136136
private void loadUserDetails() {
137137
if (this.userDetailsPresenter != null) {
138-
this.userDetailsPresenter.initialize(this.userId);
138+
this.userDetailsPresenter.initialize();
139139
}
140140
}
141141

0 commit comments

Comments
 (0)