π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Guard duplicate app initialization
Neeraj Gupta6176ec581444
diff --git a/mobile/apps/photos/lib/main.dart b/mobile/apps/photos/lib/main.dartindex ba31f0c296..6343844dc3 100644--- a/mobile/apps/photos/lib/main.dart+++ b/mobile/apps/photos/lib/main.dart@@ -81,6 +81,7 @@ const kBGPushTimeout = Duration(seconds: 28);const kFGTaskDeathTimeoutInMicroseconds = 5000000;bool isProcessBg = true;bool _stopHearBeat = false;+bool _isSyncInitialized = false;bool _isRustInitialized = false;Future<void>? _rustInitFuture;@@ -310,6 +311,7 @@ Future<void> _runMinimally(String taskId, TimeLogger tlog) async {await LocalSyncService.instance.init(prefs);RemoteSyncService.instance.init(prefs);await SyncService.instance.init(prefs);+ _isSyncInitialized = true;// Misc Servicesawait UserService.instance.init();@@ -487,6 +489,7 @@ Future<void> _init(_logger.info("SyncService init $tlog");await SyncService.instance.init(preferences);+ _isSyncInitialized = true;_logger.info("SyncService init done $tlog");if (!isBackground && flagService.internalUser) {@@ -684,7 +687,11 @@ Future<void> _handleBackgroundPush(Object message) async {DateTime.now().microsecondsSinceEpoch,);- await _init(true, via: 'firebasePush');+ if (!_isSyncInitialized) {+ await _init(true, via: 'firebasePush');+ } else {+ _logger.info("Skipping background init; sync already initialized");+ }if (PushService.shouldSync(message)) {await _sync('firebaseBgSyncNoActiveProcess');}