mirror of
https://github.com/bitwarden/mobile.git
synced 2024-09-12 01:28:26 +02:00
compare with _lastNotificationUri
This commit is contained in:
parent
f494570725
commit
e651a13980
@ -56,7 +56,8 @@ namespace Bit.Android
|
|||||||
}.ToDictionary(n => n.PackageName);
|
}.ToDictionary(n => n.PackageName);
|
||||||
|
|
||||||
private readonly IAppSettingsService _appSettings;
|
private readonly IAppSettingsService _appSettings;
|
||||||
private long _lastNotification = 0;
|
private long _lastNotificationTime = 0;
|
||||||
|
private string _lastNotificationUri = null;
|
||||||
|
|
||||||
public AutofillService()
|
public AutofillService()
|
||||||
{
|
{
|
||||||
@ -110,8 +111,18 @@ namespace Bit.Android
|
|||||||
}
|
}
|
||||||
else if(_appSettings.AutofillPasswordField && AutofillActivity.LastCredentials == null)
|
else if(_appSettings.AutofillPasswordField && AutofillActivity.LastCredentials == null)
|
||||||
{
|
{
|
||||||
CancelNotification(notificationManager);
|
if(string.IsNullOrWhiteSpace(_lastNotificationUri))
|
||||||
break;
|
{
|
||||||
|
CancelNotification(notificationManager);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
var uri = GetUri(root);
|
||||||
|
if(uri != _lastNotificationUri)
|
||||||
|
{
|
||||||
|
CancelNotification(notificationManager);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(e.PackageName == BitwardenPackage)
|
if(e.PackageName == BitwardenPackage)
|
||||||
@ -138,8 +149,8 @@ namespace Bit.Android
|
|||||||
|
|
||||||
allEditTexts.Dispose();
|
allEditTexts.Dispose();
|
||||||
usernameEditText.Dispose();
|
usernameEditText.Dispose();
|
||||||
passwordNodes.Dispose();
|
|
||||||
}
|
}
|
||||||
|
passwordNodes.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!needToFill)
|
if(!needToFill)
|
||||||
@ -211,11 +222,12 @@ namespace Bit.Android
|
|||||||
|
|
||||||
public void CancelNotification(NotificationManager notificationManager)
|
public void CancelNotification(NotificationManager notificationManager)
|
||||||
{
|
{
|
||||||
if(Java.Lang.JavaSystem.CurrentTimeMillis() - _lastNotification < 250)
|
if(Java.Lang.JavaSystem.CurrentTimeMillis() - _lastNotificationTime < 250)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_lastNotificationUri = null;
|
||||||
notificationManager?.Cancel(AutoFillNotificationId);
|
notificationManager?.Cancel(AutoFillNotificationId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -324,7 +336,8 @@ namespace Bit.Android
|
|||||||
builder.SetPriority(-1);
|
builder.SetPriority(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
_lastNotification = now;
|
_lastNotificationTime = now;
|
||||||
|
_lastNotificationUri = uri;
|
||||||
notificationManager.Notify(AutoFillNotificationId, builder.Build());
|
notificationManager.Notify(AutoFillNotificationId, builder.Build());
|
||||||
|
|
||||||
builder.Dispose();
|
builder.Dispose();
|
||||||
|
Loading…
Reference in New Issue
Block a user