mirror of
https://github.com/bitwarden/android.git
synced 2024-12-25 02:18:27 +03:00
fixes for mobile app uris
This commit is contained in:
parent
a24ede364d
commit
ea1b584436
1 changed files with 28 additions and 8 deletions
|
@ -81,9 +81,7 @@ namespace Bit.App.Services
|
||||||
|
|
||||||
Uri uri = null;
|
Uri uri = null;
|
||||||
string domainName = null;
|
string domainName = null;
|
||||||
var androidApp = UriIsAndroidApp(uriString);
|
var mobileApp = UriIsMobileApp(uriString);
|
||||||
var iosApp = UriIsiOSApp(uriString);
|
|
||||||
var mobileApp = androidApp || iosApp;
|
|
||||||
|
|
||||||
if(!mobileApp &&
|
if(!mobileApp &&
|
||||||
(!Uri.TryCreate(uriString, UriKind.Absolute, out uri) ||
|
(!Uri.TryCreate(uriString, UriKind.Absolute, out uri) ||
|
||||||
|
@ -92,8 +90,7 @@ namespace Bit.App.Services
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
var mobileAppInfo = androidApp ? InfoFromAndroidAppUri(uriString) :
|
var mobileAppInfo = InfoFromMobileAppUri(uriString);
|
||||||
iosApp ? InfoFromiOSAppUri(uriString) : null;
|
|
||||||
var mobileAppWebUriString = mobileAppInfo?.Item1;
|
var mobileAppWebUriString = mobileAppInfo?.Item1;
|
||||||
var mobileAppSearchTerms = mobileAppInfo?.Item2;
|
var mobileAppSearchTerms = mobileAppInfo?.Item2;
|
||||||
var eqDomains = (await _settingsService.GetEquivalentDomainsAsync()).Select(d => d.ToArray());
|
var eqDomains = (await _settingsService.GetEquivalentDomainsAsync()).Select(d => d.ToArray());
|
||||||
|
@ -157,11 +154,15 @@ namespace Bit.App.Services
|
||||||
matchingFuzzyLogins.Add(new Login(login));
|
matchingFuzzyLogins.Add(new Login(login));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if(!mobileApp && Array.IndexOf(matchingDomainsArray, InfoFromAndroidAppUri(loginUriString)) >= 0)
|
else if(!mobileApp)
|
||||||
|
{
|
||||||
|
var info = InfoFromMobileAppUri(loginUriString);
|
||||||
|
if(info?.Item1 != null && Array.IndexOf(matchingDomainsArray, info.Item1) >= 0)
|
||||||
{
|
{
|
||||||
matchingFuzzyLogins.Add(new Login(login));
|
matchingFuzzyLogins.Add(new Login(login));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Uri loginUri;
|
Uri loginUri;
|
||||||
string loginDomainName = null;
|
string loginDomainName = null;
|
||||||
|
@ -341,6 +342,20 @@ namespace Bit.App.Services
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Tuple<string, string[]> InfoFromMobileAppUri(string mobileAppUriString)
|
||||||
|
{
|
||||||
|
if(UriIsAndroidApp(mobileAppUriString))
|
||||||
|
{
|
||||||
|
return InfoFromAndroidAppUri(mobileAppUriString);
|
||||||
|
}
|
||||||
|
else if(UriIsiOSApp(mobileAppUriString))
|
||||||
|
{
|
||||||
|
return InfoFromiOSAppUri(mobileAppUriString);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
private Tuple<string, string[]> InfoFromAndroidAppUri(string androidAppUriString)
|
private Tuple<string, string[]> InfoFromAndroidAppUri(string androidAppUriString)
|
||||||
{
|
{
|
||||||
if(!UriIsAndroidApp(androidAppUriString))
|
if(!UriIsAndroidApp(androidAppUriString))
|
||||||
|
@ -371,6 +386,11 @@ namespace Bit.App.Services
|
||||||
return new Tuple<string, string[]>(webUri, null);
|
return new Tuple<string, string[]>(webUri, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool UriIsMobileApp(string uriString)
|
||||||
|
{
|
||||||
|
return UriIsAndroidApp(uriString) || UriIsiOSApp(uriString);
|
||||||
|
}
|
||||||
|
|
||||||
private bool UriIsAndroidApp(string uriString)
|
private bool UriIsAndroidApp(string uriString)
|
||||||
{
|
{
|
||||||
return uriString.StartsWith(Constants.AndroidAppProtocol);
|
return uriString.StartsWith(Constants.AndroidAppProtocol);
|
||||||
|
|
Loading…
Reference in a new issue