mirror of
https://github.com/bitwarden/android.git
synced 2024-12-24 18:08:26 +03:00
dont auto show fingerprint if lock is initiated
This commit is contained in:
parent
4ae02c27a4
commit
5ce2eaf77e
7 changed files with 25 additions and 19 deletions
|
@ -90,7 +90,8 @@ namespace Bit.App
|
||||||
else if(message.Command == "locked")
|
else if(message.Command == "locked")
|
||||||
{
|
{
|
||||||
await _stateService.PurgeAsync();
|
await _stateService.PurgeAsync();
|
||||||
Device.BeginInvokeOnMainThread(() => Current.MainPage = new NavigationPage(new LockPage()));
|
var lockPage = new LockPage(null, !(message.Data as bool?).GetValueOrDefault());
|
||||||
|
Device.BeginInvokeOnMainThread(() => Current.MainPage = new NavigationPage(lockPage));
|
||||||
}
|
}
|
||||||
else if(message.Command == "lockVault")
|
else if(message.Command == "lockVault")
|
||||||
{
|
{
|
||||||
|
|
|
@ -8,11 +8,13 @@ namespace Bit.App.Pages
|
||||||
public partial class LockPage : BaseContentPage
|
public partial class LockPage : BaseContentPage
|
||||||
{
|
{
|
||||||
private readonly AppOptions _appOptions;
|
private readonly AppOptions _appOptions;
|
||||||
|
private readonly bool _autoPromptFingerprint;
|
||||||
private readonly LockPageViewModel _vm;
|
private readonly LockPageViewModel _vm;
|
||||||
|
|
||||||
public LockPage(AppOptions appOptions = null)
|
public LockPage(AppOptions appOptions = null, bool autoPromptFingerprint = true)
|
||||||
{
|
{
|
||||||
_appOptions = appOptions;
|
_appOptions = appOptions;
|
||||||
|
_autoPromptFingerprint = autoPromptFingerprint;
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
_vm = BindingContext as LockPageViewModel;
|
_vm = BindingContext as LockPageViewModel;
|
||||||
_vm.Page = this;
|
_vm.Page = this;
|
||||||
|
@ -43,7 +45,7 @@ namespace Bit.App.Pages
|
||||||
protected override async void OnAppearing()
|
protected override async void OnAppearing()
|
||||||
{
|
{
|
||||||
base.OnAppearing();
|
base.OnAppearing();
|
||||||
await _vm.InitAsync();
|
await _vm.InitAsync(_autoPromptFingerprint);
|
||||||
if(!_vm.FingerprintLock)
|
if(!_vm.FingerprintLock)
|
||||||
{
|
{
|
||||||
if(_vm.PinLock)
|
if(_vm.PinLock)
|
||||||
|
|
|
@ -97,7 +97,7 @@ namespace Bit.App.Pages
|
||||||
public string Pin { get; set; }
|
public string Pin { get; set; }
|
||||||
public Action UnlockedAction { get; set; }
|
public Action UnlockedAction { get; set; }
|
||||||
|
|
||||||
public async Task InitAsync()
|
public async Task InitAsync(bool autoPromptFingerprint)
|
||||||
{
|
{
|
||||||
_pinSet = await _lockService.IsPinLockSetAsync();
|
_pinSet = await _lockService.IsPinLockSetAsync();
|
||||||
_hasKey = await _cryptoService.HasKeyAsync();
|
_hasKey = await _cryptoService.HasKeyAsync();
|
||||||
|
@ -120,11 +120,14 @@ namespace Bit.App.Pages
|
||||||
{
|
{
|
||||||
FingerprintButtonText = _deviceActionService.SupportsFaceId() ? AppResources.UseFaceIDToUnlock :
|
FingerprintButtonText = _deviceActionService.SupportsFaceId() ? AppResources.UseFaceIDToUnlock :
|
||||||
AppResources.UseFingerprintToUnlock;
|
AppResources.UseFingerprintToUnlock;
|
||||||
var tasks = Task.Run(async () =>
|
if(autoPromptFingerprint)
|
||||||
{
|
{
|
||||||
await Task.Delay(500);
|
var tasks = Task.Run(async () =>
|
||||||
Device.BeginInvokeOnMainThread(async () => await PromptFingerprintAsync());
|
{
|
||||||
});
|
await Task.Delay(500);
|
||||||
|
Device.BeginInvokeOnMainThread(async () => await PromptFingerprintAsync());
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -182,7 +182,7 @@ namespace Bit.App.Pages
|
||||||
|
|
||||||
public async Task LockAsync()
|
public async Task LockAsync()
|
||||||
{
|
{
|
||||||
await _lockService.LockAsync(true);
|
await _lockService.LockAsync(true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task LockOptionsAsync()
|
public async Task LockOptionsAsync()
|
||||||
|
|
|
@ -147,7 +147,7 @@ namespace Bit.App.Pages
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void Search_Clicked(object sender, System.EventArgs e)
|
private async void Search_Clicked(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if(DoOnce())
|
if(DoOnce())
|
||||||
{
|
{
|
||||||
|
@ -157,22 +157,22 @@ namespace Bit.App.Pages
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void Sync_Clicked(object sender, System.EventArgs e)
|
private async void Sync_Clicked(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
await _vm.SyncAsync();
|
await _vm.SyncAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void Lock_Clicked(object sender, System.EventArgs e)
|
private async void Lock_Clicked(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
await _lockService.LockAsync(true);
|
await _lockService.LockAsync(true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void Exit_Clicked(object sender, System.EventArgs e)
|
private async void Exit_Clicked(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
await _vm.ExitAsync();
|
await _vm.ExitAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void AddButton_Clicked(object sender, System.EventArgs e)
|
private async void AddButton_Clicked(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if(DoOnce())
|
if(DoOnce())
|
||||||
{
|
{
|
||||||
|
|
|
@ -13,7 +13,7 @@ namespace Bit.Core.Abstractions
|
||||||
Task<bool> IsLockedAsync();
|
Task<bool> IsLockedAsync();
|
||||||
Task<Tuple<bool, bool>> IsPinLockSetAsync();
|
Task<Tuple<bool, bool>> IsPinLockSetAsync();
|
||||||
Task<bool> IsFingerprintLockSetAsync();
|
Task<bool> IsFingerprintLockSetAsync();
|
||||||
Task LockAsync(bool allowSoftLock = false);
|
Task LockAsync(bool allowSoftLock = false, bool userInitiated = false);
|
||||||
Task SetLockOptionAsync(int? lockOption);
|
Task SetLockOptionAsync(int? lockOption);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -99,7 +99,7 @@ namespace Bit.Core.Services
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task LockAsync(bool allowSoftLock = false)
|
public async Task LockAsync(bool allowSoftLock = false, bool userInitiated = false)
|
||||||
{
|
{
|
||||||
var authed = await _userService.IsAuthenticatedAsync();
|
var authed = await _userService.IsAuthenticatedAsync();
|
||||||
if(!authed)
|
if(!authed)
|
||||||
|
@ -119,7 +119,7 @@ namespace Bit.Core.Services
|
||||||
}
|
}
|
||||||
if(FingerprintLocked || PinLocked)
|
if(FingerprintLocked || PinLocked)
|
||||||
{
|
{
|
||||||
_messagingService.Send("locked");
|
_messagingService.Send("locked", userInitiated);
|
||||||
// TODO: locked callback?
|
// TODO: locked callback?
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -134,7 +134,7 @@ namespace Bit.Core.Services
|
||||||
_cipherService.ClearCache();
|
_cipherService.ClearCache();
|
||||||
_collectionService.ClearCache();
|
_collectionService.ClearCache();
|
||||||
_searchService.ClearIndex();
|
_searchService.ClearIndex();
|
||||||
_messagingService.Send("locked");
|
_messagingService.Send("locked", userInitiated);
|
||||||
// TODO: locked callback?
|
// TODO: locked callback?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue