mirror of
https://github.com/bitwarden/android.git
synced 2024-12-24 01:48:25 +03:00
lock now button
This commit is contained in:
parent
5cf2092576
commit
f7bb091366
5 changed files with 26 additions and 0 deletions
|
@ -19,12 +19,14 @@ namespace Bit.App
|
|||
private readonly IUserService _userService;
|
||||
private readonly IBroadcasterService _broadcasterService;
|
||||
private readonly IMessagingService _messagingService;
|
||||
private readonly IStateService _stateService;
|
||||
|
||||
public App()
|
||||
{
|
||||
_userService = ServiceContainer.Resolve<IUserService>("userService");
|
||||
_broadcasterService = ServiceContainer.Resolve<IBroadcasterService>("broadcasterService");
|
||||
_messagingService = ServiceContainer.Resolve<IMessagingService>("messagingService");
|
||||
_stateService = ServiceContainer.Resolve<IStateService>("stateService");
|
||||
_i18nService = ServiceContainer.Resolve<II18nService>("i18nService") as MobileI18nService;
|
||||
|
||||
InitializeComponent();
|
||||
|
@ -53,6 +55,12 @@ namespace Bit.App
|
|||
}
|
||||
_messagingService.Send("showDialogResolve", new Tuple<int, bool>(details.DialogId, confirmed));
|
||||
}
|
||||
else if(message.Command == "locked")
|
||||
{
|
||||
await _stateService.PurgeAsync();
|
||||
// TODO
|
||||
// MainPage = new LockPage();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -84,6 +84,10 @@ namespace Bit.App.Pages
|
|||
{
|
||||
await _vm.LogOutAsync();
|
||||
}
|
||||
else if(item.Name == AppResources.LockNow)
|
||||
{
|
||||
await _vm.LockAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ namespace Bit.App.Pages
|
|||
private readonly IDeviceActionService _deviceActionService;
|
||||
private readonly IEnvironmentService _environmentService;
|
||||
private readonly IMessagingService _messagingService;
|
||||
private readonly ILockService _lockService;
|
||||
|
||||
public SettingsPageViewModel()
|
||||
{
|
||||
|
@ -26,6 +27,7 @@ namespace Bit.App.Pages
|
|||
_deviceActionService = ServiceContainer.Resolve<IDeviceActionService>("deviceActionService");
|
||||
_environmentService = ServiceContainer.Resolve<IEnvironmentService>("environmentService");
|
||||
_messagingService = ServiceContainer.Resolve<IMessagingService>("messagingService");
|
||||
_lockService = ServiceContainer.Resolve<ILockService>("lockService");
|
||||
|
||||
PageTitle = AppResources.Settings;
|
||||
BuildList();
|
||||
|
@ -129,6 +131,11 @@ namespace Bit.App.Pages
|
|||
}
|
||||
}
|
||||
|
||||
public async Task LockAsync()
|
||||
{
|
||||
await _lockService.LockAsync(true);
|
||||
}
|
||||
|
||||
private void BuildList()
|
||||
{
|
||||
var doUpper = Device.RuntimePlatform != Device.Android;
|
||||
|
|
|
@ -7,5 +7,6 @@ namespace Bit.Core.Abstractions
|
|||
Task<T> GetAsync<T>(string key);
|
||||
Task RemoveAsync(string key);
|
||||
Task SaveAsync<T>(string key, T obj);
|
||||
Task PurgeAsync();
|
||||
}
|
||||
}
|
|
@ -34,5 +34,11 @@ namespace Bit.Core.Services
|
|||
}
|
||||
return Task.FromResult(0);
|
||||
}
|
||||
|
||||
public Task PurgeAsync()
|
||||
{
|
||||
_state.Clear();
|
||||
return Task.FromResult(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue