mirror of
https://github.com/bitwarden/android.git
synced 2024-12-21 00:31:58 +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));
|
var intent = new Intent(this, typeof(MainActivity));
|
||||||
intent.PutExtra("uri", _lastQueriedUri);
|
intent.PutExtra("uri", _lastQueriedUri);
|
||||||
|
intent.PutExtra("ts", Java.Lang.JavaSystem.CurrentTimeMillis());
|
||||||
StartActivityForResult(intent, requestCode);
|
StartActivityForResult(intent, requestCode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,18 +28,23 @@ namespace Bit.Android
|
||||||
|
|
||||||
protected override void OnCreate(Bundle bundle)
|
protected override void OnCreate(Bundle bundle)
|
||||||
{
|
{
|
||||||
var uri = Intent.Flags.HasFlag(ActivityFlags.LaunchedFromHistory) ? null : Intent.GetStringExtra("uri");
|
string uri = null;
|
||||||
if(Intent.HasExtra("uri"))
|
if(!Intent.Flags.HasFlag(ActivityFlags.LaunchedFromHistory) && Intent.HasExtra("uri") && Intent.HasExtra("ts"))
|
||||||
{
|
{
|
||||||
// Clear intent for future. ref: http://stackoverflow.com/a/29947867/1090359
|
var tsDiff = Java.Lang.JavaSystem.CurrentTimeMillis() - Intent.GetLongExtra("ts", 0);
|
||||||
Intent.RemoveExtra("uri");
|
if(tsDiff < 5000)
|
||||||
|
{
|
||||||
|
uri = Intent.GetStringExtra("uri");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Attempt to clear intent for future
|
||||||
Intent.ReplaceExtras(new Bundle());
|
Intent.ReplaceExtras(new Bundle());
|
||||||
Intent.SetAction(string.Empty);
|
Intent.SetAction(string.Empty);
|
||||||
Intent.SetData(null);
|
Intent.SetData(null);
|
||||||
Intent.SetFlags(0);
|
Intent.SetFlags(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(uri != null && !Resolver.IsSet)
|
if(!Resolver.IsSet)
|
||||||
{
|
{
|
||||||
MainApplication.SetIoc(Application);
|
MainApplication.SetIoc(Application);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue