π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Initialize Library Sharing after flag refresh
Neeraj Guptad2451f9a3edb
diff --git a/mobile/apps/photos/lib/main.dart b/mobile/apps/photos/lib/main.dartindex c7c31cfe12..d6bc8cef7f 100644--- a/mobile/apps/photos/lib/main.dart+++ b/mobile/apps/photos/lib/main.dart@@ -504,8 +504,15 @@ Future<void> _init(await SyncService.instance.init(preferences);_isSyncInitialized = true;_logger.info("SyncService init done $tlog");- if (!isBackground && flagService.librarySharing) {- unawaited(librarySharingService.init());+ if (!isBackground) {+ if (flagService.librarySharing) {+ unawaited(librarySharingService.init());+ } else {+ flagService.flagsUpdated+ .firstWhere((_) => flagService.librarySharing)+ .then((_) => librarySharingService.init())+ .ignore();+ }}if (!isBackground && flagService.internalUser) {diff --git a/mobile/apps/photos/plugins/ente_feature_flag/lib/src/service.dart b/mobile/apps/photos/plugins/ente_feature_flag/lib/src/service.dartindex 3876925e8e..8f5dfb2235 100644--- a/mobile/apps/photos/plugins/ente_feature_flag/lib/src/service.dart+++ b/mobile/apps/photos/plugins/ente_feature_flag/lib/src/service.dart@@ -22,6 +22,7 @@ class FlagService {final SharedPreferences _prefs;final Dio _enteDio;+ final _flagsUpdatedController = StreamController<RemoteFlags>.broadcast();FlagService(this._prefs, this._enteDio) {Future.delayed(const Duration(seconds: 5), () {@@ -31,6 +32,8 @@ class FlagService {RemoteFlags? _flags;+ Stream<RemoteFlags> get flagsUpdated => _flagsUpdatedController.stream;+RemoteFlags get flags {try {if (!_prefs.containsKey("remote_flags")) {@@ -172,6 +175,7 @@ class FlagService {final remoteFlags = RemoteFlags.fromMap(response.data);await _prefs.setString("remote_flags", remoteFlags.toJson());_flags = remoteFlags;+ _flagsUpdatedController.add(remoteFlags);} catch (e) {debugPrint("Failed to sync feature flags $e");} finally {@@ -197,6 +201,7 @@ class FlagService {void _updateFlags(RemoteFlags flags) {_flags = flags;+ _flagsUpdatedController.add(flags);_prefs.setString("remote_flags", flags.toJson());_fetch().ignore();}