mirror of
https://github.com/bitwarden/mobile
synced 2025-12-05 23:53:33 +00:00
handle sleep event on ios manually
This commit is contained in:
@@ -126,6 +126,13 @@ namespace Bit.App
|
|||||||
ResumedAsync();
|
ResumedAsync();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if(message.Command == "slept")
|
||||||
|
{
|
||||||
|
if(Device.RuntimePlatform == Device.iOS)
|
||||||
|
{
|
||||||
|
await SleptAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
else if(message.Command == "migrated")
|
else if(message.Command == "migrated")
|
||||||
{
|
{
|
||||||
await Task.Delay(1000);
|
await Task.Delay(1000);
|
||||||
@@ -182,10 +189,9 @@ namespace Bit.App
|
|||||||
if(Device.RuntimePlatform == Device.Android)
|
if(Device.RuntimePlatform == Device.Android)
|
||||||
{
|
{
|
||||||
await _storageService.SaveAsync(Constants.LastActiveKey, DateTime.UtcNow);
|
await _storageService.SaveAsync(Constants.LastActiveKey, DateTime.UtcNow);
|
||||||
|
SetTabsPageFromAutofill();
|
||||||
|
await SleptAsync();
|
||||||
}
|
}
|
||||||
SetTabsPageFromAutofill();
|
|
||||||
await HandleLockingAsync();
|
|
||||||
_messagingService.Send("stopEventTimer");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnResume()
|
protected override void OnResume()
|
||||||
@@ -197,6 +203,12 @@ namespace Bit.App
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async Task SleptAsync()
|
||||||
|
{
|
||||||
|
await HandleLockingAsync();
|
||||||
|
_messagingService.Send("stopEventTimer");
|
||||||
|
}
|
||||||
|
|
||||||
private async void ResumedAsync()
|
private async void ResumedAsync()
|
||||||
{
|
{
|
||||||
_messagingService.Send("cancelLockTimer");
|
_messagingService.Send("cancelLockTimer");
|
||||||
|
|||||||
@@ -194,6 +194,7 @@ namespace Bit.iOS
|
|||||||
UIApplication.SharedApplication.KeyWindow.EndEditing(true);
|
UIApplication.SharedApplication.KeyWindow.EndEditing(true);
|
||||||
UIApplication.SharedApplication.SetStatusBarHidden(true, false);
|
UIApplication.SharedApplication.SetStatusBarHidden(true, false);
|
||||||
_storageService.SaveAsync(Constants.LastActiveKey, DateTime.UtcNow);
|
_storageService.SaveAsync(Constants.LastActiveKey, DateTime.UtcNow);
|
||||||
|
_messagingService.Send("slept");
|
||||||
base.DidEnterBackground(uiApplication);
|
base.DidEnterBackground(uiApplication);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user