mirror of
https://github.com/immich-app/immich.git
synced 2024-11-15 09:59:00 -07: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:hooks_riverpod/hooks_riverpod.dart';
|
||||||
import 'package:immich_mobile/shared/models/asset.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:immich_mobile/shared/providers/db.provider.dart';
|
||||||
|
import 'package:isar/isar.dart';
|
||||||
|
|
||||||
final allMotionPhotosProvider = FutureProvider<List<Asset>>( (ref) async {
|
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)
|
return ref.watch(dbProvider)
|
||||||
.assets
|
.assets
|
||||||
.getAllByRemoteId(
|
.filter()
|
||||||
search.assets.items.map((e) => e.id),
|
.livePhotoVideoIdIsNotNull()
|
||||||
);
|
.findAll();
|
||||||
|
|
||||||
|
|
||||||
/// This works offline, but we use the above
|
|
||||||
/*
|
|
||||||
return ref.watch(dbProvider).assets
|
|
||||||
.filter()
|
|
||||||
.livePhotoVideoIdIsNotNull()
|
|
||||||
.findAll();
|
|
||||||
*/
|
|
||||||
});
|
});
|
||||||
|
@ -1,20 +1,12 @@
|
|||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
import 'package:immich_mobile/shared/models/asset.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:immich_mobile/shared/providers/db.provider.dart';
|
||||||
|
import 'package:isar/isar.dart';
|
||||||
|
|
||||||
final recentlyAddedProvider = FutureProvider<List<Asset>>( (ref) async {
|
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)
|
return ref.watch(dbProvider)
|
||||||
.assets
|
.assets
|
||||||
.getAllByRemoteId(
|
.where()
|
||||||
search.assets.items.map((e) => e.id),
|
.sortByFileCreatedAtDesc()
|
||||||
);
|
.findAll();
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user