Skip to content

armgit / ente

Public Imported from GitHub
0

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

[mob][photos] Fix changelog showing on fresh install (#9947)

Laurens Priem5d3811e095a3
diff --git a/mobile/apps/photos/lib/services/update_service.dart b/mobile/apps/photos/lib/services/update_service.dart
index 3609be9de9..ae1dcd8d49 100644
--- a/mobile/apps/photos/lib/services/update_service.dart
+++ b/mobile/apps/photos/lib/services/update_service.dart
@@ -37,7 +37,13 @@ class UpdateService {
Future<bool> shouldShowChangeLog() async {
// fetch the change log version which was last shown to user.
- final lastShownAtVersion = _prefs.getInt(changeLogVersionKey) ?? 0;
+ final lastShownAtVersion = _prefs.getInt(changeLogVersionKey);
+ if (lastShownAtVersion == null) {
+ // Fresh install: the key was never set, so the user has no previous
+ // version to show a "What's New" for. Silently mark as seen.
+ await hideChangeLog();
+ return false;
+ }
return lastShownAtVersion < currentChangeLogVersion;
}
diff --git a/mobile/apps/photos/lib/ui/tabs/home_widget.dart b/mobile/apps/photos/lib/ui/tabs/home_widget.dart
index 14cfe82835..bd15d0b443 100644
--- a/mobile/apps/photos/lib/ui/tabs/home_widget.dart
+++ b/mobile/apps/photos/lib/ui/tabs/home_widget.dart
@@ -1124,11 +1124,11 @@ class _HomeWidgetState extends State<HomeWidget> {
);
},
);
+ // Do not show change dialog again
+ await updateService.hideChangeLog();
} finally {
_isShowingChangeLog = false;
}
- // Do not show change dialog again
- updateService.hideChangeLog().ignore();
}
void _onDidReceiveNotificationResponse(