mirror of
https://github.com/bitwarden/mobile
synced 2025-12-15 07:43:37 +00:00
moved view controllers to core library for reuse
This commit is contained in:
47
src/iOS.Core/Models/AppExtensionContext.cs
Normal file
47
src/iOS.Core/Models/AppExtensionContext.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
using System;
|
||||
|
||||
namespace Bit.iOS.Core.Models
|
||||
{
|
||||
public class AppExtensionContext
|
||||
{
|
||||
private string _uriString;
|
||||
|
||||
public Uri Uri
|
||||
{
|
||||
get
|
||||
{
|
||||
Uri uri;
|
||||
if(string.IsNullOrWhiteSpace(UrlString) || !Uri.TryCreate(UrlString, UriKind.Absolute, out uri))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return uri;
|
||||
}
|
||||
}
|
||||
public string UrlString
|
||||
{
|
||||
get
|
||||
{
|
||||
return _uriString;
|
||||
}
|
||||
set
|
||||
{
|
||||
_uriString = value;
|
||||
if(_uriString != null && !_uriString.StartsWith(App.Constants.iOSAppProtocol) && _uriString.Contains("."))
|
||||
{
|
||||
if(!_uriString.Contains("://") && !_uriString.Contains(" "))
|
||||
{
|
||||
_uriString = string.Concat("http://", _uriString);
|
||||
}
|
||||
}
|
||||
|
||||
if(!_uriString.StartsWith("http") && !_uriString.StartsWith(App.Constants.iOSAppProtocol))
|
||||
{
|
||||
_uriString = string.Concat(App.Constants.iOSAppProtocol, _uriString);
|
||||
}
|
||||
}
|
||||
}
|
||||
public PasswordGenerationOptions PasswordOptions { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user