do not show 'open website' button after info has changed

fixes #3220
This commit is contained in:
Daniel Gultsch 2018-10-11 05:06:42 +02:00
parent 409bf3c0cb
commit 5718d552ed
1 changed files with 4 additions and 3 deletions

View File

@ -122,6 +122,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
public void onClick(final View v) { public void onClick(final View v) {
final String password = mPassword.getText().toString(); final String password = mPassword.getText().toString();
final boolean wasDisabled = mAccount != null && mAccount.getStatus() == Account.State.DISABLED; final boolean wasDisabled = mAccount != null && mAccount.getStatus() == Account.State.DISABLED;
final boolean accountInfoEdited = accountInfoEdited();
if (!mInitMode && passwordChangedInMagicCreateMode()) { if (!mInitMode && passwordChangedInMagicCreateMode()) {
gotoChangePassword(password); gotoChangePassword(password);
@ -130,7 +131,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
if (mInitMode && mAccount != null) { if (mInitMode && mAccount != null) {
mAccount.setOption(Account.OPTION_DISABLED, false); mAccount.setOption(Account.OPTION_DISABLED, false);
} }
if (mAccount != null && mAccount.getStatus() == Account.State.DISABLED && !accountInfoEdited()) { if (mAccount != null && mAccount.getStatus() == Account.State.DISABLED && !accountInfoEdited) {
mAccount.setOption(Account.OPTION_DISABLED, false); mAccount.setOption(Account.OPTION_DISABLED, false);
if (!xmppConnectionService.updateAccount(mAccount)) { if (!xmppConnectionService.updateAccount(mAccount)) {
Toast.makeText(EditAccountActivity.this, R.string.unable_to_update_account, Toast.LENGTH_SHORT).show(); Toast.makeText(EditAccountActivity.this, R.string.unable_to_update_account, Toast.LENGTH_SHORT).show();
@ -146,7 +147,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
} }
XmppConnection connection = mAccount == null ? null : mAccount.getXmppConnection(); XmppConnection connection = mAccount == null ? null : mAccount.getXmppConnection();
boolean openRegistrationUrl = registerNewAccount && mAccount != null && mAccount.getStatus() == Account.State.REGISTRATION_WEB; boolean openRegistrationUrl = registerNewAccount && !accountInfoEdited && mAccount != null && mAccount.getStatus() == Account.State.REGISTRATION_WEB;
boolean openPaymentUrl = mAccount != null && mAccount.getStatus() == Account.State.PAYMENT_REQUIRED; boolean openPaymentUrl = mAccount != null && mAccount.getStatus() == Account.State.PAYMENT_REQUIRED;
final boolean redirectionWorthyStatus = openPaymentUrl || openRegistrationUrl; final boolean redirectionWorthyStatus = openPaymentUrl || openRegistrationUrl;
URL url = connection != null && redirectionWorthyStatus ? connection.getRedirectionUrl() : null; URL url = connection != null && redirectionWorthyStatus ? connection.getRedirectionUrl() : null;
@ -485,7 +486,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
} else { } else {
XmppConnection connection = mAccount == null ? null : mAccount.getXmppConnection(); XmppConnection connection = mAccount == null ? null : mAccount.getXmppConnection();
URL url = connection != null && mAccount.getStatus() == Account.State.REGISTRATION_WEB ? connection.getRedirectionUrl() : null; URL url = connection != null && mAccount.getStatus() == Account.State.REGISTRATION_WEB ? connection.getRedirectionUrl() : null;
if (url != null && this.binding.accountRegisterNew.isChecked()) { if (url != null && this.binding.accountRegisterNew.isChecked() && !accountInfoEdited) {
this.mSaveButton.setText(R.string.open_website); this.mSaveButton.setText(R.string.open_website);
} else { } else {
this.mSaveButton.setText(R.string.next); this.mSaveButton.setText(R.string.next);