TF-1604: Add requiredCapabilities support TeamMailbox for GetEmailMethod
(cherry picked from commit 3922303e63a8e910511361019a54ea13801e3f92)
This commit is contained in:
@@ -2,12 +2,14 @@ import 'package:equatable/equatable.dart';
|
||||
import 'package:jmap_dart_client/jmap/account_id.dart';
|
||||
import 'package:jmap_dart_client/jmap/core/filter/filter.dart';
|
||||
import 'package:jmap_dart_client/jmap/core/properties/properties.dart';
|
||||
import 'package:jmap_dart_client/jmap/core/session/session.dart';
|
||||
import 'package:jmap_dart_client/jmap/core/unsigned_int.dart';
|
||||
import 'package:jmap_dart_client/jmap/mail/email/email.dart';
|
||||
import 'package:jmap_dart_client/jmap/core/sort/comparator.dart';
|
||||
import 'package:tmail_ui_user/features/thread/domain/model/filter_message_option.dart';
|
||||
|
||||
class GetEmailRequest with EquatableMixin {
|
||||
final Session session;
|
||||
final AccountId accountId;
|
||||
final UnsignedInt? limit;
|
||||
final Set<Comparator>? sort;
|
||||
@@ -16,15 +18,28 @@ class GetEmailRequest with EquatableMixin {
|
||||
final Properties? properties;
|
||||
final EmailId? lastEmailId;
|
||||
|
||||
GetEmailRequest(this.accountId, {
|
||||
this.limit,
|
||||
this.sort,
|
||||
this.filter,
|
||||
this.filterOption,
|
||||
this.properties,
|
||||
this.lastEmailId,
|
||||
});
|
||||
GetEmailRequest(
|
||||
this.session,
|
||||
this.accountId,
|
||||
{
|
||||
this.limit,
|
||||
this.sort,
|
||||
this.filter,
|
||||
this.filterOption,
|
||||
this.properties,
|
||||
this.lastEmailId,
|
||||
}
|
||||
);
|
||||
|
||||
@override
|
||||
List<Object?> get props => [limit, sort, filter, properties, lastEmailId, filterOption];
|
||||
List<Object?> get props => [
|
||||
session,
|
||||
accountId,
|
||||
limit,
|
||||
sort,
|
||||
filter,
|
||||
properties,
|
||||
lastEmailId,
|
||||
filterOption
|
||||
];
|
||||
}
|
||||
@@ -3,6 +3,7 @@ import 'dart:async';
|
||||
import 'package:jmap_dart_client/jmap/account_id.dart';
|
||||
import 'package:jmap_dart_client/jmap/core/filter/filter.dart';
|
||||
import 'package:jmap_dart_client/jmap/core/properties/properties.dart';
|
||||
import 'package:jmap_dart_client/jmap/core/session/session.dart';
|
||||
import 'package:jmap_dart_client/jmap/core/sort/comparator.dart';
|
||||
import 'package:jmap_dart_client/jmap/core/state.dart' as jmap;
|
||||
import 'package:jmap_dart_client/jmap/core/unsigned_int.dart';
|
||||
@@ -15,6 +16,7 @@ import 'package:tmail_ui_user/features/thread/domain/model/get_email_request.dar
|
||||
|
||||
abstract class ThreadRepository {
|
||||
Stream<EmailsResponse> getAllEmail(
|
||||
Session session,
|
||||
AccountId accountId,
|
||||
{
|
||||
UnsignedInt? limit,
|
||||
@@ -26,6 +28,7 @@ abstract class ThreadRepository {
|
||||
);
|
||||
|
||||
Stream<EmailsResponse> refreshChanges(
|
||||
Session session,
|
||||
AccountId accountId,
|
||||
jmap.State currentState,
|
||||
{
|
||||
@@ -39,6 +42,7 @@ abstract class ThreadRepository {
|
||||
Stream<EmailsResponse> loadMoreEmails(GetEmailRequest emailRequest);
|
||||
|
||||
Future<List<Email>> searchEmails(
|
||||
Session session,
|
||||
AccountId accountId,
|
||||
{
|
||||
UnsignedInt? limit,
|
||||
@@ -49,9 +53,15 @@ abstract class ThreadRepository {
|
||||
);
|
||||
|
||||
Future<List<EmailId>> emptyTrashFolder(
|
||||
AccountId accountId,
|
||||
MailboxId trashMailboxId,
|
||||
Session session,
|
||||
AccountId accountId,
|
||||
MailboxId trashMailboxId,
|
||||
);
|
||||
|
||||
Future<PresentationEmail> getEmailById(AccountId accountId, EmailId emailId, {Properties? properties});
|
||||
Future<PresentationEmail> getEmailById(
|
||||
Session session,
|
||||
AccountId accountId,
|
||||
EmailId emailId,
|
||||
{Properties? properties}
|
||||
);
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'package:core/core.dart';
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:jmap_dart_client/jmap/account_id.dart';
|
||||
import 'package:jmap_dart_client/jmap/core/session/session.dart';
|
||||
import 'package:jmap_dart_client/jmap/mail/mailbox/mailbox.dart';
|
||||
import 'package:tmail_ui_user/features/email/domain/repository/email_repository.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox/domain/repository/mailbox_repository.dart';
|
||||
@@ -18,7 +19,7 @@ class EmptyTrashFolderInteractor {
|
||||
this._emailRepository
|
||||
);
|
||||
|
||||
Stream<Either<Failure, Success>> execute(AccountId accountId, MailboxId trashMailboxId) async* {
|
||||
Stream<Either<Failure, Success>> execute(Session session, AccountId accountId, MailboxId trashMailboxId) async* {
|
||||
try {
|
||||
yield Right<Failure, Success>(LoadingState());
|
||||
|
||||
@@ -30,7 +31,7 @@ class EmptyTrashFolderInteractor {
|
||||
final currentMailboxState = listState.first;
|
||||
final currentEmailState = listState.last;
|
||||
|
||||
final result = await threadRepository.emptyTrashFolder(accountId, trashMailboxId);
|
||||
final result = await threadRepository.emptyTrashFolder(session, accountId, trashMailboxId);
|
||||
if (result.isNotEmpty) {
|
||||
yield Right<Failure, Success>(EmptyTrashFolderSuccess(
|
||||
currentMailboxState: currentMailboxState,
|
||||
|
||||
@@ -3,6 +3,7 @@ import 'package:core/presentation/state/success.dart';
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:jmap_dart_client/jmap/account_id.dart';
|
||||
import 'package:jmap_dart_client/jmap/core/properties/properties.dart';
|
||||
import 'package:jmap_dart_client/jmap/core/session/session.dart';
|
||||
import 'package:jmap_dart_client/jmap/mail/email/email.dart';
|
||||
import 'package:tmail_ui_user/features/thread/domain/repository/thread_repository.dart';
|
||||
import 'package:tmail_ui_user/features/thread/domain/state/get_email_by_id_state.dart';
|
||||
@@ -13,6 +14,7 @@ class GetEmailByIdInteractor {
|
||||
GetEmailByIdInteractor(this._threadRepository);
|
||||
|
||||
Stream<Either<Failure, Success>> execute(
|
||||
Session session,
|
||||
AccountId accountId,
|
||||
EmailId emailId,
|
||||
{
|
||||
@@ -21,7 +23,7 @@ class GetEmailByIdInteractor {
|
||||
) async* {
|
||||
try {
|
||||
yield Right<Failure, Success>(GetEmailByIdLoading());
|
||||
final email = await _threadRepository.getEmailById(accountId, emailId, properties: properties);
|
||||
final email = await _threadRepository.getEmailById(session, accountId, emailId, properties: properties);
|
||||
yield Right<Failure, Success>(GetEmailByIdSuccess(email));
|
||||
} catch (e) {
|
||||
yield Left<Failure, Success>(GetEmailByIdFailure(e));
|
||||
|
||||
@@ -2,6 +2,7 @@ import 'package:core/core.dart';
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:jmap_dart_client/jmap/account_id.dart';
|
||||
import 'package:jmap_dart_client/jmap/core/properties/properties.dart';
|
||||
import 'package:jmap_dart_client/jmap/core/session/session.dart';
|
||||
import 'package:jmap_dart_client/jmap/core/sort/comparator.dart';
|
||||
import 'package:jmap_dart_client/jmap/core/unsigned_int.dart';
|
||||
import 'package:tmail_ui_user/features/thread/domain/model/email_filter.dart';
|
||||
@@ -16,6 +17,7 @@ class GetEmailsInMailboxInteractor {
|
||||
GetEmailsInMailboxInteractor(this.threadRepository);
|
||||
|
||||
Stream<Either<Failure, Success>> execute(
|
||||
Session session,
|
||||
AccountId accountId,
|
||||
{
|
||||
UnsignedInt? limit,
|
||||
@@ -30,6 +32,7 @@ class GetEmailsInMailboxInteractor {
|
||||
|
||||
yield* threadRepository
|
||||
.getAllEmail(
|
||||
session,
|
||||
accountId,
|
||||
limit: limit,
|
||||
sort: sort,
|
||||
|
||||
@@ -2,6 +2,7 @@ import 'package:core/core.dart';
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:jmap_dart_client/jmap/account_id.dart';
|
||||
import 'package:jmap_dart_client/jmap/core/properties/properties.dart';
|
||||
import 'package:jmap_dart_client/jmap/core/session/session.dart';
|
||||
import 'package:jmap_dart_client/jmap/core/sort/comparator.dart';
|
||||
import 'package:tmail_ui_user/features/thread/domain/model/email_filter.dart';
|
||||
import 'package:tmail_ui_user/features/thread/domain/model/email_response.dart';
|
||||
@@ -16,6 +17,7 @@ class RefreshChangesEmailsInMailboxInteractor {
|
||||
RefreshChangesEmailsInMailboxInteractor(this.threadRepository);
|
||||
|
||||
Stream<Either<Failure, Success>> execute(
|
||||
Session session,
|
||||
AccountId accountId,
|
||||
jmap.State currentState,
|
||||
{
|
||||
@@ -30,6 +32,7 @@ class RefreshChangesEmailsInMailboxInteractor {
|
||||
try {
|
||||
yield* threadRepository
|
||||
.refreshChanges(
|
||||
session,
|
||||
accountId,
|
||||
currentState,
|
||||
sort: sort,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
|
||||
import 'package:core/core.dart';
|
||||
import 'package:jmap_dart_client/jmap/core/session/session.dart';
|
||||
import 'package:model/model.dart';
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:jmap_dart_client/jmap/account_id.dart';
|
||||
@@ -17,6 +18,7 @@ class SearchEmailInteractor {
|
||||
SearchEmailInteractor(this.threadRepository);
|
||||
|
||||
Stream<Either<Failure, Success>> execute(
|
||||
Session session,
|
||||
AccountId accountId,
|
||||
{
|
||||
UnsignedInt? limit,
|
||||
@@ -29,6 +31,7 @@ class SearchEmailInteractor {
|
||||
yield Right(SearchingState());
|
||||
|
||||
final emailList = await threadRepository.searchEmails(
|
||||
session,
|
||||
accountId,
|
||||
limit: limit,
|
||||
sort: sort,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
|
||||
import 'package:core/core.dart';
|
||||
import 'package:jmap_dart_client/jmap/core/session/session.dart';
|
||||
import 'package:jmap_dart_client/jmap/mail/email/email.dart';
|
||||
import 'package:model/model.dart';
|
||||
import 'package:dartz/dartz.dart';
|
||||
@@ -18,6 +19,7 @@ class SearchMoreEmailInteractor {
|
||||
SearchMoreEmailInteractor(this.threadRepository);
|
||||
|
||||
Stream<Either<Failure, Success>> execute(
|
||||
Session session,
|
||||
AccountId accountId,
|
||||
{
|
||||
UnsignedInt? limit,
|
||||
@@ -31,6 +33,7 @@ class SearchMoreEmailInteractor {
|
||||
yield Right(SearchingMoreState());
|
||||
|
||||
final emailList = await threadRepository.searchEmails(
|
||||
session,
|
||||
accountId,
|
||||
limit: limit,
|
||||
sort: sort,
|
||||
|
||||
Reference in New Issue
Block a user