mirror of
https://github.com/immich-app/immich
synced 2025-11-14 17:36:12 +00:00
feat(mobile): load search result assets from local DB (#5971)
This commit is contained in:
parent
c0ebc943d2
commit
733fa28aa2
5 changed files with 22 additions and 29 deletions
|
|
@ -1,28 +1,13 @@
|
|||
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 allVideoAssetsProvider = FutureProvider<List<Asset>>( (ref) async {
|
||||
final search = await ref.watch(apiServiceProvider).searchApi.search(
|
||||
type: 'VIDEO',
|
||||
);
|
||||
|
||||
if (search == null) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return ref.watch(dbProvider)
|
||||
final allVideoAssetsProvider = FutureProvider<List<Asset>>((ref) async {
|
||||
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()
|
||||
.durationInSecondsGreaterThan(0)
|
||||
.typeEqualTo(AssetType.video)
|
||||
.findAll();
|
||||
*/
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue