scanned results are always a trusted source

This commit is contained in:
Daniel Gultsch 2018-03-13 16:55:25 +01:00
parent 0c58e7cc30
commit f21fda1421
2 changed files with 14 additions and 9 deletions

View file

@ -821,7 +821,7 @@ public class StartConversationActivity extends XmppActivity implements OnRosterU
case Intent.ACTION_VIEW: case Intent.ACTION_VIEW:
Uri uri = intent.getData(); Uri uri = intent.getData();
if (uri != null) { if (uri != null) {
Invite invite = new Invite(intent.getData(), false); Invite invite = new Invite(intent.getData(), intent.getBooleanExtra("scanned", false));
invite.account = intent.getStringExtra("account"); invite.account = intent.getStringExtra("account");
return invite.invite(); return invite.invite();
} else { } else {

View file

@ -74,6 +74,10 @@ public class UriHandlerActivity extends AppCompatActivity {
} }
private void handleUri(Uri uri) { private void handleUri(Uri uri) {
handleUri(uri, false);
}
private void handleUri(Uri uri, final boolean scanned) {
final Intent intent; final Intent intent;
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
@ -108,6 +112,7 @@ public class UriHandlerActivity extends AppCompatActivity {
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.setData(uri); intent.setData(uri);
} else { } else {
Toast.makeText(this, R.string.invalid_jid, Toast.LENGTH_SHORT).show(); Toast.makeText(this, R.string.invalid_jid, Toast.LENGTH_SHORT).show();
@ -149,7 +154,7 @@ public class UriHandlerActivity extends AppCompatActivity {
String result = intent.getStringExtra(ScanActivity.INTENT_EXTRA_RESULT); String result = intent.getStringExtra(ScanActivity.INTENT_EXTRA_RESULT);
if (result != null) { if (result != null) {
Uri uri = Uri.parse(result); Uri uri = Uri.parse(result);
handleUri(uri); handleUri(uri, true);
} }
} }
finish(); finish();