Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Use tryRefreshFlags helper consistently

Prateek Sunal4b8490db5626
diff --git a/mobile/apps/photos/lib/services/account/user_service.dart b/mobile/apps/photos/lib/services/account/user_service.dart
index 2377a3d403..fb2ad632ef 100644
--- a/mobile/apps/photos/lib/services/account/user_service.dart
+++ b/mobile/apps/photos/lib/services/account/user_service.dart
@@ -418,7 +418,7 @@ class UserService {
throw Exception("unexpected response during passkey verification");
}
await dialog.hide();
- await _refreshRemoteFlagsBlocking();
+ await flagService.tryRefreshFlags();
Navigator.of(context).popUntil((route) => route.isFirst);
Bus.instance.fire(AccountConfiguredEvent());
}
@@ -805,7 +805,7 @@ class UserService {
Configuration.instance.getKeyAttributes()!,
keyEncryptionKey: keyEncryptionKey,
);
- await _refreshRemoteFlagsBlocking();
+ await flagService.tryRefreshFlags();
Configuration.instance.resetVolatilePassword();
page = const HomeWidget();
} else {
@@ -1288,14 +1288,6 @@ class UserService {
}
}
- Future<void> _refreshRemoteFlagsBlocking() async {
- try {
- await flagService.refreshFlags();
- } catch (e, s) {
- _logger.warning("Failed to refresh remote feature flags", e, s);
- }
- }
-
Future<void> _saveConfiguration(dynamic response) async {
final responseData = response is Map ? response : response.data as Map?;
if (responseData == null) {
diff --git a/mobile/apps/photos/lib/ui/account/password_reentry_page.dart b/mobile/apps/photos/lib/ui/account/password_reentry_page.dart
index ba00174827..0ff819bd07 100644
--- a/mobile/apps/photos/lib/ui/account/password_reentry_page.dart
+++ b/mobile/apps/photos/lib/ui/account/password_reentry_page.dart
@@ -154,7 +154,7 @@ class _PasswordReentryPageState extends State<PasswordReentryPage> {
}
await dialog.hide();
Configuration.instance.resetVolatilePassword();
- await _refreshRemoteFlagsBlocking();
+ await flagService.tryRefreshFlags();
Bus.instance.fire(SubscriptionPurchasedEvent());
unawaited(
Navigator.of(context).pushAndRemoveUntil(
@@ -188,14 +188,6 @@ class _PasswordReentryPageState extends State<PasswordReentryPage> {
}
}
- Future<void> _refreshRemoteFlagsBlocking() async {
- try {
- await flagService.refreshFlags();
- } catch (e, s) {
- _logger.warning("Failed to refresh remote feature flags", e, s);
- }
- }
-
Widget _getBody() {
return Column(
children: [
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.dart
index 37bb617ac6..4d4c05ac96 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
@@ -89,11 +89,15 @@ class FlagService {
bool get enableOnlyBackupFuturePhotos => internalUser;
bool get facesTimeline => internalUser;
+ bool get ritualsFlag => internalUser;
- Future<void> refreshFlags() async {
- await _fetch();
+ Future<void> tryRefreshFlags() async {
+ try {
+ await _fetch();
+ } catch (e) {
+ debugPrint("Failed to refresh flags: $e");
+ }
}
- bool get ritualsFlag => internalUser;
bool hasSyncedAccountFlags() {
return _prefs.containsKey("remote_flags");