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

View file

@ -78,14 +78,14 @@ namespace Bit.App
MainPage = new ExtendedNavigationPage(new HomePage()); 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)); Device.BeginInvokeOnMainThread(async () => await _lockService.CheckLockAsync(forceLock));
if(Device.RuntimePlatform == Device.iOS)
{
await Task.Run(() => FullSyncAsync()).ConfigureAwait(false); await Task.Run(() => FullSyncAsync()).ConfigureAwait(false);
});
} }
});
} }
protected async override void OnStart() protected async override void OnStart()