mirror of
https://github.com/bitwarden/mobile.git
synced 2024-11-25 12:05:59 +01:00
This reverts commit 0288a6659c
.
This commit is contained in:
parent
1d541e5b8e
commit
4abb472998
@ -44,7 +44,6 @@ namespace Bit.Droid
|
||||
private IAppIdService _appIdService;
|
||||
private IEventService _eventService;
|
||||
private IPushNotificationListenerService _pushNotificationListenerService;
|
||||
private IVaultTimeoutService _vaultTimeoutService;
|
||||
private ILogger _logger;
|
||||
private PendingIntent _eventUploadPendingIntent;
|
||||
private AppOptions _appOptions;
|
||||
@ -69,7 +68,6 @@ namespace Bit.Droid
|
||||
_appIdService = ServiceContainer.Resolve<IAppIdService>("appIdService");
|
||||
_eventService = ServiceContainer.Resolve<IEventService>("eventService");
|
||||
_pushNotificationListenerService = ServiceContainer.Resolve<IPushNotificationListenerService>();
|
||||
_vaultTimeoutService = ServiceContainer.Resolve<IVaultTimeoutService>();
|
||||
_logger = ServiceContainer.Resolve<ILogger>("logger");
|
||||
|
||||
TabLayoutResource = Resource.Layout.Tabbar;
|
||||
@ -234,7 +232,6 @@ namespace Bit.Droid
|
||||
|
||||
protected override void OnActivityResult(int requestCode, Result resultCode, Intent data)
|
||||
{
|
||||
_vaultTimeoutService.ResetTimeoutDelay = true;
|
||||
if (resultCode == Result.Ok &&
|
||||
(requestCode == Core.Constants.SelectFileRequestCode || requestCode == Core.Constants.SaveFileRequestCode))
|
||||
{
|
||||
|
@ -297,7 +297,7 @@ namespace Bit.App
|
||||
{
|
||||
await _vaultTimeoutService.CheckVaultTimeoutAsync();
|
||||
// Reset delay on every start
|
||||
_vaultTimeoutService.DelayTimeoutMs = null;
|
||||
_vaultTimeoutService.DelayLockAndLogoutMs = null;
|
||||
}
|
||||
|
||||
await _configService.GetAsync();
|
||||
|
@ -156,7 +156,7 @@ namespace Bit.App.Pages
|
||||
// Prevent Android from locking if vault timeout set to "immediate"
|
||||
if (Device.RuntimePlatform == Device.Android)
|
||||
{
|
||||
_vaultTimeoutService.DelayTimeoutMs = 60000;
|
||||
_vaultTimeoutService.DelayLockAndLogoutMs = 60000;
|
||||
}
|
||||
await _fileService.SelectFileAsync();
|
||||
}
|
||||
|
@ -6,8 +6,7 @@ namespace Bit.Core.Abstractions
|
||||
{
|
||||
public interface IVaultTimeoutService
|
||||
{
|
||||
long? DelayTimeoutMs { get; set; }
|
||||
bool ResetTimeoutDelay { get; set; }
|
||||
long? DelayLockAndLogoutMs { get; set; }
|
||||
|
||||
Task CheckVaultTimeoutAsync();
|
||||
Task<bool> ShouldTimeoutAsync(string userId = null);
|
||||
|
@ -50,8 +50,7 @@ namespace Bit.Core.Services
|
||||
_loggedOutCallback = loggedOutCallback;
|
||||
}
|
||||
|
||||
public long? DelayTimeoutMs { get; set; }
|
||||
public bool ResetTimeoutDelay { get; set; }
|
||||
public long? DelayLockAndLogoutMs { get; set; }
|
||||
|
||||
public async Task<bool> IsLockedAsync(string userId = null)
|
||||
{
|
||||
@ -118,7 +117,7 @@ namespace Bit.Core.Services
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (vaultTimeoutMinutes == 0 && !DelayTimeoutMs.HasValue)
|
||||
if (vaultTimeoutMinutes == 0 && !DelayLockAndLogoutMs.HasValue)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -128,13 +127,8 @@ namespace Bit.Core.Services
|
||||
return false;
|
||||
}
|
||||
var diffMs = _platformUtilsService.GetActiveTime() - lastActiveTime;
|
||||
if (DelayTimeoutMs.HasValue && diffMs < DelayTimeoutMs)
|
||||
if (DelayLockAndLogoutMs.HasValue && diffMs < DelayLockAndLogoutMs)
|
||||
{
|
||||
if (ResetTimeoutDelay)
|
||||
{
|
||||
DelayTimeoutMs = null;
|
||||
ResetTimeoutDelay = false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
var vaultTimeoutMs = vaultTimeoutMinutes * 60000;
|
||||
|
Loading…
Reference in New Issue
Block a user