diff --git a/src/Core/Controls/CipherViewCell/CipherViewCell.xaml.cs b/src/Core/Controls/CipherViewCell/CipherViewCell.xaml.cs index 1fc0e6797..664bcfbe1 100644 --- a/src/Core/Controls/CipherViewCell/CipherViewCell.xaml.cs +++ b/src/Core/Controls/CipherViewCell/CipherViewCell.xaml.cs @@ -1,10 +1,7 @@ -using System; -using System.Windows.Input; +using System.Windows.Input; using Bit.App.Abstractions; using Bit.Core.Models.View; using Bit.Core.Utilities; -using Microsoft.Maui.Controls; -using Microsoft.Maui; namespace Bit.App.Controls { @@ -26,7 +23,7 @@ namespace Bit.App.Controls { InitializeComponent(); - var fontScale = ServiceContainer.Resolve("deviceActionService").GetSystemFontSizeScale(); + var fontScale = ServiceContainer.Resolve().GetSystemFontSizeScale(); _iconColumn.Width = new GridLength(ICON_COLUMN_DEFAULT_WIDTH * fontScale, GridUnitType.Absolute); _iconImage.WidthRequest = ICON_IMAGE_DEFAULT_WIDTH * fontScale; _iconImage.HeightRequest = ICON_IMAGE_DEFAULT_WIDTH * fontScale; @@ -53,21 +50,10 @@ namespace Bit.App.Controls protected override void OnPropertyChanged(string propertyName = null) { base.OnPropertyChanged(propertyName); - if (propertyName == CipherProperty.PropertyName) + + if (BindingContext is CipherViewCellViewModel cipherViewCellViewModel && propertyName == WebsiteIconsEnabledProperty.PropertyName) { - if (Cipher == null) - { - return; - } - BindingContext = new CipherViewCellViewModel(Cipher, WebsiteIconsEnabled ?? false); - } - else if (propertyName == WebsiteIconsEnabledProperty.PropertyName) - { - if (Cipher == null) - { - return; - } - ((CipherViewCellViewModel)BindingContext).WebsiteIconsEnabled = WebsiteIconsEnabled ?? false; + cipherViewCellViewModel.WebsiteIconsEnabled = WebsiteIconsEnabled ?? false; } } diff --git a/src/Core/Controls/CipherViewCell/CipherViewCellViewModel.cs b/src/Core/Controls/CipherViewCell/CipherViewCellViewModel.cs index b5150b003..0ef7754db 100644 --- a/src/Core/Controls/CipherViewCell/CipherViewCellViewModel.cs +++ b/src/Core/Controls/CipherViewCell/CipherViewCellViewModel.cs @@ -1,9 +1,24 @@ -using Bit.App.Utilities; +using System.Globalization; +using Bit.App.Utilities; using Bit.Core.Models.View; using Bit.Core.Utilities; namespace Bit.App.Controls { + public class CipherViewToCipherViewCellViewModelConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (value is CipherView cipher) + { + return new CipherViewCellViewModel(cipher, false); + } + return null; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => throw new NotImplementedException(); + } + public class CipherViewCellViewModel : ExtendedViewModel { private CipherView _cipher; diff --git a/src/Core/Pages/Vault/CipherSelectionPage.xaml b/src/Core/Pages/Vault/CipherSelectionPage.xaml index d53648872..e9b91bbe2 100644 --- a/src/Core/Pages/Vault/CipherSelectionPage.xaml +++ b/src/Core/Pages/Vault/CipherSelectionPage.xaml @@ -28,6 +28,7 @@ + diff --git a/src/Core/Pages/Vault/CiphersPage.xaml b/src/Core/Pages/Vault/CiphersPage.xaml index ec0565c50..8e089d6be 100644 --- a/src/Core/Pages/Vault/CiphersPage.xaml +++ b/src/Core/Pages/Vault/CiphersPage.xaml @@ -18,6 +18,8 @@ + + - + + + + diff --git a/src/Core/Pages/Vault/GroupingsPage/GroupingsPage.xaml b/src/Core/Pages/Vault/GroupingsPage/GroupingsPage.xaml index 1fac9c61f..530a939c7 100644 --- a/src/Core/Pages/Vault/GroupingsPage/GroupingsPage.xaml +++ b/src/Core/Pages/Vault/GroupingsPage/GroupingsPage.xaml @@ -32,7 +32,7 @@ - + @@ -47,7 +47,7 @@ diff --git a/src/Core/Pages/Vault/GroupingsPage/GroupingsPageViewModel.cs b/src/Core/Pages/Vault/GroupingsPage/GroupingsPageViewModel.cs index 91e929f92..bf0e3304a 100644 --- a/src/Core/Pages/Vault/GroupingsPage/GroupingsPageViewModel.cs +++ b/src/Core/Pages/Vault/GroupingsPage/GroupingsPageViewModel.cs @@ -1,22 +1,14 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; -using System.Windows.Input; +using System.Windows.Input; using Bit.App.Abstractions; using Bit.App.Controls; -using Bit.Core.Resources.Localization; using Bit.App.Utilities; using Bit.Core.Abstractions; using Bit.Core.Enums; using Bit.Core.Models.Domain; using Bit.Core.Models.View; +using Bit.Core.Resources.Localization; using Bit.Core.Utilities; -using Microsoft.Maui.Controls; -using Microsoft.Maui; - namespace Bit.App.Pages { public class GroupingsPageViewModel : VaultFilterViewModel