mirror of
https://github.com/bitwarden/mobile
synced 2026-01-11 04:53:52 +00:00
[PM-7369] Show passkey icon on android when the item has a Fido2 credential (#3148)
* 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>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using Bit.App.Pages;
|
||||
using Bit.Core.Models.View;
|
||||
using Microsoft.Maui.Controls;
|
||||
using Microsoft.Maui;
|
||||
@@ -10,6 +11,11 @@ namespace Bit.App.Utilities
|
||||
{
|
||||
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();
|
||||
|
||||
@@ -6,12 +6,12 @@ namespace Bit.App.Utilities
|
||||
{
|
||||
public static class IconGlyphExtensions
|
||||
{
|
||||
public static string GetIcon(this CipherView cipher)
|
||||
public static string GetIcon(this CipherView cipher, bool usePasskeyIconAsPlaceholderFallback = false)
|
||||
{
|
||||
switch (cipher.Type)
|
||||
{
|
||||
case CipherType.Login:
|
||||
return GetLoginIconGlyph(cipher);
|
||||
return GetLoginIconGlyph(cipher, usePasskeyIconAsPlaceholderFallback);
|
||||
case CipherType.SecureNote:
|
||||
return BitwardenIcons.StickyNote;
|
||||
case CipherType.Card:
|
||||
@@ -22,9 +22,9 @@ namespace Bit.App.Utilities
|
||||
return null;
|
||||
}
|
||||
|
||||
static string GetLoginIconGlyph(CipherView cipher)
|
||||
static string GetLoginIconGlyph(CipherView cipher, bool usePasskeyIconAsPlaceholderFallback = false)
|
||||
{
|
||||
var icon = BitwardenIcons.Globe;
|
||||
var icon = cipher.HasFido2Credential && usePasskeyIconAsPlaceholderFallback ? BitwardenIcons.Passkey : BitwardenIcons.Globe;
|
||||
if (cipher.Login.Uri != null)
|
||||
{
|
||||
var hostnameUri = cipher.Login.Uri;
|
||||
|
||||
Reference in New Issue
Block a user