Apply OptionParamMixin for SearchEmailFilter
This commit is contained in:
committed by
Dat H. Pham
parent
c118affbcf
commit
2b3de4c47f
@@ -18,7 +18,7 @@ dependencies:
|
||||
jmap_dart_client:
|
||||
git:
|
||||
url: https://github.com/linagora/jmap-dart-client.git
|
||||
ref: master
|
||||
ref: cnb_support
|
||||
|
||||
### Dependencies from pub.dev ###
|
||||
equatable: 2.0.5
|
||||
|
||||
@@ -15,7 +15,7 @@ dependencies:
|
||||
jmap_dart_client:
|
||||
git:
|
||||
url: https://github.com/linagora/jmap-dart-client.git
|
||||
ref: master
|
||||
ref: cnb_support
|
||||
|
||||
### Dependencies from pub.dev ###
|
||||
equatable: 2.0.5
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ dependencies:
|
||||
jmap_dart_client:
|
||||
git:
|
||||
url: https://github.com/linagora/jmap-dart-client.git
|
||||
ref: master
|
||||
ref: cnb_support
|
||||
|
||||
### Dependencies from pub.dev ###
|
||||
equatable: 2.0.5
|
||||
|
||||
@@ -15,7 +15,7 @@ dependencies:
|
||||
jmap_dart_client:
|
||||
git:
|
||||
url: https://github.com/linagora/jmap-dart-client.git
|
||||
ref: master
|
||||
ref: cnb_support
|
||||
|
||||
### Dependencies from pub.dev ###
|
||||
equatable: 2.0.5
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import 'package:core/core.dart';
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:jmap_dart_client/jmap/core/filter/filter.dart';
|
||||
@@ -13,7 +14,7 @@ import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/model/sear
|
||||
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/model/search/email_sort_order_type.dart';
|
||||
import 'package:tmail_ui_user/features/thread/domain/model/search_query.dart';
|
||||
|
||||
class SearchEmailFilter with EquatableMixin {
|
||||
class SearchEmailFilter with EquatableMixin, OptionParamMixin {
|
||||
final Set<String> from;
|
||||
final Set<String> to;
|
||||
final SearchQuery? text;
|
||||
@@ -69,30 +70,22 @@ class SearchEmailFilter with EquatableMixin {
|
||||
Option<int>? positionOption,
|
||||
}) {
|
||||
return SearchEmailFilter(
|
||||
from: _getOptionParam(fromOption, from),
|
||||
to: _getOptionParam(toOption, to),
|
||||
from: getOptionParam(fromOption, from),
|
||||
to: getOptionParam(toOption, to),
|
||||
text: text ?? this.text,
|
||||
subject: _getOptionParam(subjectOption, subject),
|
||||
subject: getOptionParam(subjectOption, subject),
|
||||
notKeyword: notKeyword ?? this.notKeyword,
|
||||
mailbox: mailbox ?? this.mailbox,
|
||||
emailReceiveTimeType: emailReceiveTimeType ?? this.emailReceiveTimeType,
|
||||
hasAttachment: hasAttachment ?? this.hasAttachment,
|
||||
before: _getOptionParam(beforeOption, before),
|
||||
startDate: _getOptionParam(startDateOption, startDate),
|
||||
endDate: _getOptionParam(endDateOption, endDate),
|
||||
sortOrder: _getOptionParam(sortOrderOption, sortOrder),
|
||||
position: _getOptionParam(positionOption, position),
|
||||
before: getOptionParam(beforeOption, before),
|
||||
startDate: getOptionParam(startDateOption, startDate),
|
||||
endDate: getOptionParam(endDateOption, endDate),
|
||||
sortOrder: getOptionParam(sortOrderOption, sortOrder),
|
||||
position: getOptionParam(positionOption, position),
|
||||
);
|
||||
}
|
||||
|
||||
T? _getOptionParam<T>(Option<T?>? option, T? defaultValue) {
|
||||
if (option != null) {
|
||||
return option.toNullable();
|
||||
} else {
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
|
||||
Filter? mappingToEmailFilterCondition({
|
||||
required EmailSortOrderType sortOrderType,
|
||||
EmailFilterCondition? moreFilterCondition
|
||||
|
||||
+1
-1
@@ -33,7 +33,7 @@ dependencies:
|
||||
jmap_dart_client:
|
||||
git:
|
||||
url: https://github.com/linagora/jmap-dart-client.git
|
||||
ref: master
|
||||
ref: cnb_support
|
||||
|
||||
### Dependencies from pub.dev ###
|
||||
cupertino_icons: 1.0.6
|
||||
|
||||
+1
-1
@@ -62,7 +62,7 @@ dependencies:
|
||||
jmap_dart_client:
|
||||
git:
|
||||
url: https://github.com/linagora/jmap-dart-client.git
|
||||
ref: master
|
||||
ref: cnb_support
|
||||
|
||||
contacts_service:
|
||||
git:
|
||||
|
||||
@@ -15,7 +15,7 @@ dependencies:
|
||||
jmap_dart_client:
|
||||
git:
|
||||
url: https://github.com/linagora/jmap-dart-client.git
|
||||
ref: master
|
||||
ref: cnb_support
|
||||
|
||||
### Dependencies from pub.dev ###
|
||||
equatable: 2.0.5
|
||||
|
||||
Reference in New Issue
Block a user