Skip to content

Commit

Permalink
#697 - fix toast message is showing when navigating back to login (#766)
Browse files Browse the repository at this point in the history
  • Loading branch information
dekzitfz authored and Swati4star committed Oct 19, 2019
1 parent 7a6d2ce commit e1d0de8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ public void onClick(View view) {
mForgotPasswordText.setVisibility(View.VISIBLE);
mBackToLogin.setVisibility(View.GONE);
login.setVisibility(View.GONE);
mLoginPresenter.login();
mLoginPresenter.login(false);
break;
// Call login
case R.id.ok_login:
Expand Down Expand Up @@ -237,7 +237,7 @@ public void onClick(View view) {
mForgotPasswordText.setVisibility(View.VISIBLE);
mBackToLogin.setVisibility(View.GONE);
login.setVisibility(View.GONE);
mLoginPresenter.login();
mLoginPresenter.login(false);
break;
// Call resend reset code request
case R.id.resend_code:
Expand Down Expand Up @@ -327,8 +327,10 @@ public void openSignUp() {
}

@Override
public void openLogin() {
showMessage(getString(R.string.text_password_updated_alert));
public void openLogin(boolean showToastMessage) {
if (showToastMessage) {
showMessage(getString(R.string.text_password_updated_alert));
}
mForgotPasswordLayout.setVisibility(View.GONE);
mNewPasswordLayout.setVisibility(View.GONE);
sig.setVisibility(View.GONE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public void onResponse(Call call, final Response response) throws IOException {
String successfulMessage = "\"Successfully registered\"";
if (responseCode == HttpsURLConnection.HTTP_CREATED && res.equals(successfulMessage)) {
//if successful redirect to login
mView.openLogin();
mView.openLogin(false);
mView.setLoginEmail(email);
mView.showMessage("signup succeeded! please login");
} else {
Expand All @@ -111,8 +111,8 @@ public void onResponse(Call call, final Response response) throws IOException {
});
}

public void login() {
mView.openLogin();
public void login(boolean showToastMessage) {
mView.openLogin(showToastMessage);
}

/**
Expand Down Expand Up @@ -282,7 +282,7 @@ public void onResponse(Call call, final Response response) throws IOException {
mView.dismissLoadingDialog();
if (response.isSuccessful()) {
//display the login UI to login with the new password
mView.openLogin();
mView.openLogin(true);
} else if (response.code() == 400) {
mView.showMessage("Wrong 4-digit code or wrong password format");
} else if (response.code() == 404) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ interface LoginView {

void openSignUp();

void openLogin();
void openLogin(boolean showToastMessage);

void setLoginEmail(String email);

Expand Down

0 comments on commit e1d0de8

Please sign in to comment.