Skip to content

High performance self-hosted photo and video management solution.

fix: not clearing local data when logging out while sync is running (#20646)

Brandon Wees4d0c9172e57f
diff --git a/mobile/lib/domain/utils/background_sync.dart b/mobile/lib/domain/utils/background_sync.dart
index 1944591c93..cbf4030788 100644
--- a/mobile/lib/domain/utils/background_sync.dart
+++ b/mobile/lib/domain/utils/background_sync.dart
@@ -37,7 +37,7 @@ class BackgroundSyncManager {
this.onHashingError,
});
- Future<void> cancel() {
+ Future<void> cancel() async {
final futures = <Future>[];
if (_syncTask != null) {
@@ -52,7 +52,11 @@ class BackgroundSyncManager {
_syncWebsocketTask?.cancel();
_syncWebsocketTask = null;
- return Future.wait(futures);
+ try {
+ await Future.wait(futures);
+ } on CanceledError {
+ // Ignore cancellation errors
+ }
}
// No need to cancel the task, as it can also be run when the user logs out
diff --git a/mobile/lib/main.dart b/mobile/lib/main.dart
index d1f415a304..0bac282694 100644
--- a/mobile/lib/main.dart
+++ b/mobile/lib/main.dart
@@ -83,7 +83,6 @@ Future<void> initApp() async {
};
PlatformDispatcher.instance.onError = (error, stack) {
- debugPrint("FlutterError - Catch all: $error \n $stack");
log.severe('PlatformDispatcher - Catch all', error, stack);
return true;
};