various android crash fixes

This commit is contained in:
Kyle Spearrin 2018-02-01 23:25:48 -05:00
parent dd334858ff
commit 5d646a6112
3 changed files with 8 additions and 7 deletions

View file

@ -302,9 +302,9 @@ namespace Bit.Android.Services
public void DismissKeyboard() public void DismissKeyboard()
{ {
var activity = (MainActivity)CurrentContext;
try try
{ {
var activity = (MainActivity)CurrentContext;
var imm = (InputMethodManager)activity.GetSystemService(Context.InputMethodService); var imm = (InputMethodManager)activity.GetSystemService(Context.InputMethodService);
imm.HideSoftInputFromWindow(activity.CurrentFocus.WindowToken, 0); imm.HideSoftInputFromWindow(activity.CurrentFocus.WindowToken, 0);
} }

View file

@ -38,7 +38,7 @@ namespace Bit.App.Pages
Android: "fingerprint.png", Android: "fingerprint.png",
Windows: "smile.png"); Windows: "smile.png");
var biometricText = Helpers.OnPlatform( var biometricText = Helpers.OnPlatform(
iOS: _deviceInfoService.HasFaceIdSupport ? iOS: _deviceInfoService.HasFaceIdSupport ?
AppResources.UseFaceIDToUnlock : AppResources.UseFingerprintToUnlock, AppResources.UseFaceIDToUnlock : AppResources.UseFingerprintToUnlock,
Android: AppResources.UseFingerprintToUnlock, Android: AppResources.UseFingerprintToUnlock,
Windows: AppResources.UseWindowsHelloToUnlock); Windows: AppResources.UseWindowsHelloToUnlock);
@ -87,13 +87,14 @@ namespace Bit.App.Pages
Content = stackLayout; Content = stackLayout;
} }
protected override void OnAppearing() protected override async void OnAppearing()
{ {
base.OnAppearing(); base.OnAppearing();
if(_checkFingerprintImmediately) if(_checkFingerprintImmediately)
{ {
var task = CheckFingerprintAsync(); await Task.Delay(Device.RuntimePlatform == Device.Android ? 500 : 200);
await CheckFingerprintAsync();
} }
} }
@ -105,7 +106,7 @@ namespace Bit.App.Pages
} }
_lastAction = DateTime.UtcNow; _lastAction = DateTime.UtcNow;
var direction = _deviceInfoService.HasFaceIdSupport ? var direction = _deviceInfoService.HasFaceIdSupport ?
AppResources.FaceIDDirection : AppResources.FingerprintDirection; AppResources.FaceIDDirection : AppResources.FingerprintDirection;
var fingerprintRequest = new AuthenticationRequestConfiguration(direction) var fingerprintRequest = new AuthenticationRequestConfiguration(direction)

View file

@ -93,9 +93,9 @@ namespace Bit.App.Pages
Content = scrollView; Content = scrollView;
} }
private void Entry_Completed(object sender, EventArgs e) private async void Entry_Completed(object sender, EventArgs e)
{ {
var task = CheckPasswordAsync(); await CheckPasswordAsync();
} }
protected override void OnAppearing() protected override void OnAppearing()