mirror of
https://github.com/bitwarden/mobile
synced 2025-12-19 01:33:22 +00:00
Update ios extension to use new login service lookup by uristring
This commit is contained in:
@@ -10,25 +10,20 @@ namespace Bit.iOS.Extension.Models
|
||||
|
||||
public NSExtensionContext ExtContext { get; set; }
|
||||
public string ProviderType { get; set; }
|
||||
public Uri Url { get; set; }
|
||||
public DomainName DomainName
|
||||
public Uri Uri
|
||||
{
|
||||
get
|
||||
{
|
||||
if(_domainName != null)
|
||||
Uri uri;
|
||||
if(string.IsNullOrWhiteSpace(UrlString) || !Uri.TryCreate(UrlString, UriKind.Absolute, out uri))
|
||||
{
|
||||
return _domainName;
|
||||
return null;
|
||||
}
|
||||
|
||||
DomainName domain;
|
||||
if(Url?.Host != null && DomainName.TryParse(Url?.Host, out domain))
|
||||
{
|
||||
_domainName = domain;
|
||||
}
|
||||
|
||||
return _domainName;
|
||||
return uri;
|
||||
}
|
||||
}
|
||||
public string UrlString { get; set; }
|
||||
public string LoginTitle { get; set; }
|
||||
public string Username { get; set; }
|
||||
public string Password { get; set; }
|
||||
|
||||
@@ -1,16 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Bit.App.Models;
|
||||
using Bit.App.Models;
|
||||
|
||||
namespace Bit.iOS.Extension.Models
|
||||
{
|
||||
public class LoginViewModel
|
||||
{
|
||||
private string _uri;
|
||||
private DomainName _domain = null;
|
||||
private bool _domainParsed = false;
|
||||
|
||||
public LoginViewModel(Login login)
|
||||
{
|
||||
Id = login.Id;
|
||||
@@ -24,59 +17,6 @@ namespace Bit.iOS.Extension.Models
|
||||
public string Name { get; set; }
|
||||
public string Username { get; set; }
|
||||
public string Password { get; set; }
|
||||
public string Uri
|
||||
{
|
||||
get { return _uri; }
|
||||
set
|
||||
{
|
||||
_domainParsed = false;
|
||||
_uri = value;
|
||||
}
|
||||
}
|
||||
public string HostName
|
||||
{
|
||||
get
|
||||
{
|
||||
if(string.IsNullOrWhiteSpace(Uri))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
return new Uri(Uri)?.Host;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return null;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public DomainName Domain
|
||||
{
|
||||
get
|
||||
{
|
||||
if(string.IsNullOrWhiteSpace(Uri))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if(_domainParsed)
|
||||
{
|
||||
return _domain;
|
||||
}
|
||||
|
||||
_domainParsed = true;
|
||||
|
||||
DomainName domain;
|
||||
if(DomainName.TryParse(HostName, out domain))
|
||||
{
|
||||
_domain = domain;
|
||||
}
|
||||
|
||||
return _domain;
|
||||
}
|
||||
}
|
||||
public string Uri { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user