TF-657 Add interactor/repository/datasource for SendReceiptToSender
This commit is contained in:
@@ -30,19 +30,11 @@ class GetEmailContentInteractor {
|
||||
newEmailContents,
|
||||
newEmailContentsDisplayed,
|
||||
email.allAttachments,
|
||||
email.needShowNotificationMessageReadReceipt));
|
||||
email));
|
||||
} else if (email.allAttachments.isNotEmpty) {
|
||||
yield Right<Failure, Success>(GetEmailContentSuccess(
|
||||
[],
|
||||
[],
|
||||
email.allAttachments,
|
||||
email.needShowNotificationMessageReadReceipt));
|
||||
yield Right<Failure, Success>(GetEmailContentSuccess([], [], email.allAttachments, email));
|
||||
} else if (email.headers?.isNotEmpty == true) {
|
||||
yield Right<Failure, Success>(GetEmailContentSuccess(
|
||||
[],
|
||||
[],
|
||||
[],
|
||||
email.needShowNotificationMessageReadReceipt));
|
||||
yield Right<Failure, Success>(GetEmailContentSuccess([], [], [], email));
|
||||
} else {
|
||||
yield Left(GetEmailContentFailure(null));
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
import 'package:core/core.dart';
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:jmap_dart_client/jmap/account_id.dart';
|
||||
import 'package:tmail_ui_user/features/email/domain/model/send_receipt_to_sender_request.dart';
|
||||
import 'package:tmail_ui_user/features/email/domain/repository/mdn_repository.dart';
|
||||
import 'package:tmail_ui_user/features/email/domain/state/send_receipt_to_sender_state.dart';
|
||||
|
||||
class SendReceiptToSenderInteractor {
|
||||
final MdnRepository _mdnRepository;
|
||||
|
||||
SendReceiptToSenderInteractor(this._mdnRepository);
|
||||
|
||||
Stream<Either<Failure, Success>> execute(AccountId accountId, SendReceiptToSenderRequest request) async* {
|
||||
try {
|
||||
yield Right<Failure, Success>(SendReceiptToSenderLoading());
|
||||
final mdn = await _mdnRepository.sendReceiptToSender(accountId, request);
|
||||
if (mdn != null) {
|
||||
yield Right<Failure, Success>(SendReceiptToSenderSuccess(mdn));
|
||||
} else {
|
||||
yield Left<Failure, Success>(SendReceiptToSenderFailure(null));
|
||||
}
|
||||
} catch (e) {
|
||||
yield Left<Failure, Success>(SendReceiptToSenderFailure(e));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user