TF-2304 Add sortOrder to simple_search_filter

(cherry picked from commit 4ae06a452056c093a670ab53ff90b4427fedfbd9)
This commit is contained in:
hieubt
2023-11-15 17:26:47 +07:00
committed by Dat H. Pham
parent 24ca5828c2
commit 18342265a1
@@ -13,6 +13,7 @@ import 'package:tmail_ui_user/features/mailbox/presentation/extensions/presentat
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/model/search/email_receive_time_type.dart'; import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/model/search/email_receive_time_type.dart';
import 'package:tmail_ui_user/features/thread/domain/model/search_query.dart'; import 'package:tmail_ui_user/features/thread/domain/model/search_query.dart';
import 'package:tmail_ui_user/main/localizations/app_localizations.dart'; import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
import 'package:jmap_dart_client/jmap/core/sort/comparator.dart';
class SimpleSearchFilter with EquatableMixin { class SimpleSearchFilter with EquatableMixin {
final Set<String> from; final Set<String> from;
@@ -24,6 +25,7 @@ class SimpleSearchFilter with EquatableMixin {
final UTCDate? before; final UTCDate? before;
final UTCDate? startDate; final UTCDate? startDate;
final UTCDate? endDate; final UTCDate? endDate;
final Set<Comparator>? sortOrder;
SimpleSearchFilter({ SimpleSearchFilter({
Set<String>? from, Set<String>? from,
@@ -34,7 +36,8 @@ class SimpleSearchFilter with EquatableMixin {
this.before, this.before,
this.mailbox, this.mailbox,
this.startDate, this.startDate,
this.endDate this.endDate,
this.sortOrder,
}) : from = from ?? <String>{}, }) : from = from ?? <String>{},
to = to ?? <String>{}, to = to ?? <String>{},
hasAttachment = hasAttachment ?? false, hasAttachment = hasAttachment ?? false,
@@ -49,7 +52,8 @@ class SimpleSearchFilter with EquatableMixin {
Option<bool>? hasAttachmentOption, Option<bool>? hasAttachmentOption,
Option<UTCDate>? beforeOption, Option<UTCDate>? beforeOption,
Option<UTCDate>? startDateOption, Option<UTCDate>? startDateOption,
Option<UTCDate>? endDateOption Option<UTCDate>? endDateOption,
Option<Set<Comparator>>? sortOrderOption,
}) { }) {
return SimpleSearchFilter( return SimpleSearchFilter(
from: _getOptionParam(fromOption, from), from: _getOptionParam(fromOption, from),
@@ -60,7 +64,8 @@ class SimpleSearchFilter with EquatableMixin {
hasAttachment: _getOptionParam(hasAttachmentOption, hasAttachment), hasAttachment: _getOptionParam(hasAttachmentOption, hasAttachment),
before: _getOptionParam(beforeOption, before), before: _getOptionParam(beforeOption, before),
startDate: _getOptionParam(startDateOption, startDate), startDate: _getOptionParam(startDateOption, startDate),
endDate: _getOptionParam(endDateOption, endDate) endDate: _getOptionParam(endDateOption, endDate),
sortOrder: _getOptionParam(sortOrderOption, sortOrder)
); );
} }
@@ -111,7 +116,8 @@ class SimpleSearchFilter with EquatableMixin {
hasAttachment, hasAttachment,
before, before,
startDate, startDate,
endDate endDate,
sortOrder
]; ];
} }