TF-2667 Store email to sending queue when sending with no connection on mobile
This commit is contained in:
@@ -807,7 +807,7 @@ class ComposerController extends BaseController with DragDropFileMixin {
|
||||
cancelToken: cancelToken
|
||||
);
|
||||
log('ComposerController::_handleSendMessages: resultState = $resultState');
|
||||
if (resultState is SendEmailSuccess) {
|
||||
if (resultState is SendEmailSuccess || mailboxDashBoardController.validateSendingEmailFailedWhenNetworkIsLostOnMobile(resultState)) {
|
||||
_sendButtonState = ButtonState.enabled;
|
||||
_closeComposerAction(result: resultState);
|
||||
} else if (resultState is SendEmailFailure && resultState.exception is SendingEmailCanceledException) {
|
||||
|
||||
+18
-4
@@ -392,7 +392,10 @@ class MailboxDashBoardController extends ReloadableController {
|
||||
@override
|
||||
void handleExceptionAction({Failure? failure, Exception? exception}) {
|
||||
super.handleExceptionAction(failure: failure, exception: exception);
|
||||
if (failure is SendEmailFailure && exception is NoNetworkError) {
|
||||
if (failure is SendEmailFailure &&
|
||||
exception is NoNetworkError &&
|
||||
PlatformInfo.isMobile
|
||||
) {
|
||||
log('MailboxDashBoardController::handleExceptionAction(): $failure');
|
||||
_storeSendingEmailInCaseOfSendingFailureInMobile(failure);
|
||||
}
|
||||
@@ -1261,6 +1264,8 @@ class MailboxDashBoardController extends ReloadableController {
|
||||
result is SaveEmailAsDraftsSuccess ||
|
||||
result is UpdateEmailDraftsSuccess) {
|
||||
consumeState(Stream.value(Right<Failure, Success>(result)));
|
||||
} else if (validateSendingEmailFailedWhenNetworkIsLostOnMobile(result)) {
|
||||
_storeSendingEmailInCaseOfSendingFailureInMobile(result);
|
||||
}
|
||||
|
||||
await _removeComposerCacheOnWeb();
|
||||
@@ -1403,6 +1408,8 @@ class MailboxDashBoardController extends ReloadableController {
|
||||
result is SaveEmailAsDraftsSuccess ||
|
||||
result is UpdateEmailDraftsSuccess) {
|
||||
consumeState(Stream.value(Right<Failure, Success>(result)));
|
||||
} else if (validateSendingEmailFailedWhenNetworkIsLostOnMobile(result)) {
|
||||
_storeSendingEmailInCaseOfSendingFailureInMobile(result);
|
||||
}
|
||||
|
||||
await _removeComposerCacheOnWeb();
|
||||
@@ -1813,7 +1820,9 @@ class MailboxDashBoardController extends ReloadableController {
|
||||
|
||||
void _handleSendEmailFailure(SendEmailFailure failure) {
|
||||
logError('MailboxDashBoardController::_handleSendEmailFailure():failure: $failure');
|
||||
_storeSendingEmailInCaseOfSendingFailureInMobile(failure);
|
||||
if (PlatformInfo.isMobile) {
|
||||
_storeSendingEmailInCaseOfSendingFailureInMobile(failure);
|
||||
}
|
||||
if (currentContext == null) {
|
||||
clearState();
|
||||
return;
|
||||
@@ -1943,8 +1952,7 @@ class MailboxDashBoardController extends ReloadableController {
|
||||
}
|
||||
|
||||
void _storeSendingEmailInCaseOfSendingFailureInMobile(SendEmailFailure failure) {
|
||||
if (PlatformInfo.isMobile &&
|
||||
failure.session != null &&
|
||||
if (failure.session != null &&
|
||||
failure.accountId != null &&
|
||||
failure.emailRequest != null
|
||||
) {
|
||||
@@ -2475,6 +2483,12 @@ class MailboxDashBoardController extends ReloadableController {
|
||||
await _removeComposerCacheOnWebInteractor.execute();
|
||||
}
|
||||
|
||||
bool validateSendingEmailFailedWhenNetworkIsLostOnMobile(FeatureFailure failure) {
|
||||
return failure is SendEmailFailure &&
|
||||
failure.exception is NoNetworkError &&
|
||||
PlatformInfo.isMobile;
|
||||
}
|
||||
|
||||
@override
|
||||
void onClose() {
|
||||
_emailReceiveManager.closeEmailReceiveManagerStream();
|
||||
|
||||
Reference in New Issue
Block a user