Add support for deeplinking otpauth uris

Fix bug
This commit is contained in:
Michael Schättgen 2019-08-02 22:36:12 +02:00
parent 5524a77736
commit 8d3c113475
2 changed files with 34 additions and 0 deletions

View file

@ -387,6 +387,33 @@ public class MainActivity extends AegisActivity implements EntryListView.Listene
intent.removeExtra("action");
}
private void handleDeeplink() {
if (_db.isLocked()) {
return;
}
Intent intent = getIntent();
if (Intent.ACTION_VIEW.equals(intent.getAction())) {
Uri uri = intent.getData();
getIntent().setData(null);
getIntent().setAction(null);
GoogleAuthInfo info = null;
try {
info = GoogleAuthInfo.parseUri(uri);
} catch (GoogleAuthInfoException e) {
Toast.makeText(this, getString(R.string.unable_to_read_qrcode), Toast.LENGTH_SHORT).show();
e.printStackTrace();
}
if (info != null) {
DatabaseEntry entry = new DatabaseEntry(info);
startEditProfileActivity(CODE_ADD_ENTRY, entry, true);
}
}
}
@Override
protected void onResume() {
super.onResume();
@ -416,6 +443,7 @@ public class MainActivity extends AegisActivity implements EntryListView.Listene
loadEntries();
}
handleDeeplink();
updateLockIcon();
doShortcutActions();
}