1
0
mirror of https://github.com/bitwarden/mobile synced 2025-12-15 15:53:44 +00:00

Revert "reset lock delay when returning from activity result (#2539)" (#2597)

This reverts commit 0288a6659c.
This commit is contained in:
mpbw2
2023-07-03 09:56:10 -04:00
committed by GitHub
parent 1d541e5b8e
commit 4abb472998
5 changed files with 6 additions and 16 deletions

View File

@@ -44,7 +44,6 @@ namespace Bit.Droid
private IAppIdService _appIdService; private IAppIdService _appIdService;
private IEventService _eventService; private IEventService _eventService;
private IPushNotificationListenerService _pushNotificationListenerService; private IPushNotificationListenerService _pushNotificationListenerService;
private IVaultTimeoutService _vaultTimeoutService;
private ILogger _logger; private ILogger _logger;
private PendingIntent _eventUploadPendingIntent; private PendingIntent _eventUploadPendingIntent;
private AppOptions _appOptions; private AppOptions _appOptions;
@@ -69,7 +68,6 @@ namespace Bit.Droid
_appIdService = ServiceContainer.Resolve<IAppIdService>("appIdService"); _appIdService = ServiceContainer.Resolve<IAppIdService>("appIdService");
_eventService = ServiceContainer.Resolve<IEventService>("eventService"); _eventService = ServiceContainer.Resolve<IEventService>("eventService");
_pushNotificationListenerService = ServiceContainer.Resolve<IPushNotificationListenerService>(); _pushNotificationListenerService = ServiceContainer.Resolve<IPushNotificationListenerService>();
_vaultTimeoutService = ServiceContainer.Resolve<IVaultTimeoutService>();
_logger = ServiceContainer.Resolve<ILogger>("logger"); _logger = ServiceContainer.Resolve<ILogger>("logger");
TabLayoutResource = Resource.Layout.Tabbar; TabLayoutResource = Resource.Layout.Tabbar;
@@ -234,7 +232,6 @@ namespace Bit.Droid
protected override void OnActivityResult(int requestCode, Result resultCode, Intent data) protected override void OnActivityResult(int requestCode, Result resultCode, Intent data)
{ {
_vaultTimeoutService.ResetTimeoutDelay = true;
if (resultCode == Result.Ok && if (resultCode == Result.Ok &&
(requestCode == Core.Constants.SelectFileRequestCode || requestCode == Core.Constants.SaveFileRequestCode)) (requestCode == Core.Constants.SelectFileRequestCode || requestCode == Core.Constants.SaveFileRequestCode))
{ {

View File

@@ -297,7 +297,7 @@ namespace Bit.App
{ {
await _vaultTimeoutService.CheckVaultTimeoutAsync(); await _vaultTimeoutService.CheckVaultTimeoutAsync();
// Reset delay on every start // Reset delay on every start
_vaultTimeoutService.DelayTimeoutMs = null; _vaultTimeoutService.DelayLockAndLogoutMs = null;
} }
await _configService.GetAsync(); await _configService.GetAsync();

View File

@@ -156,7 +156,7 @@ namespace Bit.App.Pages
// Prevent Android from locking if vault timeout set to "immediate" // Prevent Android from locking if vault timeout set to "immediate"
if (Device.RuntimePlatform == Device.Android) if (Device.RuntimePlatform == Device.Android)
{ {
_vaultTimeoutService.DelayTimeoutMs = 60000; _vaultTimeoutService.DelayLockAndLogoutMs = 60000;
} }
await _fileService.SelectFileAsync(); await _fileService.SelectFileAsync();
} }

View File

@@ -6,8 +6,7 @@ namespace Bit.Core.Abstractions
{ {
public interface IVaultTimeoutService public interface IVaultTimeoutService
{ {
long? DelayTimeoutMs { get; set; } long? DelayLockAndLogoutMs { get; set; }
bool ResetTimeoutDelay { get; set; }
Task CheckVaultTimeoutAsync(); Task CheckVaultTimeoutAsync();
Task<bool> ShouldTimeoutAsync(string userId = null); Task<bool> ShouldTimeoutAsync(string userId = null);

View File

@@ -50,8 +50,7 @@ namespace Bit.Core.Services
_loggedOutCallback = loggedOutCallback; _loggedOutCallback = loggedOutCallback;
} }
public long? DelayTimeoutMs { get; set; } public long? DelayLockAndLogoutMs { get; set; }
public bool ResetTimeoutDelay { get; set; }
public async Task<bool> IsLockedAsync(string userId = null) public async Task<bool> IsLockedAsync(string userId = null)
{ {
@@ -118,7 +117,7 @@ namespace Bit.Core.Services
{ {
return false; return false;
} }
if (vaultTimeoutMinutes == 0 && !DelayTimeoutMs.HasValue) if (vaultTimeoutMinutes == 0 && !DelayLockAndLogoutMs.HasValue)
{ {
return true; return true;
} }
@@ -128,13 +127,8 @@ namespace Bit.Core.Services
return false; return false;
} }
var diffMs = _platformUtilsService.GetActiveTime() - lastActiveTime; var diffMs = _platformUtilsService.GetActiveTime() - lastActiveTime;
if (DelayTimeoutMs.HasValue && diffMs < DelayTimeoutMs) if (DelayLockAndLogoutMs.HasValue && diffMs < DelayLockAndLogoutMs)
{ {
if (ResetTimeoutDelay)
{
DelayTimeoutMs = null;
ResetTimeoutDelay = false;
}
return false; return false;
} }
var vaultTimeoutMs = vaultTimeoutMinutes * 60000; var vaultTimeoutMs = vaultTimeoutMinutes * 60000;