mirror of
https://github.com/bitwarden/mobile
synced 2025-12-15 15:53:44 +00:00
[PM-6655] Add null fallback cipher name on passkeys (#3116)
* PM-6655 Fixed fallback value on passkeys to take into account CipherView.Name. Also removed non-discoverable passkey filter on adding credentials to the ASStore and also added the fallback consideration on the passkeys list iOS extension * PM-6655 Restored non-discoverable filter on credentials set for ASStore on this PR
This commit is contained in:
committed by
GitHub
parent
bdf2ea879d
commit
310d8b363f
@@ -1,5 +1,7 @@
|
|||||||
using Bit.Core.Enums;
|
using Bit.Core.Enums;
|
||||||
using Bit.Core.Models.Domain;
|
using Bit.Core.Models.Domain;
|
||||||
|
using Bit.Core.Resources.Localization;
|
||||||
|
using Bit.Core.Utilities;
|
||||||
|
|
||||||
namespace Bit.Core.Models.View
|
namespace Bit.Core.Models.View
|
||||||
{
|
{
|
||||||
@@ -119,5 +121,14 @@ namespace Bit.Core.Models.View
|
|||||||
public bool IsClonable => OrganizationId is null;
|
public bool IsClonable => OrganizationId is null;
|
||||||
|
|
||||||
public bool HasFido2Credential => Type == CipherType.Login && Login?.HasFido2Credentials == true;
|
public bool HasFido2Credential => Type == CipherType.Login && Login?.HasFido2Credentials == true;
|
||||||
|
|
||||||
|
public string GetMainFido2CredentialUsername()
|
||||||
|
{
|
||||||
|
return Login?.MainFido2Credential?.UserName
|
||||||
|
.FallbackOnNullOrWhiteSpace(Login?.MainFido2Credential?.UserDisplayName)
|
||||||
|
.FallbackOnNullOrWhiteSpace(Login?.Username)
|
||||||
|
.FallbackOnNullOrWhiteSpace(Name)
|
||||||
|
.FallbackOnNullOrWhiteSpace(AppResources.UnknownAccount);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
using Bit.Core.Enums;
|
using Bit.Core.Enums;
|
||||||
using Bit.Core.Models.Domain;
|
using Bit.Core.Models.Domain;
|
||||||
using Bit.Core.Resources.Localization;
|
|
||||||
using Bit.Core.Utilities;
|
|
||||||
|
|
||||||
namespace Bit.Core.Models.View
|
namespace Bit.Core.Models.View
|
||||||
{
|
{
|
||||||
@@ -39,15 +37,4 @@ namespace Bit.Core.Models.View
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class LoginViewExtensions
|
|
||||||
{
|
|
||||||
public static string GetMainFido2CredentialUsername(this LoginView loginView)
|
|
||||||
{
|
|
||||||
return loginView.MainFido2Credential.UserName
|
|
||||||
.FallbackOnNullOrWhiteSpace(loginView.MainFido2Credential.UserDisplayName)
|
|
||||||
.FallbackOnNullOrWhiteSpace(loginView.Username)
|
|
||||||
.FallbackOnNullOrWhiteSpace(AppResources.UnknownAccount);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -111,6 +111,21 @@ namespace Bit.iOS.Autofill.Utilities
|
|||||||
return IsPasskeySection(indexPath.Section) || !item.ForceSectionIcon;
|
return IsPasskeySection(indexPath.Section) || !item.ForceSectionIcon;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override string GetCipherCellSubtitle(CipherViewModel item, NSIndexPath indexPath)
|
||||||
|
{
|
||||||
|
if (!item.HasFido2Credential)
|
||||||
|
{
|
||||||
|
return base.GetCipherCellSubtitle(item, indexPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Context.IsPreparingListForPasskey && !IsPasskeySection(indexPath.Section))
|
||||||
|
{
|
||||||
|
return item.Username;
|
||||||
|
}
|
||||||
|
|
||||||
|
return item.CipherView?.GetMainFido2CredentialUsername() ?? item.Username;
|
||||||
|
}
|
||||||
|
|
||||||
public override UIView GetViewForHeader(UITableView tableView, nint section)
|
public override UIView GetViewForHeader(UITableView tableView, nint section)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|||||||
@@ -145,7 +145,7 @@ namespace Bit.iOS.Core.Utilities
|
|||||||
}
|
}
|
||||||
|
|
||||||
return new ASPasskeyCredentialIdentity(cipher.Login.MainFido2Credential.RpId,
|
return new ASPasskeyCredentialIdentity(cipher.Login.MainFido2Credential.RpId,
|
||||||
cipher.Login.GetMainFido2CredentialUsername(),
|
cipher.GetMainFido2CredentialUsername(),
|
||||||
NSData.FromArray(cipher.Login.MainFido2Credential.CredentialId.GuidToRawFormat()),
|
NSData.FromArray(cipher.Login.MainFido2Credential.CredentialId.GuidToRawFormat()),
|
||||||
cipher.Login.MainFido2Credential.UserHandle,
|
cipher.Login.MainFido2Credential.UserHandle,
|
||||||
cipher.Id);
|
cipher.Id);
|
||||||
|
|||||||
@@ -144,7 +144,7 @@ namespace Bit.iOS.Core.Views
|
|||||||
}
|
}
|
||||||
|
|
||||||
cipherCell.SetTitle(item.Name);
|
cipherCell.SetTitle(item.Name);
|
||||||
cipherCell.SetSubtitle(item.Username);
|
cipherCell.SetSubtitle(GetCipherCellSubtitle(item, indexPath));
|
||||||
cipherCell.UpdateMainIcon(ShouldUseMainIconAsPasskey(item, indexPath));
|
cipherCell.UpdateMainIcon(ShouldUseMainIconAsPasskey(item, indexPath));
|
||||||
if (item.IsShared)
|
if (item.IsShared)
|
||||||
{
|
{
|
||||||
@@ -161,6 +161,8 @@ namespace Bit.iOS.Core.Views
|
|||||||
|
|
||||||
protected virtual bool ShouldUseMainIconAsPasskey(CipherViewModel item, NSIndexPath indexPath) => item.HasFido2Credential;
|
protected virtual bool ShouldUseMainIconAsPasskey(CipherViewModel item, NSIndexPath indexPath) => item.HasFido2Credential;
|
||||||
|
|
||||||
|
protected virtual string GetCipherCellSubtitle(CipherViewModel item, NSIndexPath indexPath) => item.Username;
|
||||||
|
|
||||||
public override nfloat GetHeightForRow(UITableView tableView, NSIndexPath indexPath)
|
public override nfloat GetHeightForRow(UITableView tableView, NSIndexPath indexPath)
|
||||||
{
|
{
|
||||||
return 55;
|
return 55;
|
||||||
|
|||||||
Reference in New Issue
Block a user