TF-3461 Add sort by message size

Signed-off-by: dab246 <tdvu@linagora.com>
This commit is contained in:
dab246
2025-02-10 14:26:15 +07:00
committed by Dat H. Pham
parent 0e549c830a
commit 192dad149b
4 changed files with 51 additions and 1 deletions
@@ -12,7 +12,9 @@ enum EmailSortOrderType {
senderAscending,
senderDescending,
subjectAscending,
subjectDescending;
subjectDescending,
sizeAscending,
sizeDescending;
String getTitle(BuildContext context) {
return getTitleByAppLocalizations(AppLocalizations.of(context));
@@ -34,6 +36,10 @@ enum EmailSortOrderType {
return appLocalizations.subjectAscending;
case EmailSortOrderType.subjectDescending:
return appLocalizations.subjectDescending;
case EmailSortOrderType.sizeAscending:
return appLocalizations.sizeAscending;
case EmailSortOrderType.sizeDescending:
return appLocalizations.sizeDescending;
}
}
@@ -77,6 +83,18 @@ enum EmailSortOrderType {
..add(EmailComparator(EmailComparatorProperty.subject)
..setIsAscending(false))
);
case EmailSortOrderType.sizeAscending:
return Some(
<Comparator>{}
..add(EmailComparator(EmailComparatorProperty.size)
..setIsAscending(true))
);
case EmailSortOrderType.sizeDescending:
return Some(
<Comparator>{}
..add(EmailComparator(EmailComparatorProperty.size)
..setIsAscending(false))
);
}
}
@@ -93,6 +111,8 @@ enum EmailSortOrderType {
this == EmailSortOrderType.subjectAscending ||
this == EmailSortOrderType.senderDescending ||
this == EmailSortOrderType.senderAscending ||
this == EmailSortOrderType.sizeDescending ||
this == EmailSortOrderType.sizeAscending ||
this == EmailSortOrderType.relevance;
}
}