2023-04-17 05:02:07 +00:00
|
|
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
2024-05-07 04:04:21 +00:00
|
|
|
import 'package:immich_mobile/widgets/asset_grid/asset_grid_data_structure.dart';
|
2024-05-01 02:36:40 +00:00
|
|
|
import 'package:immich_mobile/entities/asset.entity.dart';
|
2024-05-02 20:59:14 +00:00
|
|
|
import 'package:immich_mobile/providers/db.provider.dart';
|
|
|
|
import 'package:immich_mobile/providers/user.provider.dart';
|
2023-11-13 15:54:41 +00:00
|
|
|
import 'package:immich_mobile/utils/renderlist_generator.dart';
|
2023-04-17 05:02:07 +00:00
|
|
|
import 'package:isar/isar.dart';
|
|
|
|
|
2023-11-13 15:54:41 +00:00
|
|
|
final archiveProvider = StreamProvider<RenderList>((ref) {
|
2023-05-25 03:52:43 +00:00
|
|
|
final user = ref.watch(currentUserProvider);
|
2023-11-13 15:54:41 +00:00
|
|
|
if (user == null) return const Stream.empty();
|
2023-05-17 17:36:02 +00:00
|
|
|
final query = ref
|
|
|
|
.watch(dbProvider)
|
|
|
|
.assets
|
2023-09-28 03:43:55 +00:00
|
|
|
.where()
|
|
|
|
.ownerIdEqualToAnyChecksum(user.isarId)
|
2023-05-17 17:36:02 +00:00
|
|
|
.filter()
|
|
|
|
.isArchivedEqualTo(true)
|
2023-10-06 07:01:14 +00:00
|
|
|
.isTrashedEqualTo(false)
|
2024-03-11 02:15:34 +00:00
|
|
|
.sortByFileCreatedAtDesc();
|
2023-11-13 15:54:41 +00:00
|
|
|
return renderListGenerator(query, ref);
|
2023-04-17 05:02:07 +00:00
|
|
|
});
|