π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Add toggle to disable internal user features in mobile app
Prateek Sunalee56a56d9463
diff --git a/mobile/apps/photos/lib/ui/settings/debug/debug_section_widget.dart b/mobile/apps/photos/lib/ui/settings/debug/debug_section_widget.dartindex b5497bc93e..ba7a3bff6d 100644--- a/mobile/apps/photos/lib/ui/settings/debug/debug_section_widget.dart+++ b/mobile/apps/photos/lib/ui/settings/debug/debug_section_widget.dart@@ -33,6 +33,27 @@ class _DebugSectionWidgetState extends State<DebugSectionWidget> {Widget _getSectionOptions(BuildContext context) {return Column(children: [+ sectionOptionSpacing,+ MenuItemWidget(+ captionedTextWidget: const CaptionedTextWidget(+ title: "Disable internal user",+ ),+ pressedColor: getEnteColorScheme(context).fillFaint,+ trailingWidget: ToggleSwitchWidget(+ value: () => localSettings.isInternalUserDisabled,+ onChanged: () async {+ final newValue = !localSettings.isInternalUserDisabled;+ await localSettings.setInternalUserDisabled(newValue);+ setState(() {});+ showShortToast(+ context,+ newValue+ ? "Internal user disabled. Restart app."+ : "Internal user enabled. Restart app.",+ );+ },+ ),+ ),sectionOptionSpacing,MenuItemWidget(captionedTextWidget: const CaptionedTextWidget(diff --git a/mobile/apps/photos/lib/ui/settings_page.dart b/mobile/apps/photos/lib/ui/settings_page.dartindex a369c73499..be60a2b700 100644--- a/mobile/apps/photos/lib/ui/settings_page.dart+++ b/mobile/apps/photos/lib/ui/settings_page.dart@@ -169,7 +169,7 @@ class SettingsPage extends StatelessWidget {const AboutSectionWidget(),]);- if (hasLoggedIn && flagService.internalUser) {+ if (hasLoggedIn && flagService.isInternalUserOrDebug) {contents.addAll([sectionSpacing, const DebugSectionWidget()]);contents.addAll([sectionSpacing, const MLDebugSectionWidget()]);}diff --git a/mobile/apps/photos/lib/utils/local_settings.dart b/mobile/apps/photos/lib/utils/local_settings.dartindex aa2170737b..726449c4c8 100644--- a/mobile/apps/photos/lib/utils/local_settings.dart+++ b/mobile/apps/photos/lib/utils/local_settings.dart@@ -45,6 +45,7 @@ class LocalSettings {static const kCollectionSortDirection = "collection_sort_direction";static const kShowLocalIDOverThumbnails = "show_local_id_over_thumbnails";static const kEnableDatabaseLogging = "enable_db_logging";+ static const _kInternalUserDisabled = "ls.internal_user_disabled";static const _kWrapped2025ResumeIndex = "ls.wrapped_2025_resume_index";static const _kWrapped2025Complete = "ls.wrapped_2025_complete";@@ -238,6 +239,13 @@ class LocalSettings {await _prefs.setBool(kEnableDatabaseLogging, value);}+ bool get isInternalUserDisabled =>+ _prefs.getBool(_kInternalUserDisabled) ?? false;++ Future<void> setInternalUserDisabled(bool value) async {+ await _prefs.setBool(_kInternalUserDisabled, value);+ }+int wrapped2025ResumeIndex() {return _prefs.getInt(_kWrapped2025ResumeIndex) ?? 0;}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 157eff4605..b50076e425 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@@ -42,7 +42,17 @@ class FlagService {bool get disableCFWorker => flags.disableCFWorker;- bool get internalUser => flags.internalUser || kDebugMode;+ /// Returns true if the user is an internal user, respecting the debug toggle.+ /// Use [isInternalUserOrDebug] for UI visibility that should persist even when disabled.+ bool get internalUser {+ final isDisabled = _prefs.getBool("ls.internal_user_disabled") ?? false;+ return (flags.internalUser || kDebugMode) && !isDisabled;+ }++ /// Returns true if the user is an internal user OR in debug mode,+ /// ignoring the debug toggle. Use this for showing debug UI elements.+ bool get isInternalUserOrDebug => flags.internalUser || kDebugMode;+bool get enableAdminRole => internalUser;bool get surfacePublicLink => internalUser;