Skip to content

Commit

Permalink
remove unused field
Browse files Browse the repository at this point in the history
  • Loading branch information
eadm committed Apr 5, 2019
1 parent 1204a6a commit 0889d75
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 23 deletions.
2 changes: 1 addition & 1 deletion app/src/main/java/org/stepic/droid/core/ScreenManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public interface ScreenManager {

void openDeepLink(Context context, BranchRoute route);

void showProfileEdit(Context context, Profile profile);
void showProfileEdit(Context context);
void showProfileEditInfo(Activity activity, Profile profile);
void showProfileEditPassword(Activity activity, long profileId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -705,11 +705,11 @@ public void openDeepLink(Context context, BranchRoute route) {
}

@Override
public void showProfileEdit(Context context, Profile profile) {
public void showProfileEdit(Context context) {
if (context instanceof Activity) {
((Activity) context).overridePendingTransition(org.stepic.droid.R.anim.push_up, org.stepic.droid.R.anim.no_transition);
}
context.startActivity(ProfileEditActivity.Companion.createIntent(context, profile));
context.startActivity(ProfileEditActivity.Companion.createIntent(context));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,7 @@ constructor(
information = stringOrEmpty((user.details)),
isMyProfile = false,
isPrivate = user.isPrivate,
id = userId,
profile = null)
id = userId)
this.userViewModel = userViewModelLocal

mainHandler.post {
Expand Down Expand Up @@ -188,8 +187,7 @@ constructor(
information = stringOrEmpty(profile.details),
isMyProfile = isMyProfile,
isPrivate = profile.isPrivate,
id = profile.id,
profile = profile)
id = profile.id)
this.userViewModel = userViewModelLocal


Expand Down
5 changes: 1 addition & 4 deletions app/src/main/java/org/stepic/droid/model/UserViewModel.kt
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
package org.stepic.droid.model

import org.stepik.android.model.user.Profile

data class UserViewModel(
val fullName: String,
val shortBio: String,
val information: String,
val imageLink: String?,
val isMyProfile: Boolean,
val isPrivate: Boolean,
val id: Long,
val profile: Profile?
val id: Long
)
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ class ProfileFragment : FragmentBase(),
inflater.inflate(R.menu.profile_menu, menu)

menu?.findItem(R.id.menu_item_edit)?.isVisible =
localUserViewModel?.isMyProfile == true && localUserViewModel?.profile != null
localUserViewModel?.isMyProfile == true
}
}

Expand All @@ -472,10 +472,8 @@ class ProfileFragment : FragmentBase(),
return true
}
R.id.menu_item_edit -> {
localUserViewModel?.profile?.let { profile ->
analytic.reportAmplitudeEvent(AmplitudeAnalytic.ProfileEdit.SCREEN_OPENED)
screenManager.showProfileEdit(context, profile)
}
analytic.reportAmplitudeEvent(AmplitudeAnalytic.ProfileEdit.SCREEN_OPENED)
screenManager.showProfileEdit(context)
return true
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,8 @@ import javax.inject.Inject

class ProfileEditActivity : AppCompatActivity(), ProfileEditView {
companion object {
private const val EXTRA_PROFILE = "profile"

fun createIntent(context: Context, profile: Profile): Intent =
fun createIntent(context: Context): Intent =
Intent(context, ProfileEditActivity::class.java)
.putExtra(EXTRA_PROFILE, profile)
}

private lateinit var profileEditPresenter: ProfileEditPresenter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import java.util.concurrent.ThreadPoolExecutor;

import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;

import static org.mockito.Matchers.any;
Expand Down Expand Up @@ -102,7 +101,7 @@ private void generateInstructorApiModels() {
String details = " DetailedInfo";

fakeUserFromApi = FakeUserGenerator.INSTANCE.generate(profileId, name, lastName, imageLink, shortBio, details);
fromApiUserViewModel = new UserViewModel(name + " " + lastName, shortBio, details, imageLink, isMyProfile, isPrivate, profileId, null);
fromApiUserViewModel = new UserViewModel(name + " " + lastName, shortBio, details, imageLink, isMyProfile, isPrivate, profileId);
}

private void generateLocalModels() {
Expand All @@ -116,7 +115,7 @@ private void generateLocalModels() {
String details = " details";

preferencesProfileModel = FakeProfileGenerator.INSTANCE.generate(profileId, name, lastName, imageLink, shortBio, details);
fromPreferencesUserViewModel = new UserViewModel(name + " " + lastName, shortBio, details, imageLink, isMyProfile, isPrivate, profileId, preferencesProfileModel);
fromPreferencesUserViewModel = new UserViewModel(name + " " + lastName, shortBio, details, imageLink, isMyProfile, isPrivate, profileId);
}

@Test
Expand Down

0 comments on commit 0889d75

Please sign in to comment.