UriHandlerActivity: Always check for XMPP URI validity (#2926)

Also check for XMPP URI validity if there are no configured accounts
and the WelcomeActivity is active.
This commit is contained in:
af8a524db1 2018-04-02 08:40:27 +02:00 committed by Daniel Gultsch
parent 8b70d945cc
commit e6d7e5f27f

View file

@ -84,6 +84,11 @@ public class UriHandlerActivity extends AppCompatActivity {
final XmppUri xmppUri = new XmppUri(uri); final XmppUri xmppUri = new XmppUri(uri);
final List<Jid> accounts = DatabaseBackend.getInstance(this).getAccountJids(); //TODO only look at enabled accounts final List<Jid> accounts = DatabaseBackend.getInstance(this).getAccountJids(); //TODO only look at enabled accounts
if (!xmppUri.isJidValid()) {
Toast.makeText(this, R.string.invalid_jid, Toast.LENGTH_SHORT).show();
return;
}
if (accounts.size() == 0) { if (accounts.size() == 0) {
intent = new Intent(getApplicationContext(), WelcomeActivity.class); intent = new Intent(getApplicationContext(), WelcomeActivity.class);
WelcomeActivity.addInviteUri(intent, xmppUri); WelcomeActivity.addInviteUri(intent, xmppUri);
@ -111,15 +116,12 @@ public class UriHandlerActivity extends AppCompatActivity {
intent.putExtra("jid", xmppUri.getJid().asBareJid().toString()); intent.putExtra("jid", xmppUri.getJid().asBareJid().toString());
intent.setData(uri); intent.setData(uri);
intent.putExtra("scanned", scanned); intent.putExtra("scanned", scanned);
} else if (xmppUri.isJidValid()) { } else {
intent = new Intent(getApplicationContext(), StartConversationActivity.class); intent = new Intent(getApplicationContext(), StartConversationActivity.class);
intent.setAction(Intent.ACTION_VIEW); intent.setAction(Intent.ACTION_VIEW);
intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
intent.putExtra("scanned", scanned); intent.putExtra("scanned", scanned);
intent.setData(uri); intent.setData(uri);
} else {
Toast.makeText(this, R.string.invalid_jid, Toast.LENGTH_SHORT).show();
return;
} }
startActivity(intent); startActivity(intent);