in lack of confirm source dialog in account details only trust scanned uris

This commit is contained in:
Daniel Gultsch 2018-03-23 11:39:36 +01:00
parent ce867758d5
commit c41f574b1f
2 changed files with 19 additions and 21 deletions

View File

@ -3,7 +3,6 @@ package eu.siacs.conversations.ui;
import android.app.Activity; import android.app.Activity;
import android.app.PendingIntent; import android.app.PendingIntent;
import android.content.ActivityNotFoundException; import android.content.ActivityNotFoundException;
import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.content.IntentSender; import android.content.IntentSender;
import android.content.SharedPreferences; import android.content.SharedPreferences;
@ -29,7 +28,6 @@ import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.view.View.OnClickListener; import android.view.View.OnClickListener;
import android.widget.Button; import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton; import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener; import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.EditText; import android.widget.EditText;
@ -38,7 +36,6 @@ import android.widget.ImageView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.RelativeLayout; import android.widget.RelativeLayout;
import android.widget.TableLayout; import android.widget.TableLayout;
import android.widget.TableRow;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
@ -67,7 +64,6 @@ import eu.siacs.conversations.ui.adapter.KnownHostsAdapter;
import eu.siacs.conversations.ui.adapter.PresenceTemplateAdapter; import eu.siacs.conversations.ui.adapter.PresenceTemplateAdapter;
import eu.siacs.conversations.ui.util.MenuDoubleTabUtil; import eu.siacs.conversations.ui.util.MenuDoubleTabUtil;
import eu.siacs.conversations.ui.util.PendingItem; import eu.siacs.conversations.ui.util.PendingItem;
import eu.siacs.conversations.ui.widget.DisabledActionModeCallback;
import eu.siacs.conversations.utils.CryptoHelper; import eu.siacs.conversations.utils.CryptoHelper;
import eu.siacs.conversations.utils.UIHelper; import eu.siacs.conversations.utils.UIHelper;
import eu.siacs.conversations.utils.XmppUri; import eu.siacs.conversations.utils.XmppUri;
@ -638,26 +634,27 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
@Override @Override
protected void onStart() { protected void onStart() {
super.onStart(); super.onStart();
final Intent intent = getIntent();
final int theme = findTheme(); final int theme = findTheme();
if (this.mTheme != theme) { if (this.mTheme != theme) {
recreate(); recreate();
} else if (getIntent() != null) { } else if (intent != null) {
try { try {
this.jidToEdit = Jid.of(getIntent().getStringExtra("jid")); this.jidToEdit = Jid.of(intent.getStringExtra("jid"));
} catch (final IllegalArgumentException | NullPointerException ignored) { } catch (final IllegalArgumentException | NullPointerException ignored) {
this.jidToEdit = null; this.jidToEdit = null;
} }
if (jidToEdit != null && getIntent().getData() != null) { if (jidToEdit != null && intent.getData() != null && intent.getBooleanExtra("scanned", false)) {
final XmppUri uri = new XmppUri(getIntent().getData()); final XmppUri uri = new XmppUri(intent.getData());
if (xmppConnectionServiceBound) { if (xmppConnectionServiceBound) {
processFingerprintVerification(uri, false); processFingerprintVerification(uri, false);
} else { } else {
this.pendingUri = uri; this.pendingUri = uri;
} }
} }
boolean init = getIntent().getBooleanExtra("init", false); boolean init = intent.getBooleanExtra("init", false);
this.mInitMode = init || this.jidToEdit == null; this.mInitMode = init || this.jidToEdit == null;
this.messageFingerprint = getIntent().getStringExtra("fingerprint"); this.messageFingerprint = intent.getStringExtra("fingerprint");
if (!mInitMode) { if (!mInitMode) {
this.binding.accountRegisterNew.setVisibility(View.GONE); this.binding.accountRegisterNew.setVisibility(View.GONE);
if (getSupportActionBar() != null) { if (getSupportActionBar() != null) {

View File

@ -110,6 +110,7 @@ public class UriHandlerActivity extends AppCompatActivity {
intent.setAction(Intent.ACTION_VIEW); intent.setAction(Intent.ACTION_VIEW);
intent.putExtra("jid", xmppUri.getJid().asBareJid().toString()); intent.putExtra("jid", xmppUri.getJid().asBareJid().toString());
intent.setData(uri); intent.setData(uri);
intent.putExtra("scanned", scanned);
} else if (xmppUri.isJidValid()) { } else if (xmppUri.isJidValid()) {
intent = new Intent(getApplicationContext(), StartConversationActivity.class); intent = new Intent(getApplicationContext(), StartConversationActivity.class);
intent.setAction(Intent.ACTION_VIEW); intent.setAction(Intent.ACTION_VIEW);