mirror of
https://github.com/bitwarden/android.git
synced 2024-12-18 15:21:53 +03:00
autofill intent is only valid for limited time
This commit is contained in:
parent
e970ca49e8
commit
ab629c2048
2 changed files with 11 additions and 5 deletions
|
@ -95,6 +95,7 @@ namespace Bit.Android
|
|||
|
||||
var intent = new Intent(this, typeof(MainActivity));
|
||||
intent.PutExtra("uri", _lastQueriedUri);
|
||||
intent.PutExtra("ts", Java.Lang.JavaSystem.CurrentTimeMillis());
|
||||
StartActivityForResult(intent, requestCode);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,18 +28,23 @@ namespace Bit.Android
|
|||
|
||||
protected override void OnCreate(Bundle bundle)
|
||||
{
|
||||
var uri = Intent.Flags.HasFlag(ActivityFlags.LaunchedFromHistory) ? null : Intent.GetStringExtra("uri");
|
||||
if(Intent.HasExtra("uri"))
|
||||
string uri = null;
|
||||
if(!Intent.Flags.HasFlag(ActivityFlags.LaunchedFromHistory) && Intent.HasExtra("uri") && Intent.HasExtra("ts"))
|
||||
{
|
||||
// Clear intent for future. ref: http://stackoverflow.com/a/29947867/1090359
|
||||
Intent.RemoveExtra("uri");
|
||||
var tsDiff = Java.Lang.JavaSystem.CurrentTimeMillis() - Intent.GetLongExtra("ts", 0);
|
||||
if(tsDiff < 5000)
|
||||
{
|
||||
uri = Intent.GetStringExtra("uri");
|
||||
}
|
||||
|
||||
// Attempt to clear intent for future
|
||||
Intent.ReplaceExtras(new Bundle());
|
||||
Intent.SetAction(string.Empty);
|
||||
Intent.SetData(null);
|
||||
Intent.SetFlags(0);
|
||||
}
|
||||
|
||||
if(uri != null && !Resolver.IsSet)
|
||||
if(!Resolver.IsSet)
|
||||
{
|
||||
MainApplication.SetIoc(Application);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue