TF-1900 Auto sync Sending Queue after work manager completed

(cherry picked from commit e68a8fdc49c600224b93e25f60ed6b8ecf1afe84)
This commit is contained in:
dab246
2023-06-04 12:21:27 +07:00
committed by Dat Vu
parent 38bd86019e
commit b2f96c8142
11 changed files with 92 additions and 20 deletions
@@ -4,5 +4,5 @@ import 'package:jmap_dart_client/jmap/core/user_name.dart';
import 'package:tmail_ui_user/features/composer/domain/model/sending_email.dart';
abstract class SendingQueueRepository {
Future<List<SendingEmail>> getAllSendingEmails(AccountId accountId, UserName userName);
Future<List<SendingEmail>> getAllSendingEmails(AccountId accountId, UserName userName, {bool needToReopen = false});
}
@@ -11,10 +11,10 @@ class GetAllSendingEmailInteractor {
GetAllSendingEmailInteractor(this._sendingQueueRepository);
Stream<Either<Failure, Success>> execute(AccountId accountId, UserName userName) async* {
Stream<Either<Failure, Success>> execute(AccountId accountId, UserName userName, {bool needToReopen = false}) async* {
try {
yield Right<Failure, Success>(GetAllSendingEmailLoading());
final sendingEmails = await _sendingQueueRepository.getAllSendingEmails(accountId, userName);
final sendingEmails = await _sendingQueueRepository.getAllSendingEmails(accountId, userName, needToReopen: needToReopen);
yield Right<Failure, Success>(GetAllSendingEmailSuccess(sendingEmails));
} catch (e) {
yield Left<Failure, Success>(GetAllSendingEmailFailure(e));