π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
fix route for widget/notification
AmanRajSinghMourya6150196d2a5c
diff --git a/mobile/apps/photos/ios/Podfile.lock b/mobile/apps/photos/ios/Podfile.lockindex 8896f1c714..34e498dde7 100644--- a/mobile/apps/photos/ios/Podfile.lock+++ b/mobile/apps/photos/ios/Podfile.lock@@ -18,6 +18,8 @@ PODS:- Flutter- ente_photos_rust (0.0.1):- Flutter+ - ente_qr (0.0.1):+ - Flutter- ente_rust (0.0.1):- Flutter- ffmpeg_kit_custom (6.0.3)@@ -271,6 +273,7 @@ DEPENDENCIES:- dart_ui_isolate (from `.symlinks/plugins/dart_ui_isolate/ios`)- device_info_plus (from `.symlinks/plugins/device_info_plus/ios`)- ente_photos_rust (from `.symlinks/plugins/ente_photos_rust/ios`)+ - ente_qr (from `.symlinks/plugins/ente_qr/ios`)- ente_rust (from `.symlinks/plugins/ente_rust/ios`)- ffmpeg_kit_flutter (from `.symlinks/plugins/ffmpeg_kit_flutter/ios`)- file_saver (from `.symlinks/plugins/file_saver/ios`)@@ -369,6 +372,8 @@ EXTERNAL SOURCES::path: ".symlinks/plugins/device_info_plus/ios"ente_photos_rust::path: ".symlinks/plugins/ente_photos_rust/ios"+ ente_qr:+ :path: ".symlinks/plugins/ente_qr/ios"ente_rust::path: ".symlinks/plugins/ente_rust/ios"ffmpeg_kit_flutter:@@ -490,6 +495,7 @@ SPEC CHECKSUMS:dart_ui_isolate: 46f6714abe6891313267153ef6f9748d8ecfcab1device_info_plus: 21fcca2080fbcd348be798aa36c3e5ed849eefbeente_photos_rust: 79732f3ba67df7b0fb22089627afb80d692c2b2d+ ente_qr: 2a30f91f9e938c229ebcbc98a6f8f018d1ac665dente_rust: 9c976e3d083f0ce90f31693deb99629b28d8fe4cffmpeg_kit_custom: 682b4f2f1ff1f8abae5a92f6c3540f2441d5be99ffmpeg_kit_flutter: 915b345acc97d4142e8a9a8549d177ff10f043f5diff --git a/mobile/apps/photos/ios/Runner.xcodeproj/project.pbxproj b/mobile/apps/photos/ios/Runner.xcodeproj/project.pbxprojindex 9fbcd71200..ca3d7ec9bc 100644--- a/mobile/apps/photos/ios/Runner.xcodeproj/project.pbxproj+++ b/mobile/apps/photos/ios/Runner.xcodeproj/project.pbxproj@@ -637,6 +637,7 @@"${BUILT_PRODUCTS_DIR}/dart_ui_isolate/dart_ui_isolate.framework","${BUILT_PRODUCTS_DIR}/device_info_plus/device_info_plus.framework","${BUILT_PRODUCTS_DIR}/ente_photos_rust/ente_photos_rust.framework",+ "${BUILT_PRODUCTS_DIR}/ente_qr/ente_qr.framework","${BUILT_PRODUCTS_DIR}/ente_rust/ente_rust.framework","${BUILT_PRODUCTS_DIR}/file_saver/file_saver.framework","${BUILT_PRODUCTS_DIR}/flutter_email_sender/flutter_email_sender.framework",@@ -739,6 +740,7 @@"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/dart_ui_isolate.framework","${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/device_info_plus.framework","${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ente_photos_rust.framework",+ "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ente_qr.framework","${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ente_rust.framework","${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/file_saver.framework","${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_email_sender.framework",diff --git a/mobile/apps/photos/lib/app.dart b/mobile/apps/photos/lib/app.dartindex 21f7acdb15..3cd0bccc3a 100644--- a/mobile/apps/photos/lib/app.dart+++ b/mobile/apps/photos/lib/app.dart@@ -17,6 +17,7 @@ import "package:photos/generated/l10n.dart";import "package:photos/l10n/l10n.dart";import "package:photos/service_locator.dart";import 'package:photos/services/app_lifecycle_service.dart';+import "package:photos/services/app_navigation_service.dart";import "package:photos/services/home_widget_service.dart";import "package:photos/services/memory_home_widget_service.dart";import "package:photos/services/people_home_widget_service.dart";@@ -95,12 +96,19 @@ class _EnteAppState extends State<EnteApp> with WidgetsBindingObserver {}Future<void> _checkForWidgetLaunch() async {+ _logger.info("Initializing widget launch handling");await HomeWidgetService.instance.setAppGroup();await hw.HomeWidget.initiallyLaunchedFromHomeWidget().then(- (uri) => HomeWidgetService.instance.onLaunchFromWidget(uri, context),+ (uri) {+ _logger.info("Initial widget launch URI received: $uri");+ return HomeWidgetService.instance.onLaunchFromWidget(uri);+ },);_widgetClickedSubscription = hw.HomeWidget.widgetClicked.listen(- (uri) => HomeWidgetService.instance.onLaunchFromWidget(uri, context),+ (uri) {+ _logger.info("Widget click stream URI received: $uri");+ unawaited(HomeWidgetService.instance.onLaunchFromWidget(uri));+ },);}@@ -132,6 +140,7 @@ class _EnteAppState extends State<EnteApp> with WidgetsBindingObserver {dark: darkThemeData,initial: widget.savedThemeMode ?? AdaptiveThemeMode.system,builder: (lightTheme, dartTheme) => MaterialApp(+ navigatorKey: AppNavigationService.instance.navigatorKey,title: "ente",themeMode: ThemeMode.system,theme: lightTheme,@@ -162,6 +171,7 @@ class _EnteAppState extends State<EnteApp> with WidgetsBindingObserver {computeController.onUserInteraction();},child: MaterialApp(+ navigatorKey: AppNavigationService.instance.navigatorKey,title: "ente",themeMode: ThemeMode.system,theme: lightThemeData,diff --git a/mobile/apps/photos/lib/services/album_home_widget_service.dart b/mobile/apps/photos/lib/services/album_home_widget_service.dartindex a1607e75d9..8bc5fc8ee9 100644--- a/mobile/apps/photos/lib/services/album_home_widget_service.dart+++ b/mobile/apps/photos/lib/services/album_home_widget_service.dart@@ -4,7 +4,6 @@ import "dart:math";import "package:collection/collection.dart";import 'package:crypto/crypto.dart';-import 'package:ente_pure_utils/ente_pure_utils.dart';import 'package:flutter/material.dart';import 'package:fluttertoast/fluttertoast.dart';import 'package:logging/logging.dart';@@ -13,6 +12,7 @@ import 'package:photos/models/collection/collection.dart';import 'package:photos/models/collection/collection_items.dart';import 'package:photos/models/file/file.dart';import 'package:photos/service_locator.dart';+import 'package:photos/services/app_navigation_service.dart';import 'package:photos/services/collections_service.dart';import 'package:photos/services/favorites_service.dart';import 'package:photos/services/home_widget_service.dart';@@ -163,8 +163,10 @@ class AlbumHomeWidgetService {Future<void> onLaunchFromWidget(int fileId,int collectionId,- BuildContext context,) async {+ _logger.info(+ "Album widget launch entered: fileId=$fileId collectionId=$collectionId",+ );final collection =CollectionsService.instance.getCollectionByID(collectionId);if (collection == null) {@@ -176,12 +178,16 @@ class AlbumHomeWidgetService {// First navigate to the collection pagefinal thumbnail = await CollectionsService.instance.getCover(collection);- routeToPage(- context,- CollectionPage(- CollectionWithThumbnail(collection, thumbnail),- ),- ).ignore();+ _logger.info(+ "Album widget: pushing collection page for collectionId=$collectionId",+ );+ AppNavigationService.instance+ .pushPage(+ CollectionPage(+ CollectionWithThumbnail(collection, thumbnail),+ ),+ )+ .ignore();final getAllFilesCollection =await FilesDB.instance.getAllFilesCollection(collection.id);@@ -192,17 +198,21 @@ class AlbumHomeWidgetService {return;}- routeToPage(- context,- DetailPage(- DetailPageConfiguration(- getAllFilesCollection,- getAllFilesCollection.indexOf(file),- "albumwidget",- ),- ),- forceCustomPageRoute: true,- ).ignore();+ _logger.info(+ "Album widget: pushing detail page for collectionId=$collectionId fileId=$fileId",+ );+ AppNavigationService.instance+ .pushPage(+ DetailPage(+ DetailPageConfiguration(+ getAllFilesCollection,+ getAllFilesCollection.indexOf(file),+ "albumwidget",+ ),+ ),+ forceCustomPageRoute: true,+ )+ .ignore();await _refreshAlbumsWidget();}diff --git a/mobile/apps/photos/lib/services/app_navigation_service.dart b/mobile/apps/photos/lib/services/app_navigation_service.dartnew file mode 100644index 0000000000..a7f81e9ee0--- /dev/null+++ b/mobile/apps/photos/lib/services/app_navigation_service.dart@@ -0,0 +1,117 @@+import 'dart:async';+import 'dart:io';++import 'package:ente_pure_utils/ente_pure_utils.dart';+import 'package:flutter/material.dart';+import 'package:logging/logging.dart';++/// Routes pages onto the inner Photos app navigator.+///+/// The Photos app is currently wrapped by an outer `AppLock` `MaterialApp`+/// that owns the lock-screen navigator, while `EnteApp` creates the real app+/// `MaterialApp` inside it. External entry points such as widgets and+/// notifications can arrive while the app is backgrounded and locked. In those+/// cases, a random `BuildContext` may resolve to the outer lock navigator,+/// causing the destination page to be pushed on the wrong stack.+///+/// Use this service for navigation that must land on the actual app stack even+/// when the app is resuming from background, opening from a widget, or handling+/// a notification/deep link without a reliable inner-app `BuildContext`.+///+/// Do not use this service for ordinary in-app navigation where a local page+/// context is already available and intentionally scoped to the current nested+/// navigator tree.+class AppNavigationService {+ AppNavigationService._privateConstructor();++ static final AppNavigationService instance =+ AppNavigationService._privateConstructor();++ final GlobalKey<NavigatorState> navigatorKey = GlobalKey<NavigatorState>();+ final Logger _logger = Logger("AppNavigationService");++ NavigatorState? get navigator => navigatorKey.currentState;++ /// Pushes a page onto the inner app navigator.+ ///+ /// This waits briefly for the inner `MaterialApp` to finish rebuilding during+ /// resume/unlock so callers from widget and notification handlers do not have+ /// to coordinate navigator readiness themselves.+ Future<T?> pushPage<T extends Object>(+ Widget page, {+ bool forceCustomPageRoute = false,+ }) async {+ final pageName = page.runtimeType.toString();+ _logger.info(+ "Inner navigator push requested: page=$pageName forceCustomPageRoute=$forceCustomPageRoute",+ );+ final navigator = await _waitForNavigator();+ if (navigator == null) {+ _logger+ .warning("Skipping navigation because app navigator is unavailable");+ return null;+ }++ _logger.info("Inner navigator ready; pushing page=$pageName");+ if (Platform.isAndroid || forceCustomPageRoute) {+ return navigator.push(+ _buildPageRoute(page),+ );+ }++ return navigator.push(+ SwipeableRouteBuilder(+ pageBuilder: (context, animation, secondaryAnimation) {+ return page;+ },+ ),+ );+ }++ /// The inner navigator can be temporarily unavailable while Flutter is+ /// restoring the app tree after resume or unlock. Poll a small number of+ /// frames so external launch handlers can still navigate deterministically.+ Future<NavigatorState?> _waitForNavigator() async {+ for (var attempt = 0; attempt < 60; attempt++) {+ final currentNavigator = navigator;+ if (currentNavigator != null) {+ if (attempt > 0) {+ _logger.info(+ "Inner navigator became available after ${attempt + 1} checks",+ );+ }+ return currentNavigator;+ }+ await Future<void>.delayed(const Duration(milliseconds: 16));+ }+ _logger.warning("Inner navigator did not become ready in time");+ return null;+ }+}++PageRouteBuilder<T> _buildPageRoute<T extends Object>(Widget page) {+ return PageRouteBuilder(+ pageBuilder: (+ BuildContext context,+ Animation<double> animation,+ Animation<double> secondaryAnimation,+ ) {+ return page;+ },+ transitionsBuilder: (+ BuildContext context,+ Animation<double> animation,+ Animation<double> secondaryAnimation,+ Widget child,+ ) {+ return Align(+ child: FadeTransition(+ opacity: animation,+ child: child,+ ),+ );+ },+ transitionDuration: const Duration(milliseconds: 200),+ opaque: false,+ );+}diff --git a/mobile/apps/photos/lib/services/home_widget_service.dart b/mobile/apps/photos/lib/services/home_widget_service.dartindex cb08bab415..0391a9de55 100644--- a/mobile/apps/photos/lib/services/home_widget_service.dart+++ b/mobile/apps/photos/lib/services/home_widget_service.dart@@ -243,7 +243,8 @@ class HomeWidgetService {}/// Handle app launch from a widget- Future<void> onLaunchFromWidget(Uri? uri, BuildContext context) async {+ Future<void> onLaunchFromWidget(Uri? uri) async {+ _logger.info("Widget launch callback entered: uri=$uri");if (uri == null) {_logger.warning("Widget launch failed: URI is null");return;@@ -256,13 +257,16 @@ class HomeWidgetService {return;}+ _logger.info(+ "Parsed widget launch: scheme=${uri.scheme} generatedId=$generatedId mainKey=${uri.queryParameters[MAIN_KEY_PARAM]}",+ );+// Route to appropriate handler based on widget schemeswitch (uri.scheme) {case MEMORY_WIDGET_SCHEME:_logger.info("Launching app from memory widget");await MemoryHomeWidgetService.instance.onLaunchFromWidget(generatedId,- context,);break;@@ -272,7 +276,6 @@ class HomeWidgetService {await PeopleHomeWidgetService.instance.onLaunchFromWidget(generatedId,personId,- context,);break;@@ -290,7 +293,6 @@ class HomeWidgetService {await AlbumHomeWidgetService.instance.onLaunchFromWidget(generatedId,collectionId,- context,);break;diff --git a/mobile/apps/photos/lib/services/memories_cache_service.dart b/mobile/apps/photos/lib/services/memories_cache_service.dartindex bacdd9eada..8294c5443d 100644--- a/mobile/apps/photos/lib/services/memories_cache_service.dart+++ b/mobile/apps/photos/lib/services/memories_cache_service.dart@@ -21,6 +21,7 @@ import "package:photos/models/memories/people_memory.dart";import "package:photos/models/memories/smart_memory.dart";import "package:photos/models/memories/smart_memory_constants.dart";import "package:photos/service_locator.dart";+import "package:photos/services/app_navigation_service.dart";import "package:photos/services/language_service.dart";import "package:photos/services/machine_learning/face_ml/person/person_service.dart";import "package:photos/services/notification_service.dart";@@ -761,9 +762,12 @@ class MemoriesCacheService {}Future<void> goToMemoryFromGeneratedFileID(- BuildContext context,- int generatedFileID,- ) async {+ int generatedFileID, {+ BuildContext? context,+ }) async {+ _logger.info(+ "Memory routing entered for generatedFileID=$generatedFileID contextProvided=${context != null}",+ );final allMemories = await getMemories();if (allMemories.isEmpty) return;int memoryIdx = 0;@@ -787,8 +791,10 @@ class MemoriesCacheService {);return;}- await routeToPage(- context,+ _logger.info(+ "Memory routing resolved: generatedFileID=$generatedFileID memoryIdx=$memoryIdx fileIdx=$fileIdx",+ );+ await _routeToPage(AllMemoriesPage(allMemories: _cachedMemories!.map((e) => e.memories).toList(),allTitles: _cachedMemories!.map((e) => e.title).toList(),@@ -796,11 +802,15 @@ class MemoriesCacheService {inititalFileIndex: fileIdx,isFromWidgetOrNotifications: true,),+ context: context,forceCustomPageRoute: true,);}- Future<void> goToOnThisDayMemory(BuildContext context) async {+ Future<void> goToOnThisDayMemory({BuildContext? context}) async {+ _logger.info(+ "On-this-day routing entered: contextProvided=${context != null}",+ );final allMemories = await getMemories();if (allMemories.isEmpty) return;int memoryIdx = 0;@@ -819,8 +829,8 @@ class MemoriesCacheService {);return;}- await routeToPage(- context,+ _logger.info("On-this-day routing resolved: memoryIdx=$memoryIdx");+ await _routeToPage(AllMemoriesPage(allMemories: allMemories.map((e) => e.memories).toList(),allTitles: allMemories.map((e) => e.title).toList(),@@ -828,12 +838,18 @@ class MemoriesCacheService {inititalFileIndex: 0,isFromWidgetOrNotifications: true,),+ context: context,forceCustomPageRoute: true,);}- Future<void> goToPersonMemory(BuildContext context, String personID) async {- _logger.info("Going to person memory for personID: $personID");+ Future<void> goToPersonMemory(+ String personID, {+ BuildContext? context,+ }) async {+ _logger.info(+ "Person memory routing entered: personID=$personID contextProvided=${context != null}",+ );final allMemories = await getMemories();if (allMemories.isEmpty) return;final personMemories = <PeopleMemory>[];@@ -875,18 +891,18 @@ class MemoriesCacheService {_logger.severe("Person with ID $personID not found");return;}- await routeToPage(- context,+ await _routeToPage(PeoplePage(person: person,searchResult: null,),+ context: context,forceCustomPageRoute: true,);+ _logger.info("Person memory routing fell back to PeoplePage");}_logger.info("Routing to the birthday memory");- await routeToPage(- context,+ await _routeToPage(FullScreenMemoryDataUpdater(initialIndex: 0,memories: personMemory!.memories,@@ -897,10 +913,34 @@ class MemoriesCacheService {child: FullScreenMemory(personMemory.title, 0),),),+ context: context,forceCustomPageRoute: true,);}+ Future<void> _routeToPage(+ Widget page, {+ BuildContext? context,+ bool forceCustomPageRoute = false,+ }) async {+ _logger.info(+ "Routing page=${page.runtimeType} via ${context != null ? "context" : "inner_app_navigator"} forceCustomPageRoute=$forceCustomPageRoute",+ );+ if (context != null) {+ await routeToPage(+ context,+ page,+ forceCustomPageRoute: forceCustomPageRoute,+ );+ return;+ }++ await AppNavigationService.instance.pushPage(+ page,+ forceCustomPageRoute: forceCustomPageRoute,+ );+ }+Future<void> toggleOnThisDayNotifications() async {final oldValue = localSettings.isOnThisDayNotificationsEnabled;await localSettings.setOnThisDayNotificationsEnabled(!oldValue);diff --git a/mobile/apps/photos/lib/services/memory_home_widget_service.dart b/mobile/apps/photos/lib/services/memory_home_widget_service.dartindex 43c876fbd6..b50deccc70 100644--- a/mobile/apps/photos/lib/services/memory_home_widget_service.dart+++ b/mobile/apps/photos/lib/services/memory_home_widget_service.dart@@ -147,13 +147,9 @@ class MemoryHomeWidgetService {);}- Future<void> onLaunchFromWidget(int generatedId, BuildContext context) async {- memoriesCacheService- .goToMemoryFromGeneratedFileID(- context,- generatedId,- )- .ignore();+ Future<void> onLaunchFromWidget(int generatedId) async {+ _logger.info("Memory widget launch entered: generatedId=$generatedId");+ memoriesCacheService.goToMemoryFromGeneratedFileID(generatedId).ignore();await _refreshMemoriesWidget();}diff --git a/mobile/apps/photos/lib/services/people_home_widget_service.dart b/mobile/apps/photos/lib/services/people_home_widget_service.dartindex ae3cf3a600..e70f97c716 100644--- a/mobile/apps/photos/lib/services/people_home_widget_service.dart+++ b/mobile/apps/photos/lib/services/people_home_widget_service.dart@@ -1,13 +1,13 @@import "dart:math";import "package:collection/collection.dart";-import 'package:ente_pure_utils/ente_pure_utils.dart';import 'package:flutter/material.dart';import 'package:fluttertoast/fluttertoast.dart';import 'package:logging/logging.dart';import 'package:photos/db/files_db.dart';import 'package:photos/models/file/file.dart';import 'package:photos/service_locator.dart';+import 'package:photos/services/app_navigation_service.dart';import 'package:photos/services/home_widget_service.dart';import 'package:photos/services/machine_learning/face_ml/person/person_service.dart';import 'package:photos/services/search_service.dart';@@ -155,8 +155,10 @@ class PeopleHomeWidgetService {Future<void> onLaunchFromWidget(int fileId,String personId,- BuildContext context,) async {+ _logger.info(+ "People widget launch entered: fileId=$fileId personId=$personId",+ );final file = await FilesDB.instance.getFile(fileId);if (file == null) {_logger.warning("Cannot launch widget: file with ID $fileId not found");@@ -170,31 +172,37 @@ class PeopleHomeWidgetService {return;}- routeToPage(- context,- PeoplePage(- person: person,- searchResult: null,- ),- forceCustomPageRoute: true,- ).ignore();+ _logger.info("People widget: pushing people page for personId=$personId");+ AppNavigationService.instance+ .pushPage(+ PeoplePage(+ person: person,+ searchResult: null,+ ),+ forceCustomPageRoute: true,+ )+ .ignore();final files = await SearchService.instance.getFilesForPersonID(personId,sortOnTime: false,);- routeToPage(- context,- DetailPage(- DetailPageConfiguration(- files,- files.indexOf(file),- "peoplewidget",- ),- ),- forceCustomPageRoute: true,- ).ignore();+ _logger.info(+ "People widget: pushing detail page for personId=$personId fileId=$fileId",+ );+ AppNavigationService.instance+ .pushPage(+ DetailPage(+ DetailPageConfiguration(+ files,+ files.indexOf(file),+ "peoplewidget",+ ),+ ),+ forceCustomPageRoute: true,+ )+ .ignore();await _refreshPeopleWidget();}diff --git a/mobile/apps/photos/lib/ui/tabs/home_widget.dart b/mobile/apps/photos/lib/ui/tabs/home_widget.dartindex b2566b1e70..35d35439ac 100644--- a/mobile/apps/photos/lib/ui/tabs/home_widget.dart+++ b/mobile/apps/photos/lib/ui/tabs/home_widget.dart@@ -43,6 +43,7 @@ import "package:photos/service_locator.dart";import "package:photos/services/account/user_service.dart";import "package:photos/services/album_home_widget_service.dart";import "package:photos/services/app_lifecycle_service.dart";+import "package:photos/services/app_navigation_service.dart";import "package:photos/services/collections_service.dart";import "package:photos/services/machine_learning/face_ml/person/person_service.dart";import "package:photos/services/memory_home_widget_service.dart";@@ -1105,6 +1106,7 @@ class _HomeWidgetState extends State<HomeWidget> {if (!mounted) return;final String? payload = notificationResponse.payload;if (payload != null) {+ _logger.info("Notification tap entered: payload=$payload");debugPrint('notification payload: $payload');final uri = Uri.tryParse(payload);if (uri != null &&@@ -1124,18 +1126,22 @@ class _HomeWidgetState extends State<HomeWidget> {if (!mounted || !canOpenRitual) {return;}+ _logger.info(+ "Notification tap: pushing ritual page for ritualId=$ritualId",+ );// Ensure the camera is stacked on top of the ritual page so the user// lands on the ritual details after adding photos via a notification.// ignore: unawaited_futures- routeToPage(- context,+ AppNavigationService.instance.pushPage(RitualPage(ritualId: ritualId),);}if (!canOpenRitual) return;+ _logger.info(+ "Notification tap: pushing ritual camera page for ritualId=$ritualId albumId=$albumId",+ );// ignore: unawaited_futures- routeToPage(- context,+ AppNavigationService.instance.pushPage(RitualCameraPage(ritualId: ritualId,albumId: albumId,@@ -1148,9 +1154,9 @@ class _HomeWidgetState extends State<HomeWidget> {return;}final target = FeedNavigationTarget.fromUri(uri);+ _logger.info("Notification tap: pushing feed screen target=$target");// ignore: unawaited_futures- routeToPage(- context,+ AppNavigationService.instance.pushPage(FeedScreen(initialTarget: target,),@@ -1160,23 +1166,25 @@ class _HomeWidgetState extends State<HomeWidget> {if (payload.toLowerCase().contains("onthisday")) {_logger.info("On this day notification received");// ignore: unawaited_futures- memoriesCacheService.goToOnThisDayMemory(context);+ memoriesCacheService.goToOnThisDayMemory();} else if (payload.toLowerCase().contains("birthday")) {_logger.info("Birthday notification received");final personID = payload.substring("birthday_".length);// ignore: unawaited_futures- memoriesCacheService.goToPersonMemory(context, personID);+ memoriesCacheService.goToPersonMemory(personID);} else {_logger.info("Album notification received");final collectionID = Uri.parse(payload).queryParameters["collectionID"];if (collectionID != null) {+ _logger.info(+ "Notification tap: pushing collection page for collectionId=$collectionID",+ );final collection = CollectionsService.instance.getCollectionByID(int.parse(collectionID))!;final thumbnail =await CollectionsService.instance.getCover(collection);// ignore: unawaited_futures- routeToPage(- context,+ AppNavigationService.instance.pushPage(CollectionPage(CollectionWithThumbnail(collection,diff --git a/mobile/apps/photos/lib/ui/tools/app_lock.dart b/mobile/apps/photos/lib/ui/tools/app_lock.dartindex 19d6a356ec..95bafc4942 100644--- a/mobile/apps/photos/lib/ui/tools/app_lock.dart+++ b/mobile/apps/photos/lib/ui/tools/app_lock.dart@@ -1,6 +1,7 @@import 'dart:async';import 'package:flutter/material.dart';+import 'package:logging/logging.dart';import "package:photos/generated/l10n.dart";import "package:photos/l10n/l10n.dart";import "package:photos/utils/lock_screen_settings.dart";@@ -57,6 +58,7 @@ class AppLock extends StatefulWidget {class _AppLockState extends State<AppLock> with WidgetsBindingObserver {static final GlobalKey<NavigatorState> _navigatorKey = GlobalKey();+ final Logger _logger = Logger("AppLock");late bool _didUnlockForAppLaunch;late bool _isLocked;late bool _enabled;@@ -70,6 +72,9 @@ class _AppLockState extends State<AppLock> with WidgetsBindingObserver {this._didUnlockForAppLaunch = !this.widget.enabled;this._isLocked = false;this._enabled = this.widget.enabled;+ _logger.info(+ "AppLock initialized: enabled=$_enabled didUnlockForAppLaunch=$_didUnlockForAppLaunch",+ );super.initState();}@@ -80,8 +85,13 @@ class _AppLockState extends State<AppLock> with WidgetsBindingObserver {return;}+ _logger.info(+ "AppLock lifecycle change: state=$state isLocked=$_isLocked didUnlockForAppLaunch=$_didUnlockForAppLaunch",+ );+if (state == AppLifecycleState.paused &&(!this._isLocked && this._didUnlockForAppLaunch)) {+ _logger.info("Scheduling app lock on background pause");this._backgroundLockLatencyTimer = Timer(Duration(milliseconds: LockScreenSettings.instance.getAutoLockTime()),() => this.showLockScreen(),@@ -89,6 +99,7 @@ class _AppLockState extends State<AppLock> with WidgetsBindingObserver {}if (state == AppLifecycleState.resumed) {+ _logger.info("App resumed; cancelling pending app lock timer if any");this._backgroundLockLatencyTimer?.cancel();}@@ -156,6 +167,9 @@ class _AppLockState extends State<AppLock> with WidgetsBindingObserver {/// [lockScreen] in to the rest of your app so you can better guarantee that some/// objects, services or databases are already instantiated before using them.void didUnlock([Object? args]) {+ _logger.info(+ "AppLock.didUnlock called: didUnlockForAppLaunch=$_didUnlockForAppLaunch args=${args?.runtimeType}",+ );if (this._didUnlockForAppLaunch) {this._didUnlockOnAppPaused();} else {@@ -194,17 +208,21 @@ class _AppLockState extends State<AppLock> with WidgetsBindingObserver {/// Manually show the [lockScreen].Future<void> showLockScreen() {this._isLocked = true;+ _logger.info("Entering app lock: pushing lock screen route");return _navigatorKey.currentState!.pushNamed('/lock-screen');}void _didUnlockOnAppLaunch(Object? args) {this._didUnlockForAppLaunch = true;+ _logger.info("Exiting app lock on app launch: showing unlocked app");_navigatorKey.currentState!.pushReplacementNamed('/unlocked', arguments: args);}void _didUnlockOnAppPaused() {this._isLocked = false;+ _logger+ .info("Exiting app lock from background resume: popping lock screen");_navigatorKey.currentState!.pop();}}