mirror of
https://github.com/immich-app/immich.git
synced 2025-07-31 15:08:44 -04:00
fix: fallback auto grouping to day grouping (#20156)
fallback auto grouping to day grouping Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com>
This commit is contained in:
parent
02688a2a03
commit
79157e1043
@ -3,6 +3,7 @@ import 'package:immich_mobile/domain/utils/event_stream.dart';
|
|||||||
enum GroupAssetsBy {
|
enum GroupAssetsBy {
|
||||||
day,
|
day,
|
||||||
month,
|
month,
|
||||||
|
auto,
|
||||||
none;
|
none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,8 +33,12 @@ class TimelineFactory {
|
|||||||
}) : _timelineRepository = timelineRepository,
|
}) : _timelineRepository = timelineRepository,
|
||||||
_settingsService = settingsService;
|
_settingsService = settingsService;
|
||||||
|
|
||||||
GroupAssetsBy get groupBy =>
|
GroupAssetsBy get groupBy {
|
||||||
GroupAssetsBy.values[_settingsService.get(Setting.groupAssetsBy)];
|
final group =
|
||||||
|
GroupAssetsBy.values[_settingsService.get(Setting.groupAssetsBy)];
|
||||||
|
// We do not support auto grouping in the new timeline yet, fallback to day grouping
|
||||||
|
return group == GroupAssetsBy.auto ? GroupAssetsBy.day : group;
|
||||||
|
}
|
||||||
|
|
||||||
TimelineService main(List<String> timelineUsers) =>
|
TimelineService main(List<String> timelineUsers) =>
|
||||||
TimelineService(_timelineRepository.main(timelineUsers, groupBy));
|
TimelineService(_timelineRepository.main(timelineUsers, groupBy));
|
||||||
|
@ -539,7 +539,7 @@ extension on Expression<DateTime> {
|
|||||||
// to create the correct time bucket
|
// to create the correct time bucket
|
||||||
final localTimeExp = modify(const DateTimeModifier.localTime());
|
final localTimeExp = modify(const DateTimeModifier.localTime());
|
||||||
return switch (groupBy) {
|
return switch (groupBy) {
|
||||||
GroupAssetsBy.day => localTimeExp.date,
|
GroupAssetsBy.day || GroupAssetsBy.auto => localTimeExp.date,
|
||||||
GroupAssetsBy.month => localTimeExp.strftime("%Y-%m"),
|
GroupAssetsBy.month => localTimeExp.strftime("%Y-%m"),
|
||||||
GroupAssetsBy.none => throw ArgumentError(
|
GroupAssetsBy.none => throw ArgumentError(
|
||||||
"GroupAssetsBy.none is not supported for date formatting",
|
"GroupAssetsBy.none is not supported for date formatting",
|
||||||
@ -551,7 +551,7 @@ extension on Expression<DateTime> {
|
|||||||
extension on String {
|
extension on String {
|
||||||
DateTime dateFmt(GroupAssetsBy groupBy) {
|
DateTime dateFmt(GroupAssetsBy groupBy) {
|
||||||
final format = switch (groupBy) {
|
final format = switch (groupBy) {
|
||||||
GroupAssetsBy.day => "y-M-d",
|
GroupAssetsBy.day || GroupAssetsBy.auto => "y-M-d",
|
||||||
GroupAssetsBy.month => "y-M",
|
GroupAssetsBy.month => "y-M",
|
||||||
GroupAssetsBy.none => throw ArgumentError(
|
GroupAssetsBy.none => throw ArgumentError(
|
||||||
"GroupAssetsBy.none is not supported for date formatting",
|
"GroupAssetsBy.none is not supported for date formatting",
|
||||||
|
@ -35,7 +35,8 @@ class FixedSegmentBuilder extends SegmentBuilder {
|
|||||||
|
|
||||||
final timelineHeader = switch (groupBy) {
|
final timelineHeader = switch (groupBy) {
|
||||||
GroupAssetsBy.month => HeaderType.month,
|
GroupAssetsBy.month => HeaderType.month,
|
||||||
GroupAssetsBy.day =>
|
GroupAssetsBy.day ||
|
||||||
|
GroupAssetsBy.auto =>
|
||||||
bucket is TimeBucket && bucket.date.month != previousDate?.month
|
bucket is TimeBucket && bucket.date.month != previousDate?.month
|
||||||
? HeaderType.monthAndDay
|
? HeaderType.monthAndDay
|
||||||
: HeaderType.day,
|
: HeaderType.day,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user