diff options
author | Christian Schneppe <christian@pix-art.de> | 2018-02-15 19:37:25 +0100 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2018-02-15 19:37:25 +0100 |
commit | ee5eb7a0b2fc26b094657672429659f840a01dba (patch) | |
tree | 799e6345985dcf9fa9550715a0b2e06891a17251 | |
parent | 43eb293c666eb00d44eaa13d5f566a6dc68ede13 (diff) |
Pass invite XMPP URI along instead of JID
6 files changed, 20 insertions, 20 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java b/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java index 4a203af43..7ed6e79ff 100644 --- a/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java +++ b/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java @@ -329,7 +329,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat && xmppConnectionService.getAccounts().size() == 1) { xmppConnectionService.deleteAccount(mAccount); Intent intent = new Intent(EditAccountActivity.this, WelcomeActivity.class); - WelcomeActivity.addInvitee(intent, getIntent()); + WelcomeActivity.addInviteUri(intent, getIntent()); startActivity(intent); } } @@ -403,7 +403,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat if (wasFirstAccount) { intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); } - WelcomeActivity.addInvitee(intent, getIntent()); + WelcomeActivity.addInviteUri(intent, getIntent()); startActivity(intent); finish(); }); diff --git a/src/main/java/de/pixart/messenger/ui/MagicCreateActivity.java b/src/main/java/de/pixart/messenger/ui/MagicCreateActivity.java index 849bd0593..84c34d525 100644 --- a/src/main/java/de/pixart/messenger/ui/MagicCreateActivity.java +++ b/src/main/java/de/pixart/messenger/ui/MagicCreateActivity.java @@ -84,7 +84,7 @@ public class MagicCreateActivity extends XmppActivity implements TextWatcher { intent.putExtra("init", true); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); Toast.makeText(MagicCreateActivity.this, R.string.secure_password_generated, Toast.LENGTH_SHORT).show(); - WelcomeActivity.addInvitee(intent, getIntent()); + WelcomeActivity.addInviteUri(intent, getIntent()); startActivity(intent); } catch (InvalidJidException e) { mUsername.setError(getString(R.string.invalid_username)); diff --git a/src/main/java/de/pixart/messenger/ui/PublishProfilePictureActivity.java b/src/main/java/de/pixart/messenger/ui/PublishProfilePictureActivity.java index 8ac690ea9..681aedc6e 100644 --- a/src/main/java/de/pixart/messenger/ui/PublishProfilePictureActivity.java +++ b/src/main/java/de/pixart/messenger/ui/PublishProfilePictureActivity.java @@ -63,7 +63,7 @@ public class PublishProfilePictureActivity extends XmppActivity implements XmppC runOnUiThread(() -> { if (mInitialAccountSetup) { Intent intent = new Intent(getApplicationContext(), StartConversationActivity.class); - WelcomeActivity.addInvitee(intent, getIntent()); + WelcomeActivity.addInviteUri(intent, getIntent()); intent.putExtra("init", true); startActivity(intent); } @@ -111,7 +111,7 @@ public class PublishProfilePictureActivity extends XmppActivity implements XmppC if (mInitialAccountSetup) { Intent intent = new Intent(getApplicationContext(), StartConversationActivity.class); if (xmppConnectionService != null && xmppConnectionService.getAccounts().size() == 1) { - WelcomeActivity.addInvitee(intent, getIntent()); + WelcomeActivity.addInviteUri(intent, getIntent()); intent.putExtra("init", true); } startActivity(intent); diff --git a/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java b/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java index b66999eac..cf6b89aab 100644 --- a/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java +++ b/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java @@ -286,7 +286,7 @@ public class StartConversationActivity extends XmppActivity implements OnRosterU recreate(); } else { Intent i = getIntent(); - if (i == null || !i.hasExtra(WelcomeActivity.EXTRA_INVITEE)) { + if (i == null || !i.hasExtra(WelcomeActivity.EXTRA_INVITE_URI)) { askForContactsPermissions(); } } @@ -802,9 +802,9 @@ public class StartConversationActivity extends XmppActivity implements OnRosterU if (intent == null) { return false; } - final String invitee = intent.getStringExtra(WelcomeActivity.EXTRA_INVITEE); - if (invitee != null) { - Invite invite = new Invite("xmpp:" + invitee); + final String inviteUri = intent.getStringExtra(WelcomeActivity.EXTRA_INVITE_URI); + if (inviteUri != null) { + Invite invite = new Invite(inviteUri); if (invite.isJidValid()) { return invite.invite(); } diff --git a/src/main/java/de/pixart/messenger/ui/UriHandlerActivity.java b/src/main/java/de/pixart/messenger/ui/UriHandlerActivity.java index f636907cf..262be5bb0 100644 --- a/src/main/java/de/pixart/messenger/ui/UriHandlerActivity.java +++ b/src/main/java/de/pixart/messenger/ui/UriHandlerActivity.java @@ -34,7 +34,7 @@ public class UriHandlerActivity extends Activity { if (accounts.size() == 0) { intent = new Intent(getApplicationContext(), WelcomeActivity.class); - WelcomeActivity.addInvitee(intent, xmppUri); + WelcomeActivity.addInviteUri(intent, xmppUri); startActivity(intent); return; } diff --git a/src/main/java/de/pixart/messenger/ui/WelcomeActivity.java b/src/main/java/de/pixart/messenger/ui/WelcomeActivity.java index cd2be0161..0e84d1d64 100644 --- a/src/main/java/de/pixart/messenger/ui/WelcomeActivity.java +++ b/src/main/java/de/pixart/messenger/ui/WelcomeActivity.java @@ -43,7 +43,7 @@ import de.pixart.messenger.utils.XmppUri; public class WelcomeActivity extends XmppActivity { - public static final String EXTRA_INVITEE = "eu.siacs.conversations.invitee"; + public static final String EXTRA_INVITE_URI = "eu.siacs.conversations.invite_uri"; boolean importSuccessful = false; @Override @@ -110,7 +110,7 @@ public class WelcomeActivity extends XmppActivity { createAccount.setOnClickListener(v -> { final Intent intent = new Intent(WelcomeActivity.this, MagicCreateActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION); - addInvitee(intent); + addInviteUri(intent); startActivity(intent); }); final Button useOwnProvider = findViewById(R.id.use_existing_account); @@ -123,7 +123,7 @@ public class WelcomeActivity extends XmppActivity { } else if (accounts.size() >= 1) { intent = new Intent(WelcomeActivity.this, ManageAccountActivity.class); } - addInvitee(intent); + addInviteUri(intent); startActivity(intent); }); @@ -320,19 +320,19 @@ public class WelcomeActivity extends XmppActivity { } } - public void addInvitee(Intent intent) { - addInvitee(intent, getIntent()); + public void addInviteUri(Intent intent) { + addInviteUri(intent, getIntent()); } - public static void addInvitee(Intent intent, XmppUri uri) { + public static void addInviteUri(Intent intent, XmppUri uri) { if (uri.isJidValid()) { - intent.putExtra(EXTRA_INVITEE, uri.getJid().toString()); + intent.putExtra(EXTRA_INVITE_URI, uri.toString()); } } - public static void addInvitee(Intent to, Intent from) { - if (from != null && from.hasExtra(EXTRA_INVITEE)) { - to.putExtra(EXTRA_INVITEE, from.getStringExtra(EXTRA_INVITEE)); + public static void addInviteUri(Intent to, Intent from) { + if (from != null && from.hasExtra(EXTRA_INVITE_URI)) { + to.putExtra(EXTRA_INVITE_URI, from.getStringExtra(EXTRA_INVITE_URI)); } } |