mirror of
https://github.com/bitwarden/mobile.git
synced 2024-06-25 10:26:02 +02:00
08f371b0db
* PM-7369 Show passkey icon on android when the item has a Fido2 credential * PM-7369 alternative way to show passkey icon only in scenarios where we are trying to create a passkey * PM-7369 moved logic to show passkey icon to CipherItemViewModel * Update src/Core/Utilities/IconGlyphConverter.cs Co-authored-by: Federico Maccaroni <fedemkr@gmail.com> --------- Co-authored-by: Federico Maccaroni <fedemkr@gmail.com>
40 lines
1.1 KiB
C#
40 lines
1.1 KiB
C#
using System;
|
|
using System.Globalization;
|
|
using Bit.App.Pages;
|
|
using Bit.Core.Models.View;
|
|
using Microsoft.Maui.Controls;
|
|
using Microsoft.Maui;
|
|
|
|
namespace Bit.App.Utilities
|
|
{
|
|
public class IconGlyphConverter : IValueConverter
|
|
{
|
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
if (value is CipherItemViewModel cipherItemViewModel)
|
|
{
|
|
return cipherItemViewModel.Cipher?.GetIcon(cipherItemViewModel.UsePasskeyIconAsPlaceholderFallback);
|
|
}
|
|
|
|
if (value is CipherView cipher)
|
|
{
|
|
return cipher.GetIcon();
|
|
}
|
|
|
|
if (value is bool boolVal
|
|
&&
|
|
parameter is BooleanGlyphType boolGlyphType)
|
|
{
|
|
return IconGlyphExtensions.GetBooleanIconGlyph(boolVal, boolGlyphType);
|
|
}
|
|
|
|
return null;
|
|
}
|
|
|
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
}
|
|
}
|