dont auto show fingerprint if lock is initiated

This commit is contained in:
Kyle Spearrin 2019-06-01 01:07:02 -04:00
parent 4ae02c27a4
commit 5ce2eaf77e
7 changed files with 25 additions and 19 deletions

View file

@ -90,7 +90,8 @@ namespace Bit.App
else if(message.Command == "locked")
{
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")
{

View file

@ -8,11 +8,13 @@ namespace Bit.App.Pages
public partial class LockPage : BaseContentPage
{
private readonly AppOptions _appOptions;
private readonly bool _autoPromptFingerprint;
private readonly LockPageViewModel _vm;
public LockPage(AppOptions appOptions = null)
public LockPage(AppOptions appOptions = null, bool autoPromptFingerprint = true)
{
_appOptions = appOptions;
_autoPromptFingerprint = autoPromptFingerprint;
InitializeComponent();
_vm = BindingContext as LockPageViewModel;
_vm.Page = this;
@ -43,7 +45,7 @@ namespace Bit.App.Pages
protected override async void OnAppearing()
{
base.OnAppearing();
await _vm.InitAsync();
await _vm.InitAsync(_autoPromptFingerprint);
if(!_vm.FingerprintLock)
{
if(_vm.PinLock)

View file

@ -97,7 +97,7 @@ namespace Bit.App.Pages
public string Pin { get; set; }
public Action UnlockedAction { get; set; }
public async Task InitAsync()
public async Task InitAsync(bool autoPromptFingerprint)
{
_pinSet = await _lockService.IsPinLockSetAsync();
_hasKey = await _cryptoService.HasKeyAsync();
@ -120,11 +120,14 @@ namespace Bit.App.Pages
{
FingerprintButtonText = _deviceActionService.SupportsFaceId() ? AppResources.UseFaceIDToUnlock :
AppResources.UseFingerprintToUnlock;
var tasks = Task.Run(async () =>
if(autoPromptFingerprint)
{
await Task.Delay(500);
Device.BeginInvokeOnMainThread(async () => await PromptFingerprintAsync());
});
var tasks = Task.Run(async () =>
{
await Task.Delay(500);
Device.BeginInvokeOnMainThread(async () => await PromptFingerprintAsync());
});
}
}
}

View file

@ -182,7 +182,7 @@ namespace Bit.App.Pages
public async Task LockAsync()
{
await _lockService.LockAsync(true);
await _lockService.LockAsync(true, true);
}
public async Task LockOptionsAsync()

View file

@ -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())
{
@ -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();
}
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();
}
private async void AddButton_Clicked(object sender, System.EventArgs e)
private async void AddButton_Clicked(object sender, EventArgs e)
{
if(DoOnce())
{

View file

@ -13,7 +13,7 @@ namespace Bit.Core.Abstractions
Task<bool> IsLockedAsync();
Task<Tuple<bool, bool>> IsPinLockSetAsync();
Task<bool> IsFingerprintLockSetAsync();
Task LockAsync(bool allowSoftLock = false);
Task LockAsync(bool allowSoftLock = false, bool userInitiated = false);
Task SetLockOptionAsync(int? lockOption);
}
}

View file

@ -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();
if(!authed)
@ -119,7 +119,7 @@ namespace Bit.Core.Services
}
if(FingerprintLocked || PinLocked)
{
_messagingService.Send("locked");
_messagingService.Send("locked", userInitiated);
// TODO: locked callback?
return;
}
@ -134,7 +134,7 @@ namespace Bit.Core.Services
_cipherService.ClearCache();
_collectionService.ClearCache();
_searchService.ClearIndex();
_messagingService.Send("locked");
_messagingService.Send("locked", userInitiated);
// TODO: locked callback?
}