mirror of
https://github.com/bitwarden/mobile
synced 2025-12-10 13:23:39 +00:00
catch thrown sync errors from ui
This commit is contained in:
13303
src/Android/Resources/Resource.designer.cs
generated
13303
src/Android/Resources/Resource.designer.cs
generated
File diff suppressed because it is too large
Load Diff
@@ -305,9 +305,17 @@ namespace Bit.App.Pages
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await _deviceActionService.ShowLoadingAsync(AppResources.Syncing);
|
await _deviceActionService.ShowLoadingAsync(AppResources.Syncing);
|
||||||
await _syncService.FullSyncAsync(false);
|
try
|
||||||
await _deviceActionService.HideLoadingAsync();
|
{
|
||||||
_platformUtilsService.ShowToast("success", null, AppResources.SyncingComplete);
|
await _syncService.FullSyncAsync(false, true);
|
||||||
|
await _deviceActionService.HideLoadingAsync();
|
||||||
|
_platformUtilsService.ShowToast("success", null, AppResources.SyncingComplete);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
await _deviceActionService.HideLoadingAsync();
|
||||||
|
_platformUtilsService.ShowToast("error", null, AppResources.SyncingFailed);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task LoadDataAsync()
|
private async Task LoadDataAsync()
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ namespace Bit.Core.Abstractions
|
|||||||
{
|
{
|
||||||
bool SyncInProgress { get; set; }
|
bool SyncInProgress { get; set; }
|
||||||
|
|
||||||
Task<bool> FullSyncAsync(bool forceSync);
|
Task<bool> FullSyncAsync(bool forceSync, bool allowThrowOnError = false);
|
||||||
Task<DateTime?> GetLastSyncAsync();
|
Task<DateTime?> GetLastSyncAsync();
|
||||||
Task SetLastSyncAsync(DateTime date);
|
Task SetLastSyncAsync(DateTime date);
|
||||||
Task<bool> SyncDeleteCipherAsync(SyncCipherNotification notification);
|
Task<bool> SyncDeleteCipherAsync(SyncCipherNotification notification);
|
||||||
@@ -16,4 +16,4 @@ namespace Bit.Core.Abstractions
|
|||||||
Task<bool> SyncUpsertCipherAsync(SyncCipherNotification notification, bool isEdit);
|
Task<bool> SyncUpsertCipherAsync(SyncCipherNotification notification, bool isEdit);
|
||||||
Task<bool> SyncUpsertFolderAsync(SyncFolderNotification notification, bool isEdit);
|
Task<bool> SyncUpsertFolderAsync(SyncFolderNotification notification, bool isEdit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ namespace Bit.Core.Services
|
|||||||
await _storageService.SaveAsync(string.Format(Keys_LastSyncFormat, userId), date);
|
await _storageService.SaveAsync(string.Format(Keys_LastSyncFormat, userId), date);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<bool> FullSyncAsync(bool forceSync)
|
public async Task<bool> FullSyncAsync(bool forceSync, bool allowThrowOnError = false)
|
||||||
{
|
{
|
||||||
SyncStarted();
|
SyncStarted();
|
||||||
var isAuthenticated = await _userService.IsAuthenticatedAsync();
|
var isAuthenticated = await _userService.IsAuthenticatedAsync();
|
||||||
@@ -106,7 +106,14 @@ namespace Bit.Core.Services
|
|||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
return SyncCompleted(false);
|
if(allowThrowOnError)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return SyncCompleted(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user