1
0
mirror of https://github.com/bitwarden/mobile.git synced 2024-11-05 09:01:11 +01:00

Crash fixes (#1869)

* Crash fixes

* added HasAutofillService to DeviceActionService
This commit is contained in:
mp-bw 2022-04-01 12:07:14 -04:00 committed by GitHub
parent 1f58b0cabe
commit 88f6b60b97
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 29 additions and 18 deletions

View File

@ -43,23 +43,22 @@ namespace Bit.Droid.Services
public Task<bool> ValidateIntegrityAsync(string bioIntegrityKey = null)
{
// bioIntegrityKey used in iOS only
if (Build.VERSION.SdkInt < BuildVersionCodes.M)
{
return Task.FromResult(true);
}
_keystore.Load(null);
IKey key = _keystore.GetKey(KeyName, null);
Cipher cipher = Cipher.GetInstance(Transformation);
if (key == null || cipher == null)
{
return Task.FromResult(true);
}
try
{
_keystore.Load(null);
var key = _keystore.GetKey(KeyName, null);
var cipher = Cipher.GetInstance(Transformation);
if (key == null || cipher == null)
{
return Task.FromResult(true);
}
cipher.Init(CipherMode.EncryptMode, key);
}
catch (KeyPermanentlyInvalidatedException e)

View File

@ -674,7 +674,7 @@ namespace Bit.Droid.Services
else
{
var data = new Intent();
if (cipher == null)
if (cipher?.Login == null)
{
data.PutExtra("canceled", "true");
}
@ -734,6 +734,11 @@ namespace Bit.Droid.Services
return Accessibility.AccessibilityHelpers.OverlayPermitted();
}
public bool HasAutofillService()
{
return true;
}
public void OpenAccessibilityOverlayPermissionSettings()
{
var activity = (MainActivity)CrossCurrentActivity.Current.Activity;

View File

@ -35,6 +35,7 @@ namespace Bit.App.Abstractions
void Background();
bool AutofillAccessibilityServiceRunning();
bool AutofillAccessibilityOverlayPermitted();
bool HasAutofillService();
bool AutofillServiceEnabled();
void DisableAutofillService();
bool AutofillServicesEnabled();

View File

@ -192,7 +192,8 @@ namespace Bit.App.Pages
public void UpdateEnabled()
{
AutofillServiceToggled = _deviceActionService.AutofillServiceEnabled();
AutofillServiceToggled =
_deviceActionService.HasAutofillService() && _deviceActionService.AutofillServiceEnabled();
AccessibilityToggled = _deviceActionService.AutofillAccessibilityServiceRunning();
DrawOverToggled = _deviceActionService.AutofillAccessibilityOverlayPermitted();
}

View File

@ -66,9 +66,9 @@ namespace Bit.App.Pages
public void Init(AppOptions appOptions)
{
_appOptions = appOptions;
Uri = appOptions.Uri;
Uri = appOptions?.Uri;
string name = null;
if (Uri.StartsWith(Constants.AndroidAppProtocol))
if (Uri?.StartsWith(Constants.AndroidAppProtocol) ?? false)
{
name = Uri.Substring(Constants.AndroidAppProtocol.Length);
}

View File

@ -208,10 +208,10 @@ namespace Bit.Core.Services
if (_accessTokenForDecoding == null)
{
await GetTokenAsync();
}
if (_accessTokenForDecoding == null)
{
return false;
if (_accessTokenForDecoding == null)
{
return false;
}
}
var decoded = DecodeToken();
if (decoded?["amr"] == null)

View File

@ -392,6 +392,11 @@ namespace Bit.iOS.Core.Services
throw new NotImplementedException();
}
public bool HasAutofillService()
{
return false;
}
public bool AutofillServiceEnabled()
{
throw new NotImplementedException();