mirror of
https://github.com/bitwarden/android.git
synced 2024-10-31 23:25:45 +03:00
get autofill web scheme for android p devices
This commit is contained in:
parent
416ec3812d
commit
a240a4ac66
1 changed files with 18 additions and 12 deletions
|
@ -5,6 +5,7 @@ using Bit.Core;
|
|||
using Android.Content;
|
||||
using Bit.Core.Abstractions;
|
||||
using System.Threading.Tasks;
|
||||
using Android.OS;
|
||||
|
||||
namespace Bit.Droid.Autofill
|
||||
{
|
||||
|
@ -17,7 +18,7 @@ namespace Bit.Droid.Autofill
|
|||
private readonly AssistStructure _structure;
|
||||
private string _uri;
|
||||
private string _packageName;
|
||||
private string _webDomain;
|
||||
private string _website;
|
||||
|
||||
public Parser(AssistStructure structure, Context applicationContext)
|
||||
{
|
||||
|
@ -36,14 +37,14 @@ namespace Bit.Droid.Autofill
|
|||
{
|
||||
return _uri;
|
||||
}
|
||||
var webDomainNull = string.IsNullOrWhiteSpace(WebDomain);
|
||||
if(webDomainNull && string.IsNullOrWhiteSpace(PackageName))
|
||||
var websiteNull = string.IsNullOrWhiteSpace(Website);
|
||||
if(websiteNull && string.IsNullOrWhiteSpace(PackageName))
|
||||
{
|
||||
_uri = null;
|
||||
}
|
||||
else if(!webDomainNull)
|
||||
else if(!websiteNull)
|
||||
{
|
||||
_uri = string.Concat("http://", WebDomain);
|
||||
_uri = Website;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -66,16 +67,16 @@ namespace Bit.Droid.Autofill
|
|||
}
|
||||
}
|
||||
|
||||
public string WebDomain
|
||||
public string Website
|
||||
{
|
||||
get => _webDomain;
|
||||
get => _website;
|
||||
set
|
||||
{
|
||||
if(string.IsNullOrWhiteSpace(value))
|
||||
{
|
||||
_webDomain = _uri = null;
|
||||
_website = _uri = null;
|
||||
}
|
||||
_webDomain = value;
|
||||
_website = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -104,7 +105,7 @@ namespace Bit.Droid.Autofill
|
|||
if(!AutofillHelpers.TrustedBrowsers.Contains(PackageName) &&
|
||||
!AutofillHelpers.CompatBrowsers.Contains(PackageName))
|
||||
{
|
||||
WebDomain = null;
|
||||
Website = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -135,9 +136,14 @@ namespace Bit.Droid.Autofill
|
|||
{
|
||||
PackageName = node.IdPackage;
|
||||
}
|
||||
if(string.IsNullOrWhiteSpace(WebDomain) && !string.IsNullOrWhiteSpace(node.WebDomain))
|
||||
if(string.IsNullOrWhiteSpace(Website) && !string.IsNullOrWhiteSpace(node.WebDomain))
|
||||
{
|
||||
WebDomain = node.WebDomain;
|
||||
var scheme = "http";
|
||||
if((int)Build.VERSION.SdkInt >= 28)
|
||||
{
|
||||
scheme = node.WebScheme;
|
||||
}
|
||||
Website = string.Format("{0}://{1}", scheme, node.WebDomain);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue