diff --git a/src/App/Controls/CipherViewCell/CipherViewCell.xaml.cs b/src/App/Controls/CipherViewCell/CipherViewCell.xaml.cs index f454f2b55..86e43e022 100644 --- a/src/App/Controls/CipherViewCell/CipherViewCell.xaml.cs +++ b/src/App/Controls/CipherViewCell/CipherViewCell.xaml.cs @@ -1,4 +1,5 @@ using System; +using System.Windows.Input; using Bit.App.Abstractions; using Bit.Core.Models.View; using Bit.Core.Utilities; @@ -18,7 +19,7 @@ namespace Bit.App.Controls nameof(WebsiteIconsEnabled), typeof(bool?), typeof(CipherViewCell)); public static readonly BindableProperty ButtonCommandProperty = BindableProperty.Create( - nameof(ButtonCommand), typeof(Command), typeof(CipherViewCell)); + nameof(ButtonCommand), typeof(ICommand), typeof(CipherViewCell)); public CipherViewCell() { @@ -42,9 +43,9 @@ namespace Bit.App.Controls set => SetValue(CipherProperty, value); } - public Command ButtonCommand + public ICommand ButtonCommand { - get => GetValue(ButtonCommandProperty) as Command; + get => GetValue(ButtonCommandProperty) as ICommand; set => SetValue(ButtonCommandProperty, value); } diff --git a/src/App/Pages/Vault/GroupingsPage/GroupingsPageViewModel.cs b/src/App/Pages/Vault/GroupingsPage/GroupingsPageViewModel.cs index 36b7d71da..8b4af6a02 100644 --- a/src/App/Pages/Vault/GroupingsPage/GroupingsPageViewModel.cs +++ b/src/App/Pages/Vault/GroupingsPage/GroupingsPageViewModel.cs @@ -78,7 +78,9 @@ namespace Bit.App.Pages Refreshing = true; await LoadAsync(); }); - CipherOptionsCommand = new Command(CipherOptionsAsync); + CipherOptionsCommand = new AsyncCommand(cipher => AppHelpers.CipherListOptions(Page, cipher, _passwordRepromptService), + onException: ex => _logger.Exception(ex), + allowsMultipleExecutions: false); VaultFilterCommand = new AsyncCommand(VaultFilterOptionsAsync, onException: ex => _logger.Exception(ex), allowsMultipleExecutions: false); @@ -168,7 +170,7 @@ namespace Bit.App.Pages public AccountSwitchingOverlayViewModel AccountSwitchingOverlayViewModel { get; } public ObservableRangeCollection GroupedItems { get; set; } public Command RefreshCommand { get; set; } - public Command CipherOptionsCommand { get; set; } + public ICommand CipherOptionsCommand { get; } public bool LoadedOnce { get; set; } public async Task LoadAsync() @@ -709,13 +711,5 @@ namespace Bit.App.Pages var folders = decFolders.Where(f => _allCiphers.Any(c => c.FolderId == f.Id)).ToList(); return folders.Any() ? folders : null; } - - private async void CipherOptionsAsync(CipherView cipher) - { - if ((Page as BaseContentPage).DoOnce()) - { - await AppHelpers.CipherListOptions(Page, cipher, _passwordRepromptService); - } - } } }