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