mirror of
https://github.com/bitwarden/android.git
synced 2024-10-31 15:15:34 +03:00
Crash fixes (#1869)
* Crash fixes * added HasAutofillService to DeviceActionService
This commit is contained in:
parent
1f58b0cabe
commit
88f6b60b97
7 changed files with 29 additions and 18 deletions
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -35,6 +35,7 @@ namespace Bit.App.Abstractions
|
|||
void Background();
|
||||
bool AutofillAccessibilityServiceRunning();
|
||||
bool AutofillAccessibilityOverlayPermitted();
|
||||
bool HasAutofillService();
|
||||
bool AutofillServiceEnabled();
|
||||
void DisableAutofillService();
|
||||
bool AutofillServicesEnabled();
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -208,11 +208,11 @@ namespace Bit.Core.Services
|
|||
if (_accessTokenForDecoding == null)
|
||||
{
|
||||
await GetTokenAsync();
|
||||
}
|
||||
if (_accessTokenForDecoding == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
var decoded = DecodeToken();
|
||||
if (decoded?["amr"] == null)
|
||||
{
|
||||
|
|
|
@ -392,6 +392,11 @@ namespace Bit.iOS.Core.Services
|
|||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public bool HasAutofillService()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool AutofillServiceEnabled()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
|
|
Loading…
Reference in a new issue