handle locked status better. once locked, stay locked.

This commit is contained in:
Kyle Spearrin 2017-02-17 23:03:54 -05:00
parent 27e996dba0
commit b435256911
3 changed files with 12 additions and 7 deletions

View file

@ -221,20 +221,18 @@ namespace Bit.App
{ {
_authService.LogOut(); _authService.LogOut();
var deviceApiRepository = Resolver.Resolve<IDeviceApiRepository>();
var appIdService = Resolver.Resolve<IAppIdService>();
await Task.Run(() => deviceApiRepository.PutClearTokenAsync(appIdService.AppId)).ConfigureAwait(false);
_googleAnalyticsService.TrackAppEvent("LoggedOut"); _googleAnalyticsService.TrackAppEvent("LoggedOut");
_googleAnalyticsService.RefreshUserId(); _googleAnalyticsService.RefreshUserId();
Device.BeginInvokeOnMainThread(() => Current.MainPage = new ExtendedNavigationPage(new HomePage())); Device.BeginInvokeOnMainThread(() => Current.MainPage = new ExtendedNavigationPage(new HomePage()));
if(!string.IsNullOrWhiteSpace(logoutMessage)) if(!string.IsNullOrWhiteSpace(logoutMessage))
{ {
_userDialogs.Toast(logoutMessage); _userDialogs.Toast(logoutMessage);
} }
var deviceApiRepository = Resolver.Resolve<IDeviceApiRepository>();
var appIdService = Resolver.Resolve<IAppIdService>();
_settings.Remove(Constants.PushLastRegistrationDate);
await Task.Run(() => deviceApiRepository.PutClearTokenAsync(appIdService.AppId)).ConfigureAwait(false);
} }
private async Task CheckLockAsync(bool forceLock) private async Task CheckLockAsync(bool forceLock)
@ -246,6 +244,12 @@ namespace Bit.App
} }
var lockType = _lockService.GetLockType(forceLock); var lockType = _lockService.GetLockType(forceLock);
if(lockType == Enums.LockType.None)
{
return;
}
_settings.AddOrUpdateValue(Constants.Locked, true);
switch(lockType) switch(lockType)
{ {
case Enums.LockType.Fingerprint: case Enums.LockType.Fingerprint:

View file

@ -337,7 +337,6 @@ namespace Bit.App.Pages
private void LockCell_Tapped(object sender, EventArgs e) private void LockCell_Tapped(object sender, EventArgs e)
{ {
_googleAnalyticsService.TrackAppEvent("Locked"); _googleAnalyticsService.TrackAppEvent("Locked");
_settings.AddOrUpdateValue(Constants.Locked, true);
MessagingCenter.Send(Application.Current, "Lock", true); MessagingCenter.Send(Application.Current, "Lock", true);
} }

View file

@ -187,6 +187,8 @@ namespace Bit.App.Services
Email = null; Email = null;
_cryptoService.Key = null; _cryptoService.Key = null;
_settings.Remove(Constants.FirstVaultLoad); _settings.Remove(Constants.FirstVaultLoad);
_settings.Remove(Constants.PushLastRegistrationDate);
_settings.Remove(Constants.Locked);
} }
public async Task<ApiResult<TokenResponse>> TokenPostAsync(TokenRequest request) public async Task<ApiResult<TokenResponse>> TokenPostAsync(TokenRequest request)