Pass invite XMPP URI along instead of JID
This commit is contained in:
parent
43eb293c66
commit
ee5eb7a0b2
6 changed files with 20 additions and 20 deletions
|
@ -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();
|
||||
});
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Reference in a new issue