aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart/messenger/ui
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2017-06-24 09:40:53 +0200
committerChristian Schneppe <christian@pix-art.de>2017-06-24 09:40:53 +0200
commit8e897c3d69d65155a2fa7a4ce75bfc5bc13d7233 (patch)
treee12795cc9f61bb711d6de65736226535d576091b /src/main/java/de/pixart/messenger/ui
parent3af45f570aafbcaeffd93b45a5b4e7a2bdcfeeb8 (diff)
offer to open website if ibb offers oob redirect
Diffstat (limited to 'src/main/java/de/pixart/messenger/ui')
-rw-r--r--src/main/java/de/pixart/messenger/ui/EditAccountActivity.java22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java b/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java
index 320823120..e64322ac9 100644
--- a/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java
@@ -129,6 +129,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
public void onClick(final View v) {
final String password = mPassword.getText().toString();
final String passwordConfirm = mPasswordConfirm.getText().toString();
+ final boolean wasDisabled = mAccount != null && mAccount.getStatus() == Account.State.DISABLED;
if (!mInitMode && passwordChangedInMagicCreateMode()) {
gotoChangePassword(password);
@@ -150,6 +151,19 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
mAccountJid.requestFocus();
return;
}
+
+ XmppConnection connection = mAccount == null ? null : mAccount.getXmppConnection();
+ String url = connection != null && mAccount.getStatus() == Account.State.REGISTRATION_WEB ? connection.getWebRegistrationUrl() : null;
+ if (url != null && registerNewAccount && !wasDisabled) {
+ try {
+ startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
+ return;
+ } catch (ActivityNotFoundException e) {
+ Toast.makeText(EditAccountActivity.this, R.string.application_found_to_open_website, Toast.LENGTH_SHORT);
+ return;
+ }
+ }
+
final Jid jid;
try {
if (mUsernameMode) {
@@ -444,7 +458,13 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
this.mSaveButton.setText(R.string.connect);
}
} else {
- this.mSaveButton.setText(R.string.next);
+ XmppConnection connection = mAccount == null ? null : mAccount.getXmppConnection();
+ String url = connection != null && mAccount.getStatus() == Account.State.REGISTRATION_WEB ? connection.getWebRegistrationUrl() : null;
+ if (url != null && mRegisterNew.isChecked()) {
+ this.mSaveButton.setText(R.string.open_website);
+ } else {
+ this.mSaveButton.setText(R.string.next);
+ }
}
}
}