1
0
mirror of https://github.com/bitwarden/mobile.git synced 2024-12-24 16:38:22 +01:00

checked for locked state on activity resume.

resolves #319
This commit is contained in:
Kyle Spearrin 2018-06-04 09:20:38 -04:00
parent ffc4e32119
commit c906f037b5
2 changed files with 13 additions and 6 deletions

View File

@ -28,6 +28,7 @@ namespace Bit.Android
private Java.Util.Regex.Pattern _otpPattern = Java.Util.Regex.Pattern.Compile("^.*?([cbdefghijklnrtuv]{32,64})$");
private IDeviceActionService _deviceActionService;
private IDeviceInfoService _deviceInfoService;
private IAppSettingsService _appSettingsService;
private ISettings _settings;
private AppOptions _appOptions;
@ -71,6 +72,7 @@ namespace Bit.Android
_deviceActionService = Resolver.Resolve<IDeviceActionService>();
_deviceInfoService = Resolver.Resolve<IDeviceInfoService>();
_appSettingsService = Resolver.Resolve<IAppSettingsService>();
_settings = Resolver.Resolve<ISettings>();
_appOptions = GetOptions();
LoadApplication(new App.App(
@ -83,7 +85,7 @@ namespace Bit.Android
Resolver.Resolve<ILockService>(),
Resolver.Resolve<ILocalizeService>(),
Resolver.Resolve<IAppInfoService>(),
Resolver.Resolve<IAppSettingsService>(),
_appSettingsService,
_deviceActionService));
if(_appOptions?.Uri == null)
@ -147,6 +149,11 @@ namespace Bit.Android
System.Diagnostics.Debug.WriteLine(e);
}
}
if(_appSettingsService.Locked)
{
MessagingCenter.Send(Xamarin.Forms.Application.Current, "Resumed", false);
}
}
protected override void OnNewIntent(Intent intent)

View File

@ -78,14 +78,14 @@ namespace Bit.App
MainPage = new ExtendedNavigationPage(new HomePage());
}
if(Device.RuntimePlatform == Device.iOS)
MessagingCenter.Subscribe<Application, bool>(Current, "Resumed", async (sender, forceLock) =>
{
MessagingCenter.Subscribe<Application, bool>(Current, "Resumed", async (sender, forceLock) =>
Device.BeginInvokeOnMainThread(async () => await _lockService.CheckLockAsync(forceLock));
if(Device.RuntimePlatform == Device.iOS)
{
Device.BeginInvokeOnMainThread(async () => await _lockService.CheckLockAsync(forceLock));
await Task.Run(() => FullSyncAsync()).ConfigureAwait(false);
});
}
}
});
}
protected async override void OnStart()