1
0
mirror of https://github.com/bitwarden/mobile synced 2025-12-15 15:53:44 +00:00

fix error when login token expires

This commit is contained in:
Kyle Spearrin
2019-10-22 16:30:28 -04:00
parent 0400d79f43
commit e1983a7d66
6 changed files with 39 additions and 10 deletions

View File

@@ -23,7 +23,7 @@ namespace Bit.Core.Services
private readonly ICollectionService _collectionService;
private readonly IStorageService _storageService;
private readonly IMessagingService _messagingService;
private readonly Action _logoutCallback;
private readonly Func<bool, Task> _logoutCallbackAsync;
public SyncService(
IUserService userService,
@@ -35,7 +35,7 @@ namespace Bit.Core.Services
ICollectionService collectionService,
IStorageService storageService,
IMessagingService messagingService,
Action logoutCallback)
Func<bool, Task> logoutCallbackAsync)
{
_userService = userService;
_apiService = apiService;
@@ -46,7 +46,7 @@ namespace Bit.Core.Services
_collectionService = collectionService;
_storageService = storageService;
_messagingService = messagingService;
_logoutCallback = logoutCallback;
_logoutCallbackAsync = logoutCallbackAsync;
}
public bool SyncInProgress { get; set; }
@@ -307,7 +307,10 @@ namespace Bit.Core.Services
var stamp = await _userService.GetSecurityStampAsync();
if(stamp != null && stamp != response.SecurityStamp)
{
_logoutCallback?.Invoke();
if(_logoutCallbackAsync != null)
{
await _logoutCallbackAsync(true);
}
return;
}
await _cryptoService.SetEncKeyAsync(response.Key);