High performance self-hosted photo and video management solution.
TypeScript backup-toolfluttergoogle-photosgoogle-photos-alternativejavascriptmobile-appnestjsnodejsphoto-galleryphotosphotos-managementself-hostedsveltesveltekittypescriptvideos
fix(mobile): cannot deep link to memory lane (#30634) (#30787)
nikhilpodila65b4b9b8fbed
diff --git a/mobile/lib/services/deep_link.service.dart b/mobile/lib/services/deep_link.service.dartindex 617a5b6132..738cb78721 100644--- a/mobile/lib/services/deep_link.service.dart+++ b/mobile/lib/services/deep_link.service.dart@@ -51,7 +51,7 @@ class DeepLinkService {final queryParams = link.uri.queryParameters;return switch (intent) {- "memory" => await _buildMemoryDeepLink(queryParams['id'] ?? ''),+ "memory" => await _buildMemoryDeepLink(queryParams['id']),"asset" => await _buildAssetDeepLink(queryParams['id'] ?? '', ref),"album" => await _buildAlbumDeepLink(queryParams['id'] ?? ''),"people" => await _buildPeopleDeepLink(queryParams['id'] ?? ''),diff --git a/mobile/test/services/deep_link_service_test.dart b/mobile/test/services/deep_link_service_test.dartindex 16fa392f27..c588cf26b4 100644--- a/mobile/test/services/deep_link_service_test.dart+++ b/mobile/test/services/deep_link_service_test.dart@@ -3,7 +3,9 @@ import 'package:flutter_test/flutter_test.dart';import 'package:hooks_riverpod/hooks_riverpod.dart';import 'package:immich_mobile/domain/models/album/album.model.dart';import 'package:immich_mobile/domain/models/asset/base_asset.model.dart';+import 'package:immich_mobile/domain/models/memory.model.dart';import 'package:immich_mobile/domain/models/timeline.model.dart';+import 'package:immich_mobile/domain/models/user.model.dart';import 'package:immich_mobile/domain/services/asset.service.dart';import 'package:immich_mobile/domain/services/memory.service.dart';import 'package:immich_mobile/domain/services/people.service.dart';@@ -32,11 +34,13 @@ class MockAssetViewerStateNotifier extends Mock implements AssetViewerStateNotifconst _assetId = 'aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb';const _albumId = 'cccccccc-4444-5555-6666-dddddddddddd';+const _memoryId = 'mmmmmmmm-7777-8888-9999-yyyyyyyyyyyy';+const _userId = 'user-1';final _asset = RemoteAsset(id: _assetId,name: 'photo.jpg',- ownerId: 'user-1',+ ownerId: _userId,checksum: 'checksum-1',type: AssetType.image,createdAt: DateTime(2026, 6, 12),@@ -47,7 +51,7 @@ final _asset = RemoteAsset(final _album = RemoteAlbum(id: _albumId,name: 'Shared Album',- ownerId: 'user-1',+ ownerId: _userId,description: '',createdAt: DateTime(2026, 6, 12),updatedAt: DateTime(2026, 6, 12),@@ -58,10 +62,30 @@ final _album = RemoteAlbum(ownerName: 'Owner',);+final _memory = DriftMemory(+ id: _memoryId,+ createdAt: DateTime(2026, 6, 12),+ updatedAt: DateTime(2026, 6, 12),+ ownerId: _userId,+ type: MemoryTypeEnum.onThisDay,+ data: const MemoryData(year: 2025),+ isSaved: false,+ memoryAt: DateTime(2025, 6, 12),+ assets: [_asset],+);++final _user = UserDto(+ id: _userId,+ email: '[email protected]',+ name: 'Test User',+ profileChangedAt: DateTime(2026, 6, 12),+);+void main() {late MockTimelineFactory timelineFactory;late MockAssetService assetService;late MockRemoteAlbumService remoteAlbumService;+ late MockDriftMemoryService memoryService;late MockWidgetRef ref;late List<TimelineService> createdTimelineServices;late DeepLinkService sut;@@ -70,6 +94,7 @@ void main() {timelineFactory = MockTimelineFactory();assetService = MockAssetService();remoteAlbumService = MockRemoteAlbumService();+ memoryService = MockDriftMemoryService();ref = MockWidgetRef();createdTimelineServices = [];@@ -90,9 +115,9 @@ void main() {timelineFactory,assetService,remoteAlbumService,- MockDriftMemoryService(),+ memoryService,MockDriftPeopleService(),- null,+ _user,);addTearDown(() async {@@ -137,4 +162,30 @@ void main() {expect((route!.args! as AssetViewerRouteArgs).currentAlbum, isNull);verifyNever(() => remoteAlbumService.get(any()));});++ test('memory scheme link without an id opens the memory lane', () async {+ when(() => memoryService.getMemoryLane(_userId)).thenAnswer((_) async => [_memory]);+ final deepLink = MockPlatformDeepLink();+ when(() => deepLink.uri).thenReturn(Uri.parse('immich://memory'));++ final route = await sut.handleScheme(deepLink, ref);++ expect(route, isA<DriftMemoryRoute>());+ expect((route!.args! as DriftMemoryRouteArgs).memories, [_memory]);+ verify(() => memoryService.getMemoryLane(_userId)).called(1);+ verifyNever(() => memoryService.get(any()));+ });++ test('memory scheme link with an id opens only the specified memory', () async {+ when(() => memoryService.get(_memoryId)).thenAnswer((_) async => _memory);+ final deepLink = MockPlatformDeepLink();+ when(() => deepLink.uri).thenReturn(Uri.parse('immich://memory?id=$_memoryId'));++ final route = await sut.handleScheme(deepLink, ref);++ expect(route, isA<DriftMemoryRoute>());+ expect((route!.args! as DriftMemoryRouteArgs).memories, [_memory]);+ verifyNever(() => memoryService.getMemoryLane(any()));+ verify(() => memoryService.get(_memoryId)).called(1);+ });}