mirror of
https://github.com/bitwarden/mobile
synced 2025-12-12 22:33:25 +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:
@@ -1,11 +1,12 @@
|
||||
using Bit.Core.Models.Domain;
|
||||
using Bit.Core.Enums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Bit.Core.Models.View
|
||||
{
|
||||
public class LoginView : View
|
||||
public class LoginView : ItemView
|
||||
{
|
||||
public LoginView() { }
|
||||
|
||||
@@ -21,9 +22,18 @@ namespace Bit.Core.Models.View
|
||||
public List<LoginUriView> Uris { get; set; }
|
||||
public string Uri => HasUris ? Uris[0].Uri : null;
|
||||
public string MaskedPassword => Password != null ? "••••••••" : null;
|
||||
public string SubTitle => Username;
|
||||
public override string SubTitle => Username;
|
||||
public bool CanLaunch => HasUris && Uris.Any(u => u.CanLaunch);
|
||||
public string LaunchUri => HasUris ? Uris.FirstOrDefault(u => u.CanLaunch)?.LaunchUri : null;
|
||||
public bool HasUris => (Uris?.Count ?? 0) > 0;
|
||||
|
||||
public override List<KeyValuePair<string, LinkedIdType>> LinkedFieldOptions
|
||||
{
|
||||
get => new List<KeyValuePair<string, LinkedIdType>>()
|
||||
{
|
||||
new KeyValuePair<string, LinkedIdType>("Username", LinkedIdType.Login_Username),
|
||||
new KeyValuePair<string, LinkedIdType>("Password", LinkedIdType.Login_Password),
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user