1
0
mirror of https://github.com/bitwarden/mobile.git synced 2024-12-28 17:18:23 +01:00

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)));
}