mirror of
				https://github.com/immich-app/immich.git
				synced 2025-11-03 19:17:11 -05:00 
			
		
		
		
	fix(mobile): Fix "Live Images" and "Recently added" page (#6030)
* fix(mobile): Load assets on "Live-Images" page Instead of requesting the server for the relevant entries, we can use the local DB. This change fixes loading errors when going to the "Live-Images" page. It is similar to the work done with #5971. * fix(mobile): Fix Recently added page
This commit is contained in:
		
							parent
							
								
									27bc777581
								
							
						
					
					
						commit
						fd3a1a4da8
					
				@ -1,29 +1,12 @@
 | 
			
		||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
 | 
			
		||||
import 'package:immich_mobile/shared/models/asset.dart';
 | 
			
		||||
import 'package:immich_mobile/shared/providers/api.provider.dart';
 | 
			
		||||
import 'package:immich_mobile/shared/providers/db.provider.dart';
 | 
			
		||||
import 'package:isar/isar.dart';
 | 
			
		||||
 | 
			
		||||
final allMotionPhotosProvider = FutureProvider<List<Asset>>( (ref) async {
 | 
			
		||||
  final search = await ref.watch(apiServiceProvider).searchApi.search(
 | 
			
		||||
    motion: true,
 | 
			
		||||
  );
 | 
			
		||||
 | 
			
		||||
  if (search == null) {
 | 
			
		||||
    return [];
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  return ref.watch(dbProvider)
 | 
			
		||||
      .assets
 | 
			
		||||
      .getAllByRemoteId(
 | 
			
		||||
        search.assets.items.map((e) => e.id),
 | 
			
		||||
      );
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  /// This works offline, but we use the above
 | 
			
		||||
  /*
 | 
			
		||||
     return ref.watch(dbProvider).assets
 | 
			
		||||
      .filter()
 | 
			
		||||
      .livePhotoVideoIdIsNotNull()
 | 
			
		||||
      .findAll();
 | 
			
		||||
  */
 | 
			
		||||
    .assets
 | 
			
		||||
    .filter()
 | 
			
		||||
    .livePhotoVideoIdIsNotNull()
 | 
			
		||||
    .findAll();
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
@ -1,20 +1,12 @@
 | 
			
		||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
 | 
			
		||||
import 'package:immich_mobile/shared/models/asset.dart';
 | 
			
		||||
import 'package:immich_mobile/shared/providers/api.provider.dart';
 | 
			
		||||
import 'package:immich_mobile/shared/providers/db.provider.dart';
 | 
			
		||||
import 'package:isar/isar.dart';
 | 
			
		||||
 | 
			
		||||
final recentlyAddedProvider = FutureProvider<List<Asset>>( (ref) async {
 | 
			
		||||
  final search = await ref.watch(apiServiceProvider).searchApi.search(
 | 
			
		||||
    recent: true,
 | 
			
		||||
  );
 | 
			
		||||
 | 
			
		||||
  if (search == null) {
 | 
			
		||||
    return [];
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  return ref.watch(dbProvider)
 | 
			
		||||
      .assets
 | 
			
		||||
      .getAllByRemoteId(
 | 
			
		||||
        search.assets.items.map((e) => e.id),
 | 
			
		||||
      );
 | 
			
		||||
      .where()
 | 
			
		||||
      .sortByFileCreatedAtDesc()
 | 
			
		||||
      .findAll();
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user