Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Show 'last year', 'last week' and 'last month' headers in gallery when appropriate

ashilkncd46db3d30d5
diff --git a/mobile/apps/photos/lib/generated/intl/messages_en.dart b/mobile/apps/photos/lib/generated/intl/messages_en.dart
index d8e386a7c8..2d2d1ce32c 100644
--- a/mobile/apps/photos/lib/generated/intl/messages_en.dart
+++ b/mobile/apps/photos/lib/generated/intl/messages_en.dart
@@ -1195,8 +1195,11 @@ class MessageLookup extends MessageLookupByLibrary {
"kindlyHelpUsWithThisInformation": MessageLookupByLibrary.simpleMessage(
"Kindly help us with this information"),
"language": MessageLookupByLibrary.simpleMessage("Language"),
+ "lastMonth": MessageLookupByLibrary.simpleMessage("Last month"),
"lastTimeWithThem": m45,
"lastUpdated": MessageLookupByLibrary.simpleMessage("Last updated"),
+ "lastWeek": MessageLookupByLibrary.simpleMessage("Last week"),
+ "lastYear": MessageLookupByLibrary.simpleMessage("Last year"),
"lastYearsTrip":
MessageLookupByLibrary.simpleMessage("Last year\'s trip"),
"leave": MessageLookupByLibrary.simpleMessage("Leave"),
diff --git a/mobile/apps/photos/lib/generated/l10n.dart b/mobile/apps/photos/lib/generated/l10n.dart
index 2f434ad5da..416ced4383 100644
--- a/mobile/apps/photos/lib/generated/l10n.dart
+++ b/mobile/apps/photos/lib/generated/l10n.dart
@@ -12306,6 +12306,16 @@ class S {
);
}
+ /// `Last week`
+ String get lastWeek {
+ return Intl.message(
+ 'Last week',
+ name: 'lastWeek',
+ desc: '',
+ args: [],
+ );
+ }
+
/// `This month`
String get thisMonth {
return Intl.message(
@@ -12316,6 +12326,16 @@ class S {
);
}
+ /// `Last month`
+ String get lastMonth {
+ return Intl.message(
+ 'Last month',
+ name: 'lastMonth',
+ desc: '',
+ args: [],
+ );
+ }
+
/// `This year`
String get thisYear {
return Intl.message(
@@ -12326,6 +12346,16 @@ class S {
);
}
+ /// `Last year`
+ String get lastYear {
+ return Intl.message(
+ 'Last year',
+ name: 'lastYear',
+ desc: '',
+ args: [],
+ );
+ }
+
/// `Group by`
String get groupBy {
return Intl.message(
diff --git a/mobile/apps/photos/lib/l10n/intl_en.arb b/mobile/apps/photos/lib/l10n/intl_en.arb
index 8d8e338633..8aaac2b222 100644
--- a/mobile/apps/photos/lib/l10n/intl_en.arb
+++ b/mobile/apps/photos/lib/l10n/intl_en.arb
@@ -1790,7 +1790,10 @@
"cLDesc6": "No more waiting for uploads/downloads to complete before you can close the app. All uploads and downloads now have the ability to be paused midway, and resume from where you left off.",
"indexingPausedStatusDescription": "Indexing is paused. It will automatically resume when the device is ready. The device is considered ready when its battery level, battery health, and thermal status are within a healthy range.",
"thisWeek": "This week",
+ "lastWeek": "Last week",
"thisMonth": "This month",
+ "lastMonth": "Last month",
"thisYear": "This year",
+ "lastYear": "Last year",
"groupBy": "Group by"
}
diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/component/group/type.dart b/mobile/apps/photos/lib/ui/viewer/gallery/component/group/type.dart
index 7505677ee6..cbf17ffd21 100644
--- a/mobile/apps/photos/lib/ui/viewer/gallery/component/group/type.dart
+++ b/mobile/apps/photos/lib/ui/viewer/gallery/component/group/type.dart
@@ -199,7 +199,15 @@ extension GroupTypeExtension on GroupType {
if (startOfWeek.year == nowStartOfWeek.year &&
startOfWeek.month == nowStartOfWeek.month &&
startOfWeek.day == nowStartOfWeek.day) {
- return "This week";
+ return S.of(context).thisWeek;
+ }
+
+ // Check if it's the previous week
+ final lastWeekStart = nowStartOfWeek.subtract(const Duration(days: 7));
+ if (startOfWeek.year == lastWeekStart.year &&
+ startOfWeek.month == lastWeekStart.month &&
+ startOfWeek.day == lastWeekStart.day) {
+ return S.of(context).lastWeek;
}
// Return formatted week range
@@ -212,7 +220,13 @@ extension GroupTypeExtension on GroupType {
final now = DateTime.now();
if (date.year == now.year && date.month == now.month) {
- return "This month";
+ return S.of(context).thisMonth;
+ }
+
+ // Check if it's the previous month
+ final lastMonth = DateTime(now.year, now.month - 1);
+ if (date.year == lastMonth.year && date.month == lastMonth.month) {
+ return S.of(context).lastMonth;
}
return DateFormat.yMMM(Localizations.localeOf(context).languageCode)
@@ -224,7 +238,12 @@ extension GroupTypeExtension on GroupType {
final now = DateTime.now();
if (date.year == now.year) {
- return "This year";
+ return S.of(context).thisYear;
+ }
+
+ // Check if it's the previous year
+ if (date.year == now.year - 1) {
+ return S.of(context).lastYear;
}
return DateFormat.y(Localizations.localeOf(context).languageCode)