PM-1615 Fix cipher options not working in lists due to binding failing due to type mismatch. Updated GroupingsPageViewModel to new way of calling as well (#2456)

This commit is contained in:
Federico Maccaroni 2023-03-30 22:47:25 +02:00 committed by GitHub
parent 99ceb8dbc1
commit 120f1d6859
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 13 deletions

View file

@ -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<CipherView>), typeof(CipherViewCell));
nameof(ButtonCommand), typeof(ICommand), typeof(CipherViewCell));
public CipherViewCell()
{
@ -42,9 +43,9 @@ namespace Bit.App.Controls
set => SetValue(CipherProperty, value);
}
public Command<CipherView> ButtonCommand
public ICommand ButtonCommand
{
get => GetValue(ButtonCommandProperty) as Command<CipherView>;
get => GetValue(ButtonCommandProperty) as ICommand;
set => SetValue(ButtonCommandProperty, value);
}

View file

@ -78,7 +78,9 @@ namespace Bit.App.Pages
Refreshing = true;
await LoadAsync();
});
CipherOptionsCommand = new Command<CipherView>(CipherOptionsAsync);
CipherOptionsCommand = new AsyncCommand<CipherView>(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<IGroupingsPageListItem> GroupedItems { get; set; }
public Command RefreshCommand { get; set; }
public Command<CipherView> 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);
}
}
}
}