Skip to content

armgit / ente

Public Imported from GitHub
0

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

show get started banner only on second app startup

laurenspriemf820f0359a6d
diff --git a/mobile/apps/photos/lib/ui/home/grant_permissions_widget.dart b/mobile/apps/photos/lib/ui/home/grant_permissions_widget.dart
index 8bf4d24584..bd83f8a7f4 100644
--- a/mobile/apps/photos/lib/ui/home/grant_permissions_widget.dart
+++ b/mobile/apps/photos/lib/ui/home/grant_permissions_widget.dart
@@ -183,6 +183,7 @@ class _GrantPermissionsWidgetState extends State<GrantPermissionsWidget> {
if (state == PermissionState.authorized ||
state == PermissionState.limited) {
await localSettings.setAppMode(AppMode.localGallery);
+ localSettings.localGalleryModeEnabledThisSession = true;
Bus.instance.fire(AppModeChangedEvent());
await permissionService.onUpdatePermission(state);
SyncService.instance.onPermissionGranted().ignore();
diff --git a/mobile/apps/photos/lib/ui/home/header_widget.dart b/mobile/apps/photos/lib/ui/home/header_widget.dart
index 01973d6cf3..56fcc8451c 100644
--- a/mobile/apps/photos/lib/ui/home/header_widget.dart
+++ b/mobile/apps/photos/lib/ui/home/header_widget.dart
@@ -61,7 +61,9 @@ class _HeaderWidgetState extends State<HeaderWidget> {
_logger.info("Building header widget");
final bool showWrappedBanner = wrappedService.shouldShowHomeBanner;
final bool showGetStartedBanner =
- isLocalGalleryMode && !Configuration.instance.hasConfiguredAccount();
+ isLocalGalleryMode &&
+ !localSettings.localGalleryModeEnabledThisSession &&
+ !Configuration.instance.hasConfiguredAccount();
final List<Widget> children = <Widget>[
const StatusBarWidget(),
if (showGetStartedBanner) const GetStartedBanner(),
diff --git a/mobile/apps/photos/lib/utils/local_settings.dart b/mobile/apps/photos/lib/utils/local_settings.dart
index cbf45405e2..7a3c8da8b6 100644
--- a/mobile/apps/photos/lib/utils/local_settings.dart
+++ b/mobile/apps/photos/lib/utils/local_settings.dart
@@ -108,6 +108,12 @@ class LocalSettings {
AppMode? _cachedAppMode;
+ /// True only for the session in which the user just enabled local-gallery
+ /// mode during onboarding. Intentionally not persisted, so it resets to
+ /// false on the next app launch. Used to defer the get-started banner to
+ /// the second app open (after onboarding).
+ bool localGalleryModeEnabledThisSession = false;
+
LocalSettings(this._prefs);
bool _getFlag(LocalGalleryFlag flag) {