mirror of
https://github.com/bitwarden/android.git
synced 2024-12-25 18:38:27 +03:00
remove lock service logging
This commit is contained in:
parent
d64625aba2
commit
83bc7c6d51
1 changed files with 0 additions and 22 deletions
|
@ -65,69 +65,50 @@ namespace Bit.Core.Services
|
||||||
|
|
||||||
public async Task CheckLockAsync()
|
public async Task CheckLockAsync()
|
||||||
{
|
{
|
||||||
var logService = ServiceContainer.Resolve<ILogService>("logService");
|
|
||||||
logService.Info("CheckLockAsync 1");
|
|
||||||
if(_platformUtilsService.IsViewOpen())
|
if(_platformUtilsService.IsViewOpen())
|
||||||
{
|
{
|
||||||
logService.Info("CheckLockAsync 2");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var authed = await _userService.IsAuthenticatedAsync();
|
var authed = await _userService.IsAuthenticatedAsync();
|
||||||
if(!authed)
|
if(!authed)
|
||||||
{
|
{
|
||||||
logService.Info("CheckLockAsync 3");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(await IsLockedAsync())
|
if(await IsLockedAsync())
|
||||||
{
|
{
|
||||||
logService.Info("CheckLockAsync 4");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
logService.Info("CheckLockAsync 5");
|
|
||||||
var lockOption = _platformUtilsService.LockTimeout();
|
var lockOption = _platformUtilsService.LockTimeout();
|
||||||
if(lockOption == null)
|
if(lockOption == null)
|
||||||
{
|
{
|
||||||
logService.Info("CheckLockAsync 6");
|
|
||||||
lockOption = await _storageService.GetAsync<int?>(Constants.LockOptionKey);
|
lockOption = await _storageService.GetAsync<int?>(Constants.LockOptionKey);
|
||||||
}
|
}
|
||||||
logService.Info("CheckLockAsync 7");
|
|
||||||
if(lockOption.GetValueOrDefault(-1) < 0)
|
if(lockOption.GetValueOrDefault(-1) < 0)
|
||||||
{
|
{
|
||||||
logService.Info("CheckLockAsync 8");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
logService.Info("CheckLockAsync 9");
|
|
||||||
var lastActive = await _storageService.GetAsync<DateTime?>(Constants.LastActiveKey);
|
var lastActive = await _storageService.GetAsync<DateTime?>(Constants.LastActiveKey);
|
||||||
if(lastActive == null)
|
if(lastActive == null)
|
||||||
{
|
{
|
||||||
logService.Info("CheckLockAsync 10");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
logService.Info("CheckLockAsync 11");
|
|
||||||
var diff = DateTime.UtcNow - lastActive.Value;
|
var diff = DateTime.UtcNow - lastActive.Value;
|
||||||
if(diff.TotalSeconds >= lockOption.Value)
|
if(diff.TotalSeconds >= lockOption.Value)
|
||||||
{
|
{
|
||||||
logService.Info("CheckLockAsync 12");
|
|
||||||
// need to lock now
|
// need to lock now
|
||||||
await LockAsync(true);
|
await LockAsync(true);
|
||||||
}
|
}
|
||||||
logService.Info("CheckLockAsync 13");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task LockAsync(bool allowSoftLock = false, bool userInitiated = false)
|
public async Task LockAsync(bool allowSoftLock = false, bool userInitiated = false)
|
||||||
{
|
{
|
||||||
var logService = ServiceContainer.Resolve<ILogService>("logService");
|
|
||||||
logService.Info("LockAsync 1");
|
|
||||||
var authed = await _userService.IsAuthenticatedAsync();
|
var authed = await _userService.IsAuthenticatedAsync();
|
||||||
if(!authed)
|
if(!authed)
|
||||||
{
|
{
|
||||||
logService.Info("LockAsync 2");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
logService.Info("LockAsync 3");
|
|
||||||
if(allowSoftLock)
|
if(allowSoftLock)
|
||||||
{
|
{
|
||||||
logService.Info("LockAsync 4");
|
|
||||||
var pinSet = await IsPinLockSetAsync();
|
var pinSet = await IsPinLockSetAsync();
|
||||||
if(pinSet.Item1)
|
if(pinSet.Item1)
|
||||||
{
|
{
|
||||||
|
@ -139,13 +120,11 @@ namespace Bit.Core.Services
|
||||||
}
|
}
|
||||||
if(FingerprintLocked || PinLocked)
|
if(FingerprintLocked || PinLocked)
|
||||||
{
|
{
|
||||||
logService.Info("LockAsync 5");
|
|
||||||
_messagingService.Send("locked", userInitiated);
|
_messagingService.Send("locked", userInitiated);
|
||||||
// TODO: locked callback?
|
// TODO: locked callback?
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
logService.Info("LockAsync 6");
|
|
||||||
await Task.WhenAll(
|
await Task.WhenAll(
|
||||||
_cryptoService.ClearKeyAsync(),
|
_cryptoService.ClearKeyAsync(),
|
||||||
_cryptoService.ClearOrgKeysAsync(true),
|
_cryptoService.ClearOrgKeysAsync(true),
|
||||||
|
@ -158,7 +137,6 @@ namespace Bit.Core.Services
|
||||||
_searchService.ClearIndex();
|
_searchService.ClearIndex();
|
||||||
_messagingService.Send("locked", userInitiated);
|
_messagingService.Send("locked", userInitiated);
|
||||||
// TODO: locked callback?
|
// TODO: locked callback?
|
||||||
logService.Info("LockAsync 7");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task SetLockOptionAsync(int? lockOption)
|
public async Task SetLockOptionAsync(int? lockOption)
|
||||||
|
|
Loading…
Reference in a new issue