private async Task LogOutAsync(bool expired) { var userId = await _userService.GetUserIdAsync(); await Task.WhenAll( _syncService.SetLastSyncAsync(DateTime.MinValue), _tokenService.ClearTokenAsync(), _cryptoService.ClearKeysAsync(), _userService.ClearAsync(), _settingsService.ClearAsync(userId), _cipherService.ClearAsync(userId), _folderService.ClearAsync(userId), _collectionService.ClearAsync(userId), _passwordGenerationService.ClearAsync(), _vaultTimeoutService.ClearAsync(), _stateService.PurgeAsync(), _deviceActionService.ClearCacheAsync()); _vaultTimeoutService.BiometricLocked = true; _searchService.ClearIndex(); _authService.LogOut(() => { Current.MainPage = new HomePage(); if (expired) { _platformUtilsService.ShowToast("warning", null, AppResources.LoginExpired); } }); }
private async Task ClearCacheIfNeededAsync() { var lastClear = await _storageService.GetAsync <DateTime?>(Constants.LastFileCacheClearKey); if ((DateTime.UtcNow - lastClear.GetValueOrDefault(DateTime.MinValue)).TotalDays >= 1) { var task = Task.Run(() => _deviceActionService.ClearCacheAsync()); } }