diff --git a/src/iOS.Extension/LoginAddViewController.cs b/src/iOS.Extension/LoginAddViewController.cs index a1de5e76e..19d98df30 100644 --- a/src/iOS.Extension/LoginAddViewController.cs +++ b/src/iOS.Extension/LoginAddViewController.cs @@ -160,12 +160,23 @@ namespace Bit.iOS.Extension Type = App.Enums.CipherType.Login, Login = new Login { - Uri = string.IsNullOrWhiteSpace(UriCell.TextField.Text) ? null : UriCell.TextField.Text.Encrypt(), + Uris = null, Username = string.IsNullOrWhiteSpace(UsernameCell.TextField.Text) ? null : UsernameCell.TextField.Text.Encrypt(), Password = string.IsNullOrWhiteSpace(PasswordCell.TextField.Text) ? null : PasswordCell.TextField.Text.Encrypt() } }; + if(!string.IsNullOrWhiteSpace(UriCell.TextField.Text)) + { + cipher.Login.Uris = new List + { + new LoginUri + { + Uri = UriCell.TextField.Text.Encrypt() + } + }; + } + var saveTask = _cipherService.SaveAsync(cipher); var loadingAlert = Dialogs.CreateLoadingAlert(AppResources.Saving); PresentViewController(loadingAlert, true, null); diff --git a/src/iOS.Extension/Models/CipherViewModel.cs b/src/iOS.Extension/Models/CipherViewModel.cs index c8b614d1b..be88d08e9 100644 --- a/src/iOS.Extension/Models/CipherViewModel.cs +++ b/src/iOS.Extension/Models/CipherViewModel.cs @@ -1,4 +1,5 @@ -using Bit.App.Models; +using Bit.App.Enums; +using Bit.App.Models; using System; using System.Collections.Generic; using System.Linq; @@ -13,7 +14,7 @@ namespace Bit.iOS.Extension.Models Name = cipher.Name?.Decrypt(cipher.OrganizationId); Username = cipher.Login?.Username?.Decrypt(cipher.OrganizationId); Password = cipher.Login?.Password?.Decrypt(cipher.OrganizationId); - Uri = cipher.Login?.Uri?.Decrypt(cipher.OrganizationId); + Uris = cipher.Login?.Uris?.Select(u => new LoginUriModel(u, cipher.OrganizationId)); Totp = new Lazy(() => cipher.Login?.Totp?.Decrypt(cipher.OrganizationId)); Fields = new Lazy>>(() => { @@ -37,8 +38,20 @@ namespace Bit.iOS.Extension.Models public string Name { get; set; } public string Username { get; set; } public string Password { get; set; } - public string Uri { get; set; } + public IEnumerable Uris { get; set; } public Lazy Totp { get; set; } public Lazy>> Fields { get; set; } + + public class LoginUriModel + { + public LoginUriModel(LoginUri data, string orgId) + { + Uri = data?.Uri?.Decrypt(orgId); + Match = data?.Match; + } + + public string Uri { get; set; } + public UriMatchType? Match { get; set; } + } } }