1
0
mirror of https://github.com/bitwarden/mobile synced 2025-12-13 14:53:18 +00:00

[Linked fields] Add Linked Field as a custom field type (#1563)

* Add linked fields support

* Fix style, don't show linked field if Secure Note

* Finish basic linked fields for Login

* Use Field.LinkedId to store linked field info

* Reset Linked Custom Fields if cipherType changes

* Refactor to use ItemView class

* Use enum for LinkedId

* Detect if no linkedFieldOptions
This commit is contained in:
Thomas Rittson
2021-11-09 07:34:16 +10:00
committed by GitHub
parent 3cb8adeeff
commit 90b62d61ae
20 changed files with 263 additions and 30 deletions

View File

@@ -50,20 +50,20 @@ namespace Bit.Core.Models.View
public DateTime? DeletedDate { get; set; }
public CipherRepromptType Reprompt { get; set; }
public string SubTitle
public ItemView Item
{
get
{
switch (Type)
{
case CipherType.Login:
return Login.SubTitle;
return Login;
case CipherType.SecureNote:
return SecureNote.SubTitle;
return SecureNote;
case CipherType.Card:
return Card.SubTitle;
return Card;
case CipherType.Identity:
return Identity.SubTitle;
return Identity;
default:
break;
}
@@ -71,6 +71,8 @@ namespace Bit.Core.Models.View
}
}
public List<KeyValuePair<string, LinkedIdType>> LinkedFieldOptions => Item.LinkedFieldOptions;
public string SubTitle => Item.SubTitle;
public bool Shared => OrganizationId != null;
public bool HasPasswordHistory => PasswordHistory?.Any() ?? false;
public bool HasAttachments => Attachments?.Any() ?? false;
@@ -102,5 +104,11 @@ namespace Bit.Core.Models.View
}
}
public bool IsDeleted => DeletedDate.HasValue;
public string LinkedFieldI18nKey(LinkedIdType id)
{
return LinkedFieldOptions.Find(lfo => lfo.Value == id).Key;
}
}
}