Skip to content

High performance self-hosted photo and video management solution.

chore(mobile): nudge users to switch to the new timeline (#26458)

shenlongf616de5af87a
diff --git a/mobile/lib/pages/common/splash_screen.page.dart b/mobile/lib/pages/common/splash_screen.page.dart
index c7d786626c..0d728422d1 100644
--- a/mobile/lib/pages/common/splash_screen.page.dart
+++ b/mobile/lib/pages/common/splash_screen.page.dart
@@ -109,9 +109,43 @@ class SplashScreenPageState extends ConsumerState<SplashScreenPage> {
if (context.router.current.name == SplashScreenRoute.name) {
final needBetaMigration = Store.get(StoreKey.needBetaMigration, false);
if (needBetaMigration) {
+ bool migrate =
+ (await showDialog<bool>(
+ context: context,
+ builder: (ctx) => AlertDialog(
+ title: const Text("New Timeline Experience"),
+ content: const Text(
+ "The old timeline has been deprecated and will be removed in an upcoming release. Would you like to switch to the new timeline now?",
+ ),
+ actions: [
+ TextButton(onPressed: () => Navigator.of(ctx).pop(false), child: const Text("No")),
+ ElevatedButton(onPressed: () => Navigator.of(ctx).pop(true), child: const Text("Yes")),
+ ],
+ ),
+ )) ??
+ false;
+ if (migrate != true) {
+ migrate =
+ (await showDialog<bool>(
+ context: context,
+ builder: (ctx) => AlertDialog(
+ title: const Text("Are you sure?"),
+ content: const Text(
+ "If you choose to remain on the old timeline, you will be automatically migrated to the new timeline in an upcoming release. Would you like to switch now?",
+ ),
+ actions: [
+ TextButton(onPressed: () => Navigator.of(ctx).pop(false), child: const Text("No")),
+ ElevatedButton(onPressed: () => Navigator.of(ctx).pop(true), child: const Text("Yes")),
+ ],
+ ),
+ )) ??
+ false;
+ }
await Store.put(StoreKey.needBetaMigration, false);
- unawaited(context.router.replaceAll([ChangeExperienceRoute(switchingToBeta: true)]));
- return;
+ if (migrate) {
+ unawaited(context.router.replaceAll([ChangeExperienceRoute(switchingToBeta: true)]));
+ return;
+ }
}
unawaited(context.replaceRoute(Store.isBetaTimelineEnabled ? const TabShellRoute() : const TabControllerRoute()));
diff --git a/mobile/lib/utils/migration.dart b/mobile/lib/utils/migration.dart
index 70f9ba88c7..30a46daa56 100644
--- a/mobile/lib/utils/migration.dart
+++ b/mobile/lib/utils/migration.dart
@@ -30,11 +30,10 @@ import 'package:immich_mobile/utils/datetime_helpers.dart';
import 'package:immich_mobile/utils/debug_print.dart';
import 'package:immich_mobile/utils/diff.dart';
import 'package:isar/isar.dart';
-
// ignore: import_rule_photo_manager
import 'package:photo_manager/photo_manager.dart';
-const int targetVersion = 21;
+const int targetVersion = 22;
Future<void> migrateDatabaseIfNeeded(Isar db, Drift drift) async {
final hasVersion = Store.tryGet(StoreKey.version) != null;
@@ -100,6 +99,10 @@ Future<void> migrateDatabaseIfNeeded(Isar db, Drift drift) async {
}
}
+ if (version < 22 && !Store.isBetaTimelineEnabled) {
+ await Store.put(StoreKey.needBetaMigration, true);
+ }
+
if (targetVersion >= 12) {
await Store.put(StoreKey.version, targetVersion);
return;
diff --git a/mobile/lib/widgets/settings/advanced_settings.dart b/mobile/lib/widgets/settings/advanced_settings.dart
index d6b516a078..e86d313294 100644
--- a/mobile/lib/widgets/settings/advanced_settings.dart
+++ b/mobile/lib/widgets/settings/advanced_settings.dart
@@ -135,7 +135,7 @@ class AdvancedSettings extends HookConsumerWidget {
title: "advanced_settings_enable_alternate_media_filter_title".tr(),
subtitle: "advanced_settings_enable_alternate_media_filter_subtitle".tr(),
),
- const BetaTimelineListTile(),
+ if (!Store.isBetaTimelineEnabled) const BetaTimelineListTile(),
if (Store.isBetaTimelineEnabled)
SettingsSwitchListTile(
valueNotifier: readonlyModeEnabled,