Pass invite XMPP URI along instead of JID
This commit is contained in:
parent
c7d2b65982
commit
3b7d9b39f7
|
@ -314,7 +314,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
|
||||||
&& xmppConnectionService.getAccounts().size() == 1) {
|
&& xmppConnectionService.getAccounts().size() == 1) {
|
||||||
xmppConnectionService.deleteAccount(mAccount);
|
xmppConnectionService.deleteAccount(mAccount);
|
||||||
Intent intent = new Intent(EditAccountActivity.this, WelcomeActivity.class);
|
Intent intent = new Intent(EditAccountActivity.this, WelcomeActivity.class);
|
||||||
WelcomeActivity.addInvitee(intent, getIntent());
|
WelcomeActivity.addInviteUri(intent, getIntent());
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -388,7 +388,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
|
||||||
if (wasFirstAccount) {
|
if (wasFirstAccount) {
|
||||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||||
}
|
}
|
||||||
WelcomeActivity.addInvitee(intent, getIntent());
|
WelcomeActivity.addInviteUri(intent, getIntent());
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
finish();
|
finish();
|
||||||
});
|
});
|
||||||
|
|
|
@ -80,7 +80,7 @@ public class MagicCreateActivity extends XmppActivity implements TextWatcher {
|
||||||
intent.putExtra("init", true);
|
intent.putExtra("init", true);
|
||||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
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();
|
Toast.makeText(MagicCreateActivity.this, R.string.secure_password_generated, Toast.LENGTH_SHORT).show();
|
||||||
WelcomeActivity.addInvitee(intent, getIntent());
|
WelcomeActivity.addInviteUri(intent, getIntent());
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
} catch (InvalidJidException e) {
|
} catch (InvalidJidException e) {
|
||||||
mUsername.setError(getString(R.string.invalid_username));
|
mUsername.setError(getString(R.string.invalid_username));
|
||||||
|
|
|
@ -62,7 +62,7 @@ public class PublishProfilePictureActivity extends XmppActivity implements XmppC
|
||||||
runOnUiThread(() -> {
|
runOnUiThread(() -> {
|
||||||
if (mInitialAccountSetup) {
|
if (mInitialAccountSetup) {
|
||||||
Intent intent = new Intent(getApplicationContext(), StartConversationActivity.class);
|
Intent intent = new Intent(getApplicationContext(), StartConversationActivity.class);
|
||||||
WelcomeActivity.addInvitee(intent, getIntent());
|
WelcomeActivity.addInviteUri(intent, getIntent());
|
||||||
intent.putExtra("init", true);
|
intent.putExtra("init", true);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
}
|
}
|
||||||
|
@ -110,7 +110,7 @@ public class PublishProfilePictureActivity extends XmppActivity implements XmppC
|
||||||
if (mInitialAccountSetup) {
|
if (mInitialAccountSetup) {
|
||||||
Intent intent = new Intent(getApplicationContext(), StartConversationActivity.class);
|
Intent intent = new Intent(getApplicationContext(), StartConversationActivity.class);
|
||||||
if (xmppConnectionService != null && xmppConnectionService.getAccounts().size() == 1) {
|
if (xmppConnectionService != null && xmppConnectionService.getAccounts().size() == 1) {
|
||||||
WelcomeActivity.addInvitee(intent, getIntent());
|
WelcomeActivity.addInviteUri(intent, getIntent());
|
||||||
intent.putExtra("init", true);
|
intent.putExtra("init", true);
|
||||||
}
|
}
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
|
|
|
@ -269,7 +269,7 @@ public class StartConversationActivity extends XmppActivity implements OnRosterU
|
||||||
recreate();
|
recreate();
|
||||||
} else {
|
} else {
|
||||||
Intent i = getIntent();
|
Intent i = getIntent();
|
||||||
if (i == null || !i.hasExtra(WelcomeActivity.EXTRA_INVITEE)) {
|
if (i == null || !i.hasExtra(WelcomeActivity.EXTRA_INVITE_URI)) {
|
||||||
askForContactsPermissions();
|
askForContactsPermissions();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -799,9 +799,9 @@ public class StartConversationActivity extends XmppActivity implements OnRosterU
|
||||||
if (intent == null) {
|
if (intent == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final String invitee = intent.getStringExtra(WelcomeActivity.EXTRA_INVITEE);
|
final String inviteUri = intent.getStringExtra(WelcomeActivity.EXTRA_INVITE_URI);
|
||||||
if (invitee != null) {
|
if (inviteUri != null) {
|
||||||
Invite invite = new Invite("xmpp:" + invitee);
|
Invite invite = new Invite(inviteUri);
|
||||||
if (invite.isJidValid()) {
|
if (invite.isJidValid()) {
|
||||||
return invite.invite();
|
return invite.invite();
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ public class UriHandlerActivity extends Activity {
|
||||||
|
|
||||||
if (accounts.size() == 0) {
|
if (accounts.size() == 0) {
|
||||||
intent = new Intent(getApplicationContext(), WelcomeActivity.class);
|
intent = new Intent(getApplicationContext(), WelcomeActivity.class);
|
||||||
WelcomeActivity.addInvitee(intent, xmppUri);
|
WelcomeActivity.addInviteUri(intent, xmppUri);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ import eu.siacs.conversations.utils.XmppUri;
|
||||||
|
|
||||||
public class WelcomeActivity extends XmppActivity {
|
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";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void refreshUiReal() {
|
protected void refreshUiReal() {
|
||||||
|
@ -59,7 +59,7 @@ public class WelcomeActivity extends XmppActivity {
|
||||||
createAccount.setOnClickListener(v -> {
|
createAccount.setOnClickListener(v -> {
|
||||||
final Intent intent = new Intent(WelcomeActivity.this, MagicCreateActivity.class);
|
final Intent intent = new Intent(WelcomeActivity.this, MagicCreateActivity.class);
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
|
intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
|
||||||
addInvitee(intent);
|
addInviteUri(intent);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
});
|
});
|
||||||
final Button useOwnProvider = findViewById(R.id.use_own_provider);
|
final Button useOwnProvider = findViewById(R.id.use_own_provider);
|
||||||
|
@ -72,25 +72,25 @@ public class WelcomeActivity extends XmppActivity {
|
||||||
} else if (accounts.size() >= 1) {
|
} else if (accounts.size() >= 1) {
|
||||||
intent = new Intent(WelcomeActivity.this, ManageAccountActivity.class);
|
intent = new Intent(WelcomeActivity.this, ManageAccountActivity.class);
|
||||||
}
|
}
|
||||||
addInvitee(intent);
|
addInviteUri(intent);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addInvitee(Intent intent) {
|
public void addInviteUri(Intent intent) {
|
||||||
addInvitee(intent, getIntent());
|
addInviteUri(intent, getIntent());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addInvitee(Intent intent, XmppUri uri) {
|
public static void addInviteUri(Intent intent, XmppUri uri) {
|
||||||
if (uri.isJidValid()) {
|
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) {
|
public static void addInviteUri(Intent to, Intent from) {
|
||||||
if (from != null && from.hasExtra(EXTRA_INVITEE)) {
|
if (from != null && from.hasExtra(EXTRA_INVITE_URI)) {
|
||||||
to.putExtra(EXTRA_INVITEE, from.getStringExtra(EXTRA_INVITEE));
|
to.putExtra(EXTRA_INVITE_URI, from.getStringExtra(EXTRA_INVITE_URI));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue