1
0
Fork 0
mirror of https://github.com/immich-app/immich.git synced 2025-02-03 01:22:44 +01:00

according to photo grid setting, let photos group by date in album page view on android

This commit is contained in:
ExceptionsOccur 2025-01-14 10:03:59 +08:00 committed by ExceptionsOccur
parent efbc0cb192
commit c13be84782

View file

@ -11,6 +11,8 @@ import 'package:immich_mobile/entities/album.entity.dart';
import 'package:immich_mobile/providers/db.provider.dart';
import 'package:immich_mobile/utils/renderlist_generator.dart';
import 'package:isar/isar.dart';
import '../../services/app_settings.service.dart';
import '../app_settings.provider.dart';
final isRefreshingRemoteAlbumProvider = StateProvider<bool>((ref) => false);
@ -150,6 +152,17 @@ final albumWatcher =
}
});
Stream<RenderList> renderListGeneratorWithGroupByDate(
QueryBuilder<Asset, Asset, QAfterSortBy> query,
StreamProviderRef<RenderList> ref,
GroupAssetsBy groupBy,
) {
final settings = ref.watch(appSettingsServiceProvider);
final groupBy =
GroupAssetsBy.values[settings.getSetting(AppSettingsEnum.groupAssetsBy)];
return renderListGeneratorWithGroupBy(query, groupBy);
}
final albumRenderlistProvider =
StreamProvider.autoDispose.family<RenderList, int>((ref, albumId) {
final album = ref.watch(albumWatcher(albumId)).value;
@ -157,13 +170,15 @@ final albumRenderlistProvider =
if (album != null) {
final query = album.assets.filter().isTrashedEqualTo(false);
if (album.sortOrder == SortOrder.asc) {
return renderListGeneratorWithGroupBy(
return renderListGeneratorWithGroupByDate(
query.sortByFileCreatedAt(),
ref,
GroupAssetsBy.none,
);
} else if (album.sortOrder == SortOrder.desc) {
return renderListGeneratorWithGroupBy(
return renderListGeneratorWithGroupByDate(
query.sortByFileCreatedAtDesc(),
ref,
GroupAssetsBy.none,
);
}