Prevent actionsheet command execution if vault is locked (#857)

This commit is contained in:
Matt Portune 2020-04-28 10:25:13 -04:00 committed by GitHub
parent cb0a3e3edf
commit 1d48171fd5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -18,6 +18,7 @@ namespace Bit.App.Utilities
{
var platformUtilsService = ServiceContainer.Resolve<IPlatformUtilsService>("platformUtilsService");
var eventService = ServiceContainer.Resolve<IEventService>("eventService");
var lockService = ServiceContainer.Resolve<ILockService>("lockService");
var options = new List<string> { AppResources.View, AppResources.Edit };
if (cipher.Type == Core.Enums.CipherType.Login)
{
@ -62,7 +63,11 @@ namespace Bit.App.Utilities
}
}
var selection = await page.DisplayActionSheet(cipher.Name, AppResources.Cancel, null, options.ToArray());
if (selection == AppResources.View)
if (await lockService.IsLockedAsync())
{
platformUtilsService.ShowToast("info", null, AppResources.VaultIsLocked);
}
else if (selection == AppResources.View)
{
await page.Navigation.PushModalAsync(new NavigationPage(new ViewPage(cipher.Id)));
}