TF-1594 Use only one class TmailToast to display the message.
(cherry picked from commit 379c34b32b2e5c4dad141e6a98bdb92597fa6908)
This commit is contained in:
@@ -1,18 +1,13 @@
|
||||
import 'package:contact/contact/model/capability_contact.dart';
|
||||
import 'package:core/presentation/extensions/color_extension.dart';
|
||||
import 'package:core/presentation/resources/image_paths.dart';
|
||||
import 'package:core/presentation/state/failure.dart';
|
||||
import 'package:core/presentation/state/success.dart';
|
||||
import 'package:core/presentation/utils/app_toast.dart';
|
||||
import 'package:core/presentation/utils/responsive_utils.dart';
|
||||
import 'package:core/utils/app_logger.dart';
|
||||
import 'package:core/utils/build_utils.dart';
|
||||
import 'package:core/utils/fps_manager.dart';
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:fcm/model/firebase_capability.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:forward/forward/capability_forward.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:jmap_dart_client/jmap/account_id.dart';
|
||||
@@ -77,7 +72,6 @@ abstract class BaseController extends GetxController
|
||||
|
||||
final AppToast _appToast = Get.find<AppToast>();
|
||||
|
||||
|
||||
final viewState = Rx<Either<Failure, Success>>(Right(UIState.idle));
|
||||
FpsCallback? fpsCallback;
|
||||
|
||||
@@ -137,7 +131,12 @@ abstract class BaseController extends GetxController
|
||||
if (failure.exception is NoNetworkError) {
|
||||
return true;
|
||||
} else if (failure.exception is BadCredentialsException) {
|
||||
_appToast.showErrorToast(AppLocalizations.of(currentContext!).badCredentials);
|
||||
if (currentOverlayContext != null && currentContext != null) {
|
||||
_appToast.showToastErrorMessage(
|
||||
currentOverlayContext!,
|
||||
AppLocalizations.of(currentContext!).badCredentials);
|
||||
}
|
||||
|
||||
checkAuthenticationTypeWhenLogout();
|
||||
return true;
|
||||
}
|
||||
@@ -152,8 +151,6 @@ abstract class BaseController extends GetxController
|
||||
}
|
||||
|
||||
final appToast = Get.find<AppToast>();
|
||||
final imagePaths = Get.find<ImagePaths>();
|
||||
final responsiveUtils = Get.find<ResponsiveUtils>();
|
||||
|
||||
String messageError = '';
|
||||
if (error is MethodLevelErrors) {
|
||||
@@ -165,19 +162,7 @@ abstract class BaseController extends GetxController
|
||||
}
|
||||
|
||||
if (messageError.isNotEmpty && currentContext != null && currentOverlayContext != null) {
|
||||
appToast.showBottomToast(
|
||||
currentOverlayContext!,
|
||||
messageError,
|
||||
leadingIcon: SvgPicture.asset(
|
||||
imagePaths.icNotConnection,
|
||||
width: 24,
|
||||
height: 24,
|
||||
colorFilter: Colors.white.asFilter(),
|
||||
fit: BoxFit.fill),
|
||||
backgroundColor: AppColor.toastErrorBackgroundColor,
|
||||
textColor: Colors.white,
|
||||
textActionColor: Colors.white,
|
||||
maxWidth: responsiveUtils.getMaxWidthToast(currentContext!));
|
||||
appToast.showToastErrorMessage(currentOverlayContext!, messageError);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -262,18 +247,18 @@ abstract class BaseController extends GetxController
|
||||
}
|
||||
|
||||
bool fcmEnabled(Session? session, AccountId? accountId) {
|
||||
bool _fcmEnabled = false;
|
||||
bool fcmEnabled = false;
|
||||
try {
|
||||
requireCapability(session!, accountId!, [FirebaseCapability.fcmIdentifier]);
|
||||
if (AppConfig.fcmAvailable) {
|
||||
_fcmEnabled = true;
|
||||
fcmEnabled = true;
|
||||
} else {
|
||||
_fcmEnabled = false;
|
||||
fcmEnabled = false;
|
||||
}
|
||||
} catch (e) {
|
||||
logError('BaseController::fcmEnabled(): exception: $e');
|
||||
}
|
||||
return _fcmEnabled;
|
||||
return fcmEnabled;
|
||||
}
|
||||
|
||||
void goToLogin({LoginArguments? arguments}) {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
|
||||
import 'package:core/presentation/resources/image_paths.dart';
|
||||
import 'package:core/presentation/utils/app_toast.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_date_range_picker/multiple_view_date_range_picker.dart';
|
||||
@@ -54,36 +53,26 @@ mixin DateRangePickerMixin {
|
||||
DateTime? endDate,
|
||||
{Function(DateTime? startDate, DateTime? endDate)? onCallbackAction}
|
||||
) {
|
||||
final _appToast = Get.find<AppToast>();
|
||||
final _imagePaths = Get.find<ImagePaths>();
|
||||
final appToast = Get.find<AppToast>();
|
||||
|
||||
if (startDate == null) {
|
||||
_appToast.showToastWithIcon(
|
||||
appToast.showToastErrorMessage(
|
||||
context,
|
||||
textColor: Colors.black,
|
||||
message: AppLocalizations.of(context).toastMessageErrorWhenSelectStartDateIsEmpty,
|
||||
icon: _imagePaths.icNotConnection
|
||||
);
|
||||
AppLocalizations.of(context).toastMessageErrorWhenSelectStartDateIsEmpty);
|
||||
return;
|
||||
}
|
||||
|
||||
if (endDate == null) {
|
||||
_appToast.showToastWithIcon(
|
||||
appToast.showToastErrorMessage(
|
||||
context,
|
||||
textColor: Colors.black,
|
||||
message: AppLocalizations.of(context).toastMessageErrorWhenSelectEndDateIsEmpty,
|
||||
icon: _imagePaths.icNotConnection
|
||||
);
|
||||
AppLocalizations.of(context).toastMessageErrorWhenSelectEndDateIsEmpty);
|
||||
return;
|
||||
}
|
||||
|
||||
if (endDate.isBefore(startDate)) {
|
||||
_appToast.showToastWithIcon(
|
||||
appToast.showToastErrorMessage(
|
||||
context,
|
||||
textColor: Colors.black,
|
||||
message: AppLocalizations.of(context).toastMessageErrorWhenSelectDateIsInValid,
|
||||
icon: _imagePaths.icNotConnection
|
||||
);
|
||||
AppLocalizations.of(context).toastMessageErrorWhenSelectDateIsInValid);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -872,8 +872,10 @@ class ComposerController extends BaseController {
|
||||
|
||||
void _pickFileFailure(Failure failure) {
|
||||
if (failure is LocalFilePickerFailure) {
|
||||
if (currentContext != null) {
|
||||
_appToast.showErrorToast(AppLocalizations.of(currentContext!).can_not_upload_this_file_as_attachments);
|
||||
if (currentOverlayContext != null && currentContext != null) {
|
||||
_appToast.showToastErrorMessage(
|
||||
currentOverlayContext!,
|
||||
AppLocalizations.of(currentContext!).can_not_upload_this_file_as_attachments);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,10 @@
|
||||
|
||||
import 'package:core/presentation/extensions/color_extension.dart';
|
||||
import 'package:core/presentation/resources/image_paths.dart';
|
||||
import 'package:core/presentation/state/failure.dart';
|
||||
import 'package:core/presentation/state/success.dart';
|
||||
import 'package:core/presentation/utils/app_toast.dart';
|
||||
import 'package:core/presentation/utils/responsive_utils.dart';
|
||||
import 'package:core/utils/build_utils.dart';
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:jmap_dart_client/jmap/account_id.dart';
|
||||
import 'package:jmap_dart_client/jmap/core/error/method/error_method_response.dart';
|
||||
@@ -51,8 +47,6 @@ class DestinationPickerController extends BaseMailboxController {
|
||||
|
||||
final _uuid = Get.find<Uuid>();
|
||||
final _appToast = Get.find<AppToast>();
|
||||
final _imagePaths = Get.find<ImagePaths>();
|
||||
final _responsiveUtils = Get.find<ResponsiveUtils>();
|
||||
|
||||
final SearchMailboxInteractor _searchMailboxInteractor;
|
||||
final CreateNewMailboxInteractor _createNewMailboxInteractor;
|
||||
@@ -318,19 +312,9 @@ class DestinationPickerController extends BaseMailboxController {
|
||||
|
||||
void openCreateNewMailboxView(BuildContext context) async {
|
||||
if (mailboxDestination.value == null) {
|
||||
_appToast.showBottomToast(
|
||||
_appToast.showToastErrorMessage(
|
||||
currentOverlayContext!,
|
||||
AppLocalizations.of(context).toastMessageErrorNotSelectedFolderWhenCreateNewMailbox,
|
||||
leadingIcon: SvgPicture.asset(
|
||||
_imagePaths.icNotConnection,
|
||||
width: 24,
|
||||
height: 24,
|
||||
colorFilter: Colors.white.asFilter(),
|
||||
fit: BoxFit.fill),
|
||||
backgroundColor: AppColor.toastErrorBackgroundColor,
|
||||
textColor: Colors.white,
|
||||
textActionColor: Colors.white,
|
||||
maxWidth: _responsiveUtils.getMaxWidthToast(currentContext!));
|
||||
AppLocalizations.of(context).toastMessageErrorNotSelectedFolderWhenCreateNewMailbox);
|
||||
} else {
|
||||
destinationScreenType.value = DestinationScreenType.createNewMailbox;
|
||||
_createListMailboxNameAsStringInMailboxLocation();
|
||||
@@ -363,20 +347,7 @@ class DestinationPickerController extends BaseMailboxController {
|
||||
if (exception is ErrorMethodResponse) {
|
||||
messageError = exception.description ?? AppLocalizations.of(currentContext!).create_new_mailbox_failure;
|
||||
}
|
||||
|
||||
_appToast.showBottomToast(
|
||||
currentOverlayContext!,
|
||||
messageError,
|
||||
leadingIcon: SvgPicture.asset(
|
||||
_imagePaths.icNotConnection,
|
||||
width: 24,
|
||||
height: 24,
|
||||
colorFilter: Colors.white.asFilter(),
|
||||
fit: BoxFit.fill),
|
||||
backgroundColor: AppColor.toastErrorBackgroundColor,
|
||||
textColor: Colors.white,
|
||||
textActionColor: Colors.white,
|
||||
maxWidth: _responsiveUtils.getMaxWidthToast(currentContext!));
|
||||
_appToast.showToastErrorMessage(currentOverlayContext!, messageError);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -409,19 +380,9 @@ class DestinationPickerController extends BaseMailboxController {
|
||||
FocusScope.of(context).unfocus();
|
||||
|
||||
if (mailboxDestination.value == null) {
|
||||
_appToast.showBottomToast(
|
||||
currentOverlayContext!,
|
||||
AppLocalizations.of(context).toastMessageErrorNotSelectedFolderWhenCreateNewMailbox,
|
||||
leadingIcon: SvgPicture.asset(
|
||||
_imagePaths.icNotConnection,
|
||||
width: 24,
|
||||
height: 24,
|
||||
colorFilter: Colors.white.asFilter(),
|
||||
fit: BoxFit.fill),
|
||||
backgroundColor: AppColor.toastErrorBackgroundColor,
|
||||
textColor: Colors.white,
|
||||
textActionColor: Colors.white,
|
||||
maxWidth: _responsiveUtils.getMaxWidthToast(currentContext!));
|
||||
_appToast.showToastErrorMessage(
|
||||
currentOverlayContext!,
|
||||
AppLocalizations.of(context).toastMessageErrorNotSelectedFolderWhenCreateNewMailbox);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -212,11 +212,12 @@ class SingleEmailController extends BaseController with AppLoaderMixin {
|
||||
taskId: success.taskId,
|
||||
attachment: success.attachment));
|
||||
|
||||
if (currentOverlayContext != null && currentContext != null) {
|
||||
_appToast.showToastWithIcon(currentOverlayContext!,
|
||||
message: AppLocalizations.of(currentContext!).your_download_has_started,
|
||||
iconColor: AppColor.primaryColor,
|
||||
icon: imagePaths.icDownload);
|
||||
if (currentOverlayContext != null && currentContext != null) {
|
||||
_appToast.showToastMessage(
|
||||
currentOverlayContext!,
|
||||
AppLocalizations.of(currentContext!).your_download_has_started,
|
||||
leadingSVGIconColor: AppColor.primaryColor,
|
||||
leadingSVGIcon: imagePaths.icDownload);
|
||||
}
|
||||
} else if (success is DownloadingAttachmentForWeb) {
|
||||
final percent = success.progress.round();
|
||||
@@ -445,8 +446,11 @@ class SingleEmailController extends BaseController with AppLoaderMixin {
|
||||
_downloadAttachmentsAction(attachments);
|
||||
break;
|
||||
case PermissionStatus.permanentlyDenied:
|
||||
if (context.mounted) {
|
||||
_appToast.showToast(AppLocalizations.of(context).you_need_to_grant_files_permission_to_download_attachments);
|
||||
if (context.mounted && currentOverlayContext != null && currentContext != null) {
|
||||
_appToast.showToastMessage(
|
||||
currentOverlayContext!,
|
||||
AppLocalizations.of(context).you_need_to_grant_files_permission_to_download_attachments,
|
||||
);
|
||||
}
|
||||
break;
|
||||
default: {
|
||||
@@ -456,8 +460,11 @@ class SingleEmailController extends BaseController with AppLoaderMixin {
|
||||
_downloadAttachmentsAction(attachments);
|
||||
break;
|
||||
default:
|
||||
if (context.mounted) {
|
||||
_appToast.showToast(AppLocalizations.of(context).you_need_to_grant_files_permission_to_download_attachments);
|
||||
if (context.mounted && currentOverlayContext != null && currentContext != null) {
|
||||
_appToast.showToastMessage(
|
||||
currentOverlayContext!,
|
||||
AppLocalizations.of(context).you_need_to_grant_files_permission_to_download_attachments,
|
||||
);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -477,8 +484,10 @@ class SingleEmailController extends BaseController with AppLoaderMixin {
|
||||
}
|
||||
|
||||
void _downloadAttachmentsFailure(DownloadAttachmentsFailure failure) {
|
||||
if (currentContext != null) {
|
||||
_appToast.showErrorToast(AppLocalizations.of(currentContext!).attachment_download_failed);
|
||||
if (currentOverlayContext != null && currentContext != null) {
|
||||
_appToast.showToastErrorMessage(
|
||||
currentOverlayContext!,
|
||||
AppLocalizations.of(currentContext!).attachment_download_failed);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -526,8 +535,11 @@ class SingleEmailController extends BaseController with AppLoaderMixin {
|
||||
void _exportAttachmentFailureAction(ExportAttachmentFailure failure) {
|
||||
if (failure.exception is! CancelDownloadFileException) {
|
||||
popBack();
|
||||
if (currentContext != null) {
|
||||
_appToast.showErrorToast(AppLocalizations.of(currentContext!).attachment_download_failed);
|
||||
|
||||
if (currentOverlayContext != null && currentContext != null) {
|
||||
_appToast.showToastErrorMessage(
|
||||
currentOverlayContext!,
|
||||
AppLocalizations.of(currentContext!).attachment_download_failed);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -550,8 +562,10 @@ class SingleEmailController extends BaseController with AppLoaderMixin {
|
||||
|
||||
if (openResult.type != open_file.ResultType.done) {
|
||||
logError('SingleEmailController::_openDownloadedPreviewWorkGroupDocument(): no preview available');
|
||||
if (currentContext != null) {
|
||||
_appToast.showErrorToast(AppLocalizations.of(currentContext!).noPreviewAvailable);
|
||||
if (currentOverlayContext != null && currentContext != null) {
|
||||
_appToast.showToastErrorMessage(
|
||||
currentOverlayContext!,
|
||||
AppLocalizations.of(currentContext!).noPreviewAvailable);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -587,13 +601,10 @@ class SingleEmailController extends BaseController with AppLoaderMixin {
|
||||
log('SingleEmailController::_downloadAttachmentForWebFailureAction(): $failure');
|
||||
mailboxDashBoardController.deleteDownloadTask(failure.taskId);
|
||||
|
||||
if (currentOverlayContext != null && currentContext != null) {
|
||||
_appToast.showToastWithIcon(currentOverlayContext!,
|
||||
message: AppLocalizations.of(currentContext!).attachment_download_failed,
|
||||
bgColor: AppColor.toastErrorBackgroundColor,
|
||||
textColor: Colors.white,
|
||||
iconColor: Colors.white,
|
||||
icon: imagePaths.icDownload);
|
||||
if (currentOverlayContext != null && currentContext != null) {
|
||||
_appToast.showToastErrorMessage(
|
||||
currentOverlayContext!,
|
||||
AppLocalizations.of(currentContext!).attachment_download_failed);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -682,7 +693,7 @@ class SingleEmailController extends BaseController with AppLoaderMixin {
|
||||
void _moveToMailboxSuccess(MoveToMailboxSuccess success) {
|
||||
mailboxDashBoardController.dispatchState(Right(success));
|
||||
if (success.moveAction == MoveAction.moving && currentContext != null && currentOverlayContext != null) {
|
||||
_appToast.showBottomToast(
|
||||
_appToast.showToastMessage(
|
||||
currentOverlayContext!,
|
||||
success.emailActionType.getToastMessageMoveToMailboxSuccess(currentContext!, destinationPath: success.destinationPath),
|
||||
actionName: AppLocalizations.of(currentContext!).undo,
|
||||
@@ -694,17 +705,11 @@ class SingleEmailController extends BaseController with AppLoaderMixin {
|
||||
mailboxDashBoardController.sessionCurrent!,
|
||||
success.emailActionType));
|
||||
},
|
||||
leadingIcon: SvgPicture.asset(
|
||||
imagePaths.icFolderMailbox,
|
||||
width: 24,
|
||||
height: 24,
|
||||
colorFilter: const ColorFilter.mode(Colors.white, BlendMode.srcIn),
|
||||
fit: BoxFit.fill),
|
||||
leadingSVGIcon: imagePaths.icFolderMailbox,
|
||||
leadingSVGIconColor: Colors.white,
|
||||
backgroundColor: AppColor.toastSuccessBackgroundColor,
|
||||
textColor: Colors.white,
|
||||
textActionColor: Colors.white,
|
||||
actionIcon: SvgPicture.asset(imagePaths.icUndo),
|
||||
maxWidth: responsiveUtils.getMaxWidthToast(currentContext!)
|
||||
actionIcon: SvgPicture.asset(imagePaths.icUndo)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -931,53 +936,23 @@ class SingleEmailController extends BaseController with AppLoaderMixin {
|
||||
}
|
||||
|
||||
if (_sendReceiptToSenderInteractor == null) {
|
||||
_appToast.showBottomToast(
|
||||
currentOverlayContext!,
|
||||
AppLocalizations.of(context).toastMessageNotSupportMdnWhenSendReceipt,
|
||||
leadingIcon: SvgPicture.asset(
|
||||
imagePaths.icNotConnection,
|
||||
width: 24,
|
||||
height: 24,
|
||||
colorFilter: const ColorFilter.mode(Colors.white, BlendMode.srcIn),
|
||||
fit: BoxFit.fill),
|
||||
backgroundColor: AppColor.toastErrorBackgroundColor,
|
||||
textColor: Colors.white,
|
||||
textActionColor: Colors.white,
|
||||
maxWidth: responsiveUtils.getMaxWidthToast(currentContext!));
|
||||
_appToast.showToastErrorMessage(
|
||||
currentOverlayContext!,
|
||||
AppLocalizations.of(context).toastMessageNotSupportMdnWhenSendReceipt);
|
||||
return;
|
||||
}
|
||||
|
||||
if (_identitySelected == null || _identitySelected?.id == null) {
|
||||
_appToast.showBottomToast(
|
||||
currentOverlayContext!,
|
||||
AppLocalizations.of(context).toastMessageCannotFoundIdentityWhenSendReceipt,
|
||||
leadingIcon: SvgPicture.asset(
|
||||
imagePaths.icNotConnection,
|
||||
width: 24,
|
||||
height: 24,
|
||||
colorFilter: const ColorFilter.mode(Colors.white, BlendMode.srcIn),
|
||||
fit: BoxFit.fill),
|
||||
backgroundColor: AppColor.toastErrorBackgroundColor,
|
||||
textColor: Colors.white,
|
||||
textActionColor: Colors.white,
|
||||
maxWidth: responsiveUtils.getMaxWidthToast(currentContext!));
|
||||
_appToast.showToastErrorMessage(
|
||||
currentOverlayContext!,
|
||||
AppLocalizations.of(context).toastMessageCannotFoundIdentityWhenSendReceipt);
|
||||
return;
|
||||
}
|
||||
|
||||
if (currentEmail == null || _currentEmailId == null) {
|
||||
_appToast.showBottomToast(
|
||||
currentOverlayContext!,
|
||||
AppLocalizations.of(context).toastMessageCannotFoundEmailIdWhenSendReceipt,
|
||||
leadingIcon: SvgPicture.asset(
|
||||
imagePaths.icNotConnection,
|
||||
width: 24,
|
||||
height: 24,
|
||||
colorFilter: const ColorFilter.mode(Colors.white, BlendMode.srcIn),
|
||||
fit: BoxFit.fill),
|
||||
backgroundColor: AppColor.toastErrorBackgroundColor,
|
||||
textColor: Colors.white,
|
||||
textActionColor: Colors.white,
|
||||
maxWidth: responsiveUtils.getMaxWidthToast(currentContext!));
|
||||
_appToast.showToastErrorMessage(
|
||||
currentOverlayContext!,
|
||||
AppLocalizations.of(context).toastMessageCannotFoundEmailIdWhenSendReceipt);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1027,18 +1002,10 @@ class SingleEmailController extends BaseController with AppLoaderMixin {
|
||||
void _sendReceiptToSenderSuccess(SendReceiptToSenderSuccess success) {
|
||||
log('SingleEmailController::_sendReceiptToSenderSuccess(): ${success.mdn.toString()}');
|
||||
if (currentContext != null) {
|
||||
_appToast.showBottomToast(
|
||||
currentOverlayContext!,
|
||||
AppLocalizations.of(currentContext!).toastMessageSendReceiptSuccess,
|
||||
leadingIcon: SvgPicture.asset(
|
||||
imagePaths.icReadReceiptMessage,
|
||||
width: 24,
|
||||
height: 24,
|
||||
fit: BoxFit.fill),
|
||||
backgroundColor: AppColor.toastSuccessBackgroundColor,
|
||||
textColor: Colors.white,
|
||||
textActionColor: Colors.white,
|
||||
maxWidth: responsiveUtils.getMaxWidthToast(currentContext!));
|
||||
_appToast.showToastSuccessMessage(
|
||||
currentOverlayContext!,
|
||||
AppLocalizations.of(currentContext!).toastMessageSendReceiptSuccess,
|
||||
leadingSVGIcon: imagePaths.icReadReceiptMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1152,10 +1119,9 @@ class SingleEmailController extends BaseController with AppLoaderMixin {
|
||||
void _createNewRuleFilterSuccess(CreateNewRuleFilterSuccess success) {
|
||||
if (success.newListRules.isNotEmpty == true) {
|
||||
if (currentOverlayContext != null && currentContext != null) {
|
||||
_appToast.showToastWithIcon(
|
||||
_appToast.showToastSuccessMessage(
|
||||
currentOverlayContext!,
|
||||
message: AppLocalizations.of(currentContext!).newFilterWasCreated,
|
||||
icon: imagePaths.icSelected);
|
||||
AppLocalizations.of(currentContext!).newFilterWasCreated);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -509,19 +509,11 @@ class MailboxController extends BaseMailboxController with MailboxActionHandlerM
|
||||
|
||||
void _createNewMailboxSuccess(CreateNewMailboxSuccess success) {
|
||||
if (currentOverlayContext != null && currentContext != null) {
|
||||
_appToast.showBottomToast(
|
||||
currentOverlayContext!,
|
||||
AppLocalizations.of(currentContext!).new_mailbox_is_created(success.newMailbox.name?.name ?? ''),
|
||||
leadingIcon: SvgPicture.asset(
|
||||
_imagePaths.icFolderMailbox,
|
||||
width: 24,
|
||||
height: 24,
|
||||
colorFilter: Colors.white.asFilter(),
|
||||
fit: BoxFit.fill),
|
||||
backgroundColor: AppColor.toastSuccessBackgroundColor,
|
||||
textColor: Colors.white,
|
||||
textActionColor: Colors.white,
|
||||
maxWidth: _responsiveUtils.getMaxWidthToast(currentContext!));
|
||||
_appToast.showToastSuccessMessage(
|
||||
currentOverlayContext!,
|
||||
AppLocalizations.of(currentContext!).new_mailbox_is_created(success.newMailbox.name?.name ?? ''),
|
||||
leadingSVGIconColor: Colors.white,
|
||||
leadingSVGIcon: _imagePaths.icFolderMailbox);
|
||||
}
|
||||
|
||||
_refreshMailboxChanges(currentMailboxState: success.currentMailboxState);
|
||||
@@ -534,20 +526,7 @@ class MailboxController extends BaseMailboxController with MailboxActionHandlerM
|
||||
if (exception is ErrorMethodResponse) {
|
||||
messageError = exception.description ?? AppLocalizations.of(currentContext!).create_new_mailbox_failure;
|
||||
}
|
||||
|
||||
_appToast.showBottomToast(
|
||||
currentOverlayContext!,
|
||||
messageError,
|
||||
leadingIcon: SvgPicture.asset(
|
||||
_imagePaths.icNotConnection,
|
||||
width: 24,
|
||||
height: 24,
|
||||
colorFilter: Colors.white.asFilter(),
|
||||
fit: BoxFit.fill),
|
||||
backgroundColor: AppColor.toastErrorBackgroundColor,
|
||||
textColor: Colors.white,
|
||||
textActionColor: Colors.white,
|
||||
maxWidth: _responsiveUtils.getMaxWidthToast(currentContext!));
|
||||
_appToast.showToastErrorMessage(currentOverlayContext!, messageError);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -685,11 +664,11 @@ class MailboxController extends BaseMailboxController with MailboxActionHandlerM
|
||||
jmap.State? currentMailboxState
|
||||
) {
|
||||
if (currentOverlayContext != null && currentContext != null) {
|
||||
_appToast.showToastWithIcon(
|
||||
currentOverlayContext!,
|
||||
message: AppLocalizations.of(currentContext!).delete_mailboxes_successfully,
|
||||
icon: _imagePaths.icSelected);
|
||||
_appToast.showToastSuccessMessage(
|
||||
currentOverlayContext!,
|
||||
AppLocalizations.of(currentContext!).delete_mailboxes_successfully);
|
||||
}
|
||||
|
||||
if (listMailboxIdDeleted.contains(selectedMailbox?.id)) {
|
||||
_switchBackToMailboxDefault();
|
||||
_closeEmailViewIfMailboxDisabledOrNotExist(listMailboxIdDeleted);
|
||||
@@ -772,10 +751,11 @@ class MailboxController extends BaseMailboxController with MailboxActionHandlerM
|
||||
|
||||
void _deleteMailboxFailure(DeleteMultipleMailboxFailure failure) {
|
||||
if (currentOverlayContext != null && currentContext != null) {
|
||||
_appToast.showToastWithIcon(
|
||||
currentOverlayContext!,
|
||||
message: AppLocalizations.of(currentContext!).delete_mailboxes_failure,
|
||||
icon: _imagePaths.icDeleteToast);
|
||||
_appToast.showToastErrorMessage(
|
||||
currentOverlayContext!,
|
||||
AppLocalizations.of(currentContext!).delete_mailboxes_failure,
|
||||
leadingSVGIcon: _imagePaths.icDeleteToast
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -810,7 +790,7 @@ class MailboxController extends BaseMailboxController with MailboxActionHandlerM
|
||||
if (success.moveAction == MoveAction.moving
|
||||
&& currentOverlayContext != null
|
||||
&& currentContext != null) {
|
||||
_appToast.showBottomToast(
|
||||
_appToast.showToastMessage(
|
||||
currentOverlayContext!,
|
||||
AppLocalizations.of(currentContext!).moved_to_mailbox(
|
||||
success.destinationMailboxName?.name ?? AppLocalizations.of(currentContext!).allMailboxes),
|
||||
@@ -822,17 +802,11 @@ class MailboxController extends BaseMailboxController with MailboxActionHandlerM
|
||||
destinationMailboxId: success.parentId,
|
||||
parentId: success.destinationMailboxId));
|
||||
},
|
||||
leadingIcon: SvgPicture.asset(
|
||||
_imagePaths.icFolderMailbox,
|
||||
width: 24,
|
||||
height: 24,
|
||||
colorFilter: Colors.white.asFilter(),
|
||||
fit: BoxFit.fill),
|
||||
leadingSVGIcon: _imagePaths.icFolderMailbox,
|
||||
leadingSVGIconColor: Colors.white,
|
||||
backgroundColor: AppColor.toastSuccessBackgroundColor,
|
||||
textColor: Colors.white,
|
||||
textActionColor: Colors.white,
|
||||
actionIcon: SvgPicture.asset(_imagePaths.icUndo),
|
||||
maxWidth: _responsiveUtils.getMaxWidthToast(currentContext!));
|
||||
actionIcon: SvgPicture.asset(_imagePaths.icUndo));
|
||||
}
|
||||
|
||||
_refreshMailboxChanges(currentMailboxState: success.currentMailboxState);
|
||||
@@ -1106,7 +1080,7 @@ class MailboxController extends BaseMailboxController with MailboxActionHandlerM
|
||||
{List<MailboxId>? listDescendantMailboxIds}
|
||||
) {
|
||||
if (currentOverlayContext != null && currentContext != null) {
|
||||
_appToast.showBottomToast(
|
||||
_appToast.showToastMessage(
|
||||
currentOverlayContext!,
|
||||
AppLocalizations.of(currentContext!).toastMsgHideMailboxSuccess,
|
||||
actionName: AppLocalizations.of(currentContext!).undo,
|
||||
@@ -1114,19 +1088,11 @@ class MailboxController extends BaseMailboxController with MailboxActionHandlerM
|
||||
mailboxIdSubscribed,
|
||||
listDescendantMailboxIds: listDescendantMailboxIds
|
||||
),
|
||||
leadingIcon: SvgPicture.asset(
|
||||
_imagePaths.icFolderMailbox,
|
||||
width: 24,
|
||||
height: 24,
|
||||
colorFilter: Colors.white.asFilter(),
|
||||
fit: BoxFit.fill
|
||||
),
|
||||
leadingSVGIcon: _imagePaths.icFolderMailbox,
|
||||
leadingSVGIconColor: Colors.white,
|
||||
backgroundColor: AppColor.toastSuccessBackgroundColor,
|
||||
textColor: Colors.white,
|
||||
textActionColor: Colors.white,
|
||||
actionIcon: SvgPicture.asset(_imagePaths.icUndo),
|
||||
maxWidth: _responsiveUtils.getMaxWidthToast(currentContext!)
|
||||
);
|
||||
actionIcon: SvgPicture.asset(_imagePaths.icUndo));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,6 @@ class BottomBarSelectionMailboxWidget extends StatelessWidget {
|
||||
|
||||
Widget _buildMailboxActionButton(BuildContext context, MailboxActions actions) {
|
||||
return Expanded(child: (ButtonBuilder(actions.getContextMenuIcon(_imagePaths))
|
||||
..key(const Key('button_move_all_mailbox'))
|
||||
..radiusSplash(8)
|
||||
..padding(const EdgeInsets.all(8))
|
||||
..tooltip(actions.getTitleContextMenu(context))
|
||||
|
||||
+112
-137
@@ -262,10 +262,10 @@ class MailboxDashBoardController extends ReloadableController {
|
||||
log('MailboxDashBoardController::onData():success $success');
|
||||
if (success is SendingEmailState) {
|
||||
if (currentOverlayContext != null && currentContext != null) {
|
||||
_appToast.showToastWithIcon(
|
||||
currentOverlayContext!,
|
||||
message: AppLocalizations.of(currentContext!).your_email_being_sent,
|
||||
icon: _imagePaths.icSendToast,
|
||||
_appToast.showToastMessage(
|
||||
currentOverlayContext!,
|
||||
AppLocalizations.of(currentContext!).your_email_being_sent,
|
||||
leadingSVGIcon: _imagePaths.icSendToast
|
||||
);
|
||||
}
|
||||
} else if (success is GetEmailStateToRefreshSuccess) {
|
||||
@@ -301,11 +301,10 @@ class MailboxDashBoardController extends ReloadableController {
|
||||
(success) {
|
||||
if (success is SendEmailSuccess) {
|
||||
if (currentOverlayContext != null && currentContext != null) {
|
||||
_appToast.showToastWithIcon(
|
||||
currentOverlayContext!,
|
||||
textColor: AppColor.primaryColor,
|
||||
message: AppLocalizations.of(currentContext!).message_has_been_sent_successfully,
|
||||
icon: _imagePaths.icSendToast);
|
||||
_appToast.showToastSuccessMessage(
|
||||
currentOverlayContext!,
|
||||
AppLocalizations.of(currentContext!).message_has_been_sent_successfully,
|
||||
leadingSVGIcon: _imagePaths.icSendSuccessToast);
|
||||
}
|
||||
} else if (success is SaveEmailAsDraftsSuccess) {
|
||||
log('MailboxDashBoardController::onDone(): SaveEmailAsDraftsSuccess');
|
||||
@@ -580,23 +579,16 @@ class MailboxDashBoardController extends ReloadableController {
|
||||
|
||||
void _saveEmailAsDraftsSuccess(SaveEmailAsDraftsSuccess success) {
|
||||
if (currentContext != null && currentOverlayContext != null) {
|
||||
_appToast.showBottomToast(
|
||||
currentOverlayContext!,
|
||||
AppLocalizations.of(currentContext!).drafts_saved,
|
||||
actionName: AppLocalizations.of(currentContext!).discard,
|
||||
onActionClick: () => _discardEmail(success.emailAsDrafts),
|
||||
leadingIcon: SvgPicture.asset(
|
||||
_imagePaths.icMailboxDrafts,
|
||||
width: 24,
|
||||
height: 24,
|
||||
colorFilter: Colors.white.asFilter(),
|
||||
fit: BoxFit.fill),
|
||||
backgroundColor: AppColor.toastSuccessBackgroundColor,
|
||||
textColor: Colors.white,
|
||||
textActionColor: Colors.white,
|
||||
actionIcon: SvgPicture.asset(_imagePaths.icUndo),
|
||||
maxWidth: _responsiveUtils.getMaxWidthToast(currentContext!)
|
||||
);
|
||||
_appToast.showToastMessage(
|
||||
currentOverlayContext!,
|
||||
AppLocalizations.of(currentContext!).drafts_saved,
|
||||
actionName: AppLocalizations.of(currentContext!).discard,
|
||||
onActionClick: () => _discardEmail(success.emailAsDrafts),
|
||||
leadingSVGIcon: _imagePaths.icMailboxDrafts,
|
||||
leadingSVGIconColor: Colors.white,
|
||||
backgroundColor: AppColor.toastSuccessBackgroundColor,
|
||||
textColor: Colors.white,
|
||||
actionIcon: SvgPicture.asset(_imagePaths.icUndo));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -606,30 +598,24 @@ class MailboxDashBoardController extends ReloadableController {
|
||||
|
||||
void _moveToMailboxSuccess(MoveToMailboxSuccess success) {
|
||||
if (success.moveAction == MoveAction.moving && currentContext != null && currentOverlayContext != null) {
|
||||
_appToast.showBottomToast(
|
||||
currentOverlayContext!,
|
||||
success.emailActionType.getToastMessageMoveToMailboxSuccess(currentContext!, destinationPath: success.destinationPath),
|
||||
actionName: AppLocalizations.of(currentContext!).undo,
|
||||
onActionClick: () {
|
||||
_revertedToOriginalMailbox(MoveToMailboxRequest(
|
||||
{success.destinationMailboxId: [success.emailId]},
|
||||
success.currentMailboxId,
|
||||
MoveAction.undo,
|
||||
sessionCurrent!,
|
||||
success.emailActionType));
|
||||
},
|
||||
leadingIcon: SvgPicture.asset(
|
||||
_imagePaths.icFolderMailbox,
|
||||
width: 24,
|
||||
height: 24,
|
||||
colorFilter: Colors.white.asFilter(),
|
||||
fit: BoxFit.fill),
|
||||
backgroundColor: AppColor.toastSuccessBackgroundColor,
|
||||
textColor: Colors.white,
|
||||
textActionColor: Colors.white,
|
||||
actionIcon: SvgPicture.asset(_imagePaths.icUndo),
|
||||
maxWidth: _responsiveUtils.getMaxWidthToast(currentContext!)
|
||||
);
|
||||
_appToast.showToastMessage(
|
||||
currentOverlayContext!,
|
||||
success.emailActionType.getToastMessageMoveToMailboxSuccess(currentContext!, destinationPath: success.destinationPath),
|
||||
actionName: AppLocalizations.of(currentContext!).undo,
|
||||
onActionClick: () {
|
||||
_revertedToOriginalMailbox(MoveToMailboxRequest(
|
||||
{success.destinationMailboxId: [success.emailId]},
|
||||
success.currentMailboxId,
|
||||
MoveAction.undo,
|
||||
sessionCurrent!,
|
||||
success.emailActionType
|
||||
));
|
||||
},
|
||||
leadingSVGIcon: _imagePaths.icFolderMailbox,
|
||||
leadingSVGIconColor: Colors.white,
|
||||
backgroundColor: AppColor.toastSuccessBackgroundColor,
|
||||
textColor: Colors.white,
|
||||
actionIcon: SvgPicture.asset(_imagePaths.icUndo));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -655,12 +641,12 @@ class MailboxDashBoardController extends ReloadableController {
|
||||
}
|
||||
|
||||
void _deleteEmailPermanentlySuccess(DeleteEmailPermanentlySuccess success) {
|
||||
if (currentContext != null && currentOverlayContext != null) {
|
||||
_appToast.showToastWithIcon(
|
||||
currentOverlayContext!,
|
||||
widthToast: _responsiveUtils.isDesktop(currentContext!) ? 360 : null,
|
||||
message: AppLocalizations.of(currentContext!).toast_message_delete_a_email_permanently_success,
|
||||
icon: _imagePaths.icDeleteToast);
|
||||
if (currentOverlayContext != null && currentContext != null) {
|
||||
_appToast.showToastSuccessMessage(
|
||||
currentOverlayContext!,
|
||||
AppLocalizations.of(currentContext!).toast_message_delete_a_email_permanently_success,
|
||||
leadingSVGIcon: _imagePaths.icDeleteToast
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -704,16 +690,18 @@ class MailboxDashBoardController extends ReloadableController {
|
||||
readActions = success.readActions;
|
||||
}
|
||||
|
||||
if (currentContext != null && readActions != null && currentOverlayContext != null) {
|
||||
if (readActions != null && currentContext != null && currentOverlayContext != null) {
|
||||
final message = readActions == ReadActions.markAsUnread
|
||||
? AppLocalizations.of(currentContext!).marked_message_toast(AppLocalizations.of(currentContext!).unread)
|
||||
: AppLocalizations.of(currentContext!).marked_message_toast(AppLocalizations.of(currentContext!).read);
|
||||
_appToast.showToastWithIcon(
|
||||
currentOverlayContext!,
|
||||
message: message,
|
||||
icon: readActions == ReadActions.markAsUnread
|
||||
? _imagePaths.icUnreadToast
|
||||
: _imagePaths.icReadToast);
|
||||
? AppLocalizations.of(currentContext!).marked_message_toast(AppLocalizations.of(currentContext!).unread)
|
||||
: AppLocalizations.of(currentContext!).marked_message_toast(AppLocalizations.of(currentContext!).read);
|
||||
|
||||
_appToast.showToastSuccessMessage(
|
||||
currentOverlayContext!,
|
||||
message,
|
||||
leadingSVGIcon: readActions == ReadActions.markAsUnread
|
||||
? _imagePaths.icUnreadToast
|
||||
: _imagePaths.icReadToast
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -741,16 +729,19 @@ class MailboxDashBoardController extends ReloadableController {
|
||||
countMarkStarSuccess = success.countMarkStarSuccess;
|
||||
}
|
||||
|
||||
if (currentContext != null && markStarAction != null && currentOverlayContext != null) {
|
||||
if (markStarAction != null) {
|
||||
final message = markStarAction == MarkStarAction.unMarkStar
|
||||
? AppLocalizations.of(currentContext!).marked_unstar_multiple_item(countMarkStarSuccess)
|
||||
: AppLocalizations.of(currentContext!).marked_star_multiple_item(countMarkStarSuccess);
|
||||
_appToast.showToastWithIcon(
|
||||
? AppLocalizations.of(currentContext!).marked_unstar_multiple_item(countMarkStarSuccess)
|
||||
: AppLocalizations.of(currentContext!).marked_star_multiple_item(countMarkStarSuccess);
|
||||
|
||||
if (currentOverlayContext != null && currentContext != null) {
|
||||
_appToast.showToastMessage(
|
||||
currentOverlayContext!,
|
||||
message: message,
|
||||
icon: markStarAction == MarkStarAction.unMarkStar
|
||||
? _imagePaths.icUnStar
|
||||
: _imagePaths.icStar);
|
||||
message,
|
||||
leadingSVGIcon: markStarAction == MarkStarAction.unMarkStar
|
||||
? _imagePaths.icUnStar
|
||||
: _imagePaths.icStar);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -932,36 +923,31 @@ class MailboxDashBoardController extends ReloadableController {
|
||||
currentOverlayContext != null &&
|
||||
emailActionType != null &&
|
||||
moveAction == MoveAction.moving) {
|
||||
_appToast.showBottomToast(
|
||||
currentOverlayContext!,
|
||||
emailActionType.getToastMessageMoveToMailboxSuccess(
|
||||
currentContext!,
|
||||
destinationPath: destinationPath),
|
||||
actionName: AppLocalizations.of(currentContext!).undo,
|
||||
onActionClick: () {
|
||||
final newCurrentMailboxId = destinationMailboxId;
|
||||
final newDestinationMailboxId = currentMailboxId;
|
||||
if (newCurrentMailboxId != null && newDestinationMailboxId != null) {
|
||||
_revertedSelectionEmailToOriginalMailbox(MoveToMailboxRequest(
|
||||
{newCurrentMailboxId: movedEmailIds},
|
||||
newDestinationMailboxId,
|
||||
MoveAction.undo,
|
||||
sessionCurrent!,
|
||||
emailActionType!,
|
||||
destinationPath: destinationPath));
|
||||
}
|
||||
},
|
||||
leadingIcon: SvgPicture.asset(
|
||||
_imagePaths.icFolderMailbox,
|
||||
width: 24,
|
||||
height: 24,
|
||||
colorFilter: Colors.white.asFilter(),
|
||||
fit: BoxFit.fill),
|
||||
backgroundColor: AppColor.toastSuccessBackgroundColor,
|
||||
textColor: Colors.white,
|
||||
textActionColor: Colors.white,
|
||||
actionIcon: SvgPicture.asset(_imagePaths.icUndo),
|
||||
maxWidth: _responsiveUtils.getMaxWidthToast(currentContext!)
|
||||
_appToast.showToastMessage(
|
||||
currentOverlayContext!,
|
||||
emailActionType.getToastMessageMoveToMailboxSuccess(
|
||||
currentContext!,
|
||||
destinationPath: destinationPath),
|
||||
actionName: AppLocalizations.of(currentContext!).undo,
|
||||
onActionClick: () {
|
||||
final newCurrentMailboxId = destinationMailboxId;
|
||||
final newDestinationMailboxId = currentMailboxId;
|
||||
if (newCurrentMailboxId != null && newDestinationMailboxId != null) {
|
||||
_revertedSelectionEmailToOriginalMailbox(MoveToMailboxRequest(
|
||||
{newCurrentMailboxId: movedEmailIds},
|
||||
newDestinationMailboxId,
|
||||
MoveAction.undo,
|
||||
sessionCurrent!,
|
||||
emailActionType!,
|
||||
destinationPath: destinationPath
|
||||
));
|
||||
}
|
||||
},
|
||||
leadingSVGIconColor: Colors.white,
|
||||
leadingSVGIcon: _imagePaths.icFolderMailbox,
|
||||
backgroundColor: AppColor.toastSuccessBackgroundColor,
|
||||
textColor: Colors.white,
|
||||
actionIcon: SvgPicture.asset(_imagePaths.icUndo),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1095,12 +1081,10 @@ class MailboxDashBoardController extends ReloadableController {
|
||||
}
|
||||
|
||||
void _emptyTrashFolderSuccess(EmptyTrashFolderSuccess success) {
|
||||
if (currentContext != null && currentOverlayContext != null) {
|
||||
_appToast.showToastWithIcon(
|
||||
currentOverlayContext!,
|
||||
widthToast: _responsiveUtils.isDesktop(currentContext!) ? 360 : null,
|
||||
message: AppLocalizations.of(currentContext!).toast_message_empty_trash_folder_success,
|
||||
icon: _imagePaths.icDeleteToast);
|
||||
if (currentOverlayContext != null && currentContext != null) {
|
||||
_appToast.showToastSuccessMessage(
|
||||
currentOverlayContext!,
|
||||
AppLocalizations.of(currentContext!).toast_message_empty_trash_folder_success);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1122,12 +1106,10 @@ class MailboxDashBoardController extends ReloadableController {
|
||||
listEmailIdResult = success.emailIds;
|
||||
}
|
||||
|
||||
if (currentContext != null && currentOverlayContext != null && listEmailIdResult.isNotEmpty) {
|
||||
_appToast.showToastWithIcon(
|
||||
currentOverlayContext!,
|
||||
widthToast: _responsiveUtils.isDesktop(currentContext!) ? 360 : null,
|
||||
message: AppLocalizations.of(currentContext!).toast_message_delete_multiple_email_permanently_success(listEmailIdResult.length),
|
||||
icon: _imagePaths.icDeleteToast);
|
||||
if (currentOverlayContext != null && currentContext != null && listEmailIdResult.isNotEmpty) {
|
||||
_appToast.showToastSuccessMessage(
|
||||
currentOverlayContext!,
|
||||
AppLocalizations.of(currentContext!).toast_message_delete_multiple_email_permanently_success(listEmailIdResult.length));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1237,21 +1219,17 @@ class MailboxDashBoardController extends ReloadableController {
|
||||
|
||||
if (success is MarkAsMailboxReadAllSuccess) {
|
||||
if (currentContext != null && currentOverlayContext != null) {
|
||||
_appToast.showToastWithIcon(
|
||||
currentOverlayContext!,
|
||||
widthToast: _responsiveUtils.isDesktop(currentContext!) ? 360 : null,
|
||||
message: AppLocalizations.of(currentContext!)
|
||||
.toastMessageMarkAsMailboxReadSuccess(success.mailboxName.name),
|
||||
icon: _imagePaths.icReadToast);
|
||||
_appToast.showToastSuccessMessage(
|
||||
currentOverlayContext!,
|
||||
AppLocalizations.of(currentContext!).toastMessageMarkAsMailboxReadSuccess(success.mailboxName.name),
|
||||
leadingSVGIcon: _imagePaths.icReadToast);
|
||||
}
|
||||
} else if (success is MarkAsMailboxReadHasSomeEmailFailure) {
|
||||
if (currentContext != null && currentOverlayContext != null) {
|
||||
_appToast.showToastWithIcon(
|
||||
currentOverlayContext!,
|
||||
widthToast: _responsiveUtils.isDesktop(currentContext!) ? 360 : null,
|
||||
message: AppLocalizations.of(currentContext!)
|
||||
.toastMessageMarkAsMailboxReadHasSomeEmailFailure(success.mailboxName.name, success.countEmailsRead),
|
||||
icon: _imagePaths.icReadToast);
|
||||
_appToast.showToastSuccessMessage(
|
||||
currentOverlayContext!,
|
||||
AppLocalizations.of(currentContext!).toastMessageMarkAsMailboxReadHasSomeEmailFailure(success.mailboxName.name, success.countEmailsRead),
|
||||
leadingSVGIcon: _imagePaths.icReadToast);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1347,10 +1325,9 @@ class MailboxDashBoardController extends ReloadableController {
|
||||
void _handleUpdateVacationSuccess(UpdateVacationSuccess success) {
|
||||
if (success.listVacationResponse.isNotEmpty) {
|
||||
if (currentContext != null && currentOverlayContext != null) {
|
||||
_appToast.showToastWithIcon(
|
||||
currentOverlayContext!,
|
||||
message: AppLocalizations.of(currentContext!).yourVacationResponderIsDisabledSuccessfully,
|
||||
icon: _imagePaths.icChecked);
|
||||
_appToast.showToastSuccessMessage(
|
||||
currentOverlayContext!,
|
||||
AppLocalizations.of(currentContext!).yourVacationResponderIsDisabledSuccessfully);
|
||||
}
|
||||
vacationResponse.value = success.listVacationResponse.first;
|
||||
log('MailboxDashBoardController::_handleUpdateVacationSuccess(): $vacationResponse');
|
||||
@@ -1623,13 +1600,11 @@ class MailboxDashBoardController extends ReloadableController {
|
||||
}
|
||||
|
||||
void _showToastSendMessageFailure(String message) {
|
||||
if (currentOverlayContext != null) {
|
||||
_appToast.showToastWithIcon(
|
||||
if (currentOverlayContext != null && currentContext != null) {
|
||||
_appToast.showToastErrorMessage(
|
||||
currentOverlayContext!,
|
||||
textColor: AppColor.toastErrorBackgroundColor,
|
||||
message: message,
|
||||
icon: _imagePaths.icSendToast
|
||||
);
|
||||
message,
|
||||
leadingSVGIcon: _imagePaths.icSendSuccessToast);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -123,10 +123,9 @@ class EmailRulesController extends BaseController {
|
||||
void _createNewRuleFilterSuccess(CreateNewRuleFilterSuccess success) {
|
||||
if (success.newListRules.isNotEmpty == true) {
|
||||
if (currentOverlayContext != null && currentContext != null) {
|
||||
_appToast.showToastWithIcon(
|
||||
currentOverlayContext!,
|
||||
message: AppLocalizations.of(currentContext!).newFilterWasCreated,
|
||||
icon: _imagePaths.icSelected);
|
||||
_appToast.showToastSuccessMessage(
|
||||
currentOverlayContext!,
|
||||
AppLocalizations.of(currentContext!).newFilterWasCreated);
|
||||
}
|
||||
listEmailRule.value = success.newListRules;
|
||||
listEmailRule.refresh();
|
||||
@@ -176,10 +175,9 @@ class EmailRulesController extends BaseController {
|
||||
void _editEmailRuleFilterSuccess(EditEmailRuleFilterSuccess success) {
|
||||
if (success.listRulesUpdated.isNotEmpty == true) {
|
||||
if (currentOverlayContext != null && currentContext != null) {
|
||||
_appToast.showToastWithIcon(
|
||||
currentOverlayContext!,
|
||||
message: AppLocalizations.of(currentContext!).yourFilterHasBeenUpdated,
|
||||
icon: _imagePaths.icSelected);
|
||||
_appToast.showToastSuccessMessage(
|
||||
currentOverlayContext!,
|
||||
AppLocalizations.of(currentContext!).yourFilterHasBeenUpdated);
|
||||
}
|
||||
listEmailRule.value = success.listRulesUpdated;
|
||||
listEmailRule.refresh();
|
||||
@@ -239,11 +237,9 @@ class EmailRulesController extends BaseController {
|
||||
|
||||
void _handleDeleteEmailRuleSuccess(DeleteEmailRuleSuccess success) {
|
||||
if (currentOverlayContext != null && currentContext != null) {
|
||||
_appToast.showToastWithIcon(
|
||||
_appToast.showToastSuccessMessage(
|
||||
currentOverlayContext!,
|
||||
message: AppLocalizations.of(currentContext!).toastMessageDeleteEmailRuleSuccessfully,
|
||||
icon: _imagePaths.icSelected,
|
||||
);
|
||||
AppLocalizations.of(currentContext!).toastMessageDeleteEmailRuleSuccessfully);
|
||||
}
|
||||
|
||||
if (success.rules?.isNotEmpty == true) {
|
||||
|
||||
@@ -151,11 +151,9 @@ class ForwardController extends BaseController {
|
||||
|
||||
void _handleDeleteRecipientSuccess(DeleteRecipientInForwardingSuccess success) {
|
||||
if (currentOverlayContext != null && currentContext != null) {
|
||||
_appToast.showToastWithIcon(
|
||||
_appToast.showToastSuccessMessage(
|
||||
currentOverlayContext!,
|
||||
message: AppLocalizations.of(currentContext!).toastMessageDeleteRecipientSuccessfully,
|
||||
icon: _imagePaths.icSelected,
|
||||
);
|
||||
AppLocalizations.of(currentContext!).toastMessageDeleteRecipientSuccessfully);
|
||||
}
|
||||
|
||||
currentForward.value = success.forward;
|
||||
@@ -255,11 +253,9 @@ class ForwardController extends BaseController {
|
||||
|
||||
void _handleAddRecipientsSuccess(AddRecipientsInForwardingSuccess success) {
|
||||
if (currentOverlayContext != null && currentContext != null) {
|
||||
_appToast.showToastWithIcon(
|
||||
_appToast.showToastSuccessMessage(
|
||||
currentOverlayContext!,
|
||||
message: AppLocalizations.of(currentContext!).toastMessageAddRecipientsSuccessfully,
|
||||
icon: _imagePaths.icSelected,
|
||||
);
|
||||
AppLocalizations.of(currentContext!).toastMessageAddRecipientsSuccessfully);
|
||||
}
|
||||
|
||||
currentForward.value = success.forward;
|
||||
@@ -283,13 +279,11 @@ class ForwardController extends BaseController {
|
||||
|
||||
void _handleEditLocalCopySuccess(EditLocalCopyInForwardingSuccess success) {
|
||||
if (currentOverlayContext != null && currentContext != null) {
|
||||
_appToast.showToastWithIcon(
|
||||
_appToast.showToastSuccessMessage(
|
||||
currentOverlayContext!,
|
||||
message: success.forward.localCopy ?
|
||||
AppLocalizations.of(currentContext!).toastMessageLocalCopyEnable :
|
||||
AppLocalizations.of(currentContext!).toastMessageLocalCopyDisable,
|
||||
icon: _imagePaths.icSelected,
|
||||
);
|
||||
success.forward.localCopy
|
||||
? AppLocalizations.of(currentContext!).toastMessageLocalCopyEnable
|
||||
: AppLocalizations.of(currentContext!).toastMessageLocalCopyDisable);
|
||||
}
|
||||
|
||||
currentForward.value = success.forward;
|
||||
|
||||
@@ -133,19 +133,9 @@ class ForwardView extends GetWidget<ForwardController> with AppLoaderMixin {
|
||||
controller.addRecipientAction(context, listRecipientsSelected);
|
||||
},
|
||||
onExceptionCallback: () {
|
||||
_appToast.showBottomToast(
|
||||
_appToast.showToastErrorMessage(
|
||||
context,
|
||||
AppLocalizations.of(context).incorrectEmailFormat,
|
||||
leadingIcon: SvgPicture.asset(
|
||||
_imagePaths.icNotConnection,
|
||||
width: 24,
|
||||
height: 24,
|
||||
colorFilter: Colors.white.asFilter(),
|
||||
fit: BoxFit.fill),
|
||||
backgroundColor: AppColor.toastErrorBackgroundColor,
|
||||
textColor: Colors.white,
|
||||
textActionColor: Colors.white,
|
||||
maxWidth: _responsiveUtils.getMaxWidthToast(context));
|
||||
AppLocalizations.of(context).incorrectEmailFormat);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
+16
-25
@@ -3,7 +3,6 @@ import 'package:core/presentation/resources/image_paths.dart';
|
||||
import 'package:core/presentation/state/failure.dart';
|
||||
import 'package:core/presentation/state/success.dart';
|
||||
import 'package:core/presentation/utils/app_toast.dart';
|
||||
import 'package:core/presentation/utils/responsive_utils.dart';
|
||||
import 'package:core/utils/app_logger.dart';
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@@ -41,7 +40,6 @@ class MailboxVisibilityController extends BaseMailboxController {
|
||||
final _accountDashBoardController = Get.find<ManageAccountDashBoardController>();
|
||||
final _appToast = Get.find<AppToast>();
|
||||
final _imagePaths = Get.find<ImagePaths>();
|
||||
final _responsiveUtils = Get.find<ResponsiveUtils>();
|
||||
final mailboxListScrollController = ScrollController();
|
||||
|
||||
MailboxVisibilityController(
|
||||
@@ -209,29 +207,22 @@ class MailboxVisibilityController extends BaseMailboxController {
|
||||
{List<MailboxId>? listDescendantMailboxIds}
|
||||
) {
|
||||
if (currentOverlayContext != null && currentContext != null) {
|
||||
_appToast.showBottomToast(
|
||||
currentOverlayContext!,
|
||||
AppLocalizations.of(currentContext!).toastMsgHideMailboxSuccess,
|
||||
actionName: AppLocalizations.of(currentContext!).undo,
|
||||
onActionClick: () => _subscribeMailboxAction(
|
||||
SubscribeMailboxRequest(
|
||||
mailboxIdSubscribed,
|
||||
MailboxSubscribeState.enabled,
|
||||
MailboxSubscribeAction.subscribe
|
||||
)
|
||||
),
|
||||
leadingIcon: SvgPicture.asset(
|
||||
_imagePaths.icFolderMailbox,
|
||||
width: 24,
|
||||
height: 24,
|
||||
colorFilter: Colors.white.asFilter(),
|
||||
fit: BoxFit.fill
|
||||
),
|
||||
backgroundColor: AppColor.toastSuccessBackgroundColor,
|
||||
textColor: Colors.white,
|
||||
textActionColor: Colors.white,
|
||||
actionIcon: SvgPicture.asset(_imagePaths.icUndo),
|
||||
maxWidth: _responsiveUtils.getMaxWidthToast(currentContext!)
|
||||
_appToast.showToastMessage(
|
||||
currentOverlayContext!,
|
||||
AppLocalizations.of(currentContext!).toastMsgHideMailboxSuccess,
|
||||
actionName: AppLocalizations.of(currentContext!).undo,
|
||||
onActionClick: () => _subscribeMailboxAction(
|
||||
SubscribeMailboxRequest(
|
||||
mailboxIdSubscribed,
|
||||
MailboxSubscribeState.enabled,
|
||||
MailboxSubscribeAction.subscribe
|
||||
)
|
||||
),
|
||||
leadingSVGIconColor: Colors.white,
|
||||
leadingSVGIcon: _imagePaths.icFolderMailbox,
|
||||
backgroundColor: AppColor.toastSuccessBackgroundColor,
|
||||
textColor: Colors.white,
|
||||
actionIcon: SvgPicture.asset(_imagePaths.icUndo),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,7 +41,6 @@ import 'package:tmail_ui_user/main/routes/route_utils.dart';
|
||||
class ManageAccountDashBoardController extends ReloadableController {
|
||||
|
||||
final _appToast = Get.find<AppToast>();
|
||||
final _imagePaths = Get.find<ImagePaths>();
|
||||
final _responsiveUtils = Get.find<ResponsiveUtils>();
|
||||
|
||||
GetAllVacationInteractor? _getAllVacationInteractor;
|
||||
@@ -268,10 +267,9 @@ class ManageAccountDashBoardController extends ReloadableController {
|
||||
void _handleUpdateVacationSuccess(UpdateVacationSuccess success) {
|
||||
if (success.listVacationResponse.isNotEmpty) {
|
||||
if (currentContext != null && currentOverlayContext != null) {
|
||||
_appToast.showToastWithIcon(
|
||||
currentOverlayContext!,
|
||||
message: AppLocalizations.of(currentContext!).yourVacationResponderIsDisabledSuccessfully,
|
||||
icon: _imagePaths.icChecked);
|
||||
_appToast.showToastSuccessMessage(
|
||||
currentOverlayContext!,
|
||||
AppLocalizations.of(currentContext!).yourVacationResponderIsDisabledSuccessfully);
|
||||
}
|
||||
vacationResponse.value = success.listVacationResponse.first;
|
||||
log('ManageAccountDashBoardController::_handleUpdateVacationSuccess(): $vacationResponse');
|
||||
|
||||
+12
-15
@@ -189,10 +189,9 @@ class IdentitiesController extends BaseController {
|
||||
|
||||
void _createNewIdentitySuccess(CreateNewIdentitySuccess success) {
|
||||
if (currentOverlayContext != null && currentContext != null) {
|
||||
_appToast.showToastWithIcon(
|
||||
currentOverlayContext!,
|
||||
message: AppLocalizations.of(currentContext!).you_have_created_a_new_identity,
|
||||
icon: _imagePaths.icSelected);
|
||||
_appToast.showToastSuccessMessage(
|
||||
currentOverlayContext!,
|
||||
AppLocalizations.of(currentContext!).you_have_created_a_new_identity);
|
||||
}
|
||||
|
||||
_refreshAllIdentities();
|
||||
@@ -200,10 +199,9 @@ class IdentitiesController extends BaseController {
|
||||
|
||||
void _createNewDefaultIdentitySuccess(CreateNewDefaultIdentitySuccess success) {
|
||||
if (currentOverlayContext != null && currentContext != null) {
|
||||
_appToast.showToastWithIcon(
|
||||
_appToast.showToastSuccessMessage(
|
||||
currentOverlayContext!,
|
||||
message: AppLocalizations.of(currentContext!).you_have_created_a_new_default_identity,
|
||||
icon: _imagePaths.icSelected);
|
||||
AppLocalizations.of(currentContext!).you_have_created_a_new_default_identity);
|
||||
}
|
||||
|
||||
_refreshAllIdentities();
|
||||
@@ -231,10 +229,10 @@ class IdentitiesController extends BaseController {
|
||||
|
||||
void _deleteIdentitySuccess(DeleteIdentitySuccess success) {
|
||||
if (currentOverlayContext != null && currentContext != null) {
|
||||
_appToast.showToastWithIcon(
|
||||
currentOverlayContext!,
|
||||
message: AppLocalizations.of(currentContext!).identity_has_been_deleted,
|
||||
icon: _imagePaths.icDeleteToast);
|
||||
_appToast.showToastSuccessMessage(
|
||||
currentOverlayContext!,
|
||||
AppLocalizations.of(currentContext!).identity_has_been_deleted,
|
||||
leadingSVGIcon: _imagePaths.icDeleteToast);
|
||||
}
|
||||
|
||||
_refreshAllIdentities();
|
||||
@@ -314,10 +312,9 @@ class IdentitiesController extends BaseController {
|
||||
|
||||
void _editIdentitySuccess(EditIdentitySuccess success) {
|
||||
if (currentOverlayContext != null && currentContext != null) {
|
||||
_appToast.showToastWithIcon(
|
||||
currentOverlayContext!,
|
||||
message: AppLocalizations.of(currentContext!).you_are_changed_your_identity_successfully,
|
||||
icon: _imagePaths.icSelected);
|
||||
_appToast.showToastSuccessMessage(
|
||||
currentOverlayContext!,
|
||||
AppLocalizations.of(currentContext!).you_are_changed_your_identity_successfully);
|
||||
}
|
||||
|
||||
_refreshAllIdentities();
|
||||
|
||||
@@ -29,7 +29,6 @@ class VacationController extends BaseController {
|
||||
|
||||
final _accountDashBoardController = Get.find<ManageAccountDashBoardController>();
|
||||
final _appToast = Get.find<AppToast>();
|
||||
final _imagePaths = Get.find<ImagePaths>();
|
||||
final _settingController = Get.find<SettingsController>();
|
||||
final _richTextControllerForWeb = Get.find<RichTextWebController>(tag: VacationUtils.vacationTagName);
|
||||
|
||||
@@ -249,33 +248,33 @@ class VacationController extends BaseController {
|
||||
if (vacationPresentation.value.isEnabled) {
|
||||
final fromDate = vacationPresentation.value.fromDate;
|
||||
if (fromDate == null) {
|
||||
_appToast.showToastWithIcon(
|
||||
context,
|
||||
bgColor: AppColor.toastErrorBackgroundColor,
|
||||
textColor: Colors.white,
|
||||
message: AppLocalizations.of(context).errorMessageWhenStartDateVacationIsEmpty);
|
||||
if (currentOverlayContext != null && currentContext != null) {
|
||||
_appToast.showToastErrorMessage(
|
||||
currentOverlayContext!,
|
||||
AppLocalizations.of(currentContext!).errorMessageWhenStartDateVacationIsEmpty);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
final vacationStopEnabled = vacationPresentation.value.vacationStopEnabled;
|
||||
final toDate = vacationPresentation.value.toDate;
|
||||
if (vacationStopEnabled && toDate != null && toDate.isBefore(fromDate)) {
|
||||
_appToast.showToastWithIcon(
|
||||
context,
|
||||
bgColor: AppColor.toastErrorBackgroundColor,
|
||||
textColor: Colors.white,
|
||||
message: AppLocalizations.of(context).errorMessageWhenEndDateVacationIsInValid);
|
||||
if (currentOverlayContext != null && currentContext != null) {
|
||||
_appToast.showToastErrorMessage(
|
||||
currentOverlayContext!,
|
||||
AppLocalizations.of(currentContext!).errorMessageWhenEndDateVacationIsInValid);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
final messagePlainText = messageTextController.text;
|
||||
final messageHtmlText = (BuildUtils.isWeb ? _vacationMessageHtmlText : await _getMessageHtmlText()) ?? '';
|
||||
if (messagePlainText.isEmpty && messageHtmlText.isEmpty && context.mounted) {
|
||||
_appToast.showToastWithIcon(
|
||||
context,
|
||||
bgColor: AppColor.toastErrorBackgroundColor,
|
||||
textColor: Colors.white,
|
||||
message: AppLocalizations.of(context).errorMessageWhenMessageVacationIsEmpty);
|
||||
if (currentOverlayContext != null && currentContext != null) {
|
||||
_appToast.showToastErrorMessage(
|
||||
currentOverlayContext!,
|
||||
AppLocalizations.of(currentContext!).errorMessageWhenMessageVacationIsEmpty);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -307,11 +306,10 @@ class VacationController extends BaseController {
|
||||
|
||||
void _handleUpdateVacationSuccess(UpdateVacationSuccess success) {
|
||||
if (success.listVacationResponse.isNotEmpty) {
|
||||
if (currentContext != null && currentOverlayContext != null) {
|
||||
_appToast.showToastWithIcon(
|
||||
currentOverlayContext!,
|
||||
message: AppLocalizations.of(currentContext!).vacationSettingSaved,
|
||||
icon: _imagePaths.icChecked);
|
||||
if (currentOverlayContext != null && currentContext != null) {
|
||||
_appToast.showToastSuccessMessage(
|
||||
currentOverlayContext!,
|
||||
AppLocalizations.of(currentContext!).vacationSettingSaved);
|
||||
}
|
||||
currentVacation = success.listVacationResponse.first;
|
||||
log('VacationController::_handleUpdateVacationSuccess(): $currentVacation');
|
||||
|
||||
+12
-20
@@ -3,7 +3,6 @@ import 'dart:async';
|
||||
import 'package:connectivity_plus/connectivity_plus.dart';
|
||||
import 'package:core/core.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:tmail_ui_user/features/base/base_controller.dart';
|
||||
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
||||
@@ -14,7 +13,6 @@ class NetworkConnectionController extends BaseController {
|
||||
final _imagePaths = Get.find<ImagePaths>();
|
||||
final Connectivity _connectivity;
|
||||
final AppToast _appToast = Get.find<AppToast>();
|
||||
final ResponsiveUtils _responsiveUtils = Get.find<ResponsiveUtils>();
|
||||
|
||||
bool _isEnableShowToastDisconnection = true;
|
||||
|
||||
@@ -84,24 +82,18 @@ class NetworkConnectionController extends BaseController {
|
||||
|
||||
void _showToastLostConnection() {
|
||||
if (currentContext != null && currentOverlayContext != null) {
|
||||
_appToast.showBottomToast(
|
||||
currentOverlayContext!,
|
||||
AppLocalizations.of(currentContext!).no_internet_connection,
|
||||
actionName: AppLocalizations.of(currentContext!).skip,
|
||||
onActionClick: () {
|
||||
_isEnableShowToastDisconnection = false;
|
||||
ToastView.dismiss();
|
||||
},
|
||||
leadingIcon: SvgPicture.asset(
|
||||
_imagePaths.icNotConnection,
|
||||
width: 24,
|
||||
height: 24,
|
||||
fit: BoxFit.fill),
|
||||
backgroundColor: AppColor.textFieldErrorBorderColor,
|
||||
textColor: Colors.white,
|
||||
textActionColor: Colors.white,
|
||||
maxWidth: _responsiveUtils.getMaxWidthToast(currentContext!),
|
||||
infinityToast: true,
|
||||
_appToast.showToastMessage(
|
||||
currentOverlayContext!,
|
||||
AppLocalizations.of(currentContext!).no_internet_connection,
|
||||
actionName: AppLocalizations.of(currentContext!).skip,
|
||||
onActionClick: () {
|
||||
_isEnableShowToastDisconnection = false;
|
||||
ToastView.dismiss();
|
||||
},
|
||||
leadingSVGIcon: _imagePaths.icNotConnection,
|
||||
backgroundColor: AppColor.textFieldErrorBorderColor,
|
||||
textColor: Colors.white,
|
||||
infinityToast: true,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
|
||||
import 'package:core/presentation/extensions/color_extension.dart';
|
||||
import 'package:core/presentation/state/failure.dart';
|
||||
import 'package:core/presentation/state/success.dart';
|
||||
import 'package:core/presentation/utils/app_toast.dart';
|
||||
@@ -281,20 +280,22 @@ class RulesFilterCreatorController extends BaseMailboxController {
|
||||
final errorAction = _getErrorStringByInputValue(context, mailboxSelected.value?.name?.name);
|
||||
if (errorAction?.isNotEmpty == true) {
|
||||
errorRuleActionValue.value = errorAction;
|
||||
_appToast.showToastWithIcon(
|
||||
if (currentOverlayContext != null && currentContext != null) {
|
||||
_appToast.showToastErrorMessage(
|
||||
currentOverlayContext!,
|
||||
textColor: AppColor.toastErrorBackgroundColor,
|
||||
message: AppLocalizations.of(currentContext!).this_field_cannot_be_blank);
|
||||
AppLocalizations.of(currentContext!).this_field_cannot_be_blank);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (ruleConditionFieldSelected.value == null ||
|
||||
ruleConditionComparatorSelected.value == null ||
|
||||
emailRuleFilterActionSelected.value == null) {
|
||||
_appToast.showToastWithIcon(
|
||||
if (currentOverlayContext != null && currentContext != null) {
|
||||
_appToast.showToastErrorMessage(
|
||||
currentOverlayContext!,
|
||||
textColor: AppColor.toastErrorBackgroundColor,
|
||||
message: AppLocalizations.of(currentContext!).toastErrorMessageWhenCreateNewRule);
|
||||
AppLocalizations.of(currentContext!).toastErrorMessageWhenCreateNewRule);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -332,7 +332,7 @@ class SearchMailboxController extends BaseMailboxController with MailboxActionHa
|
||||
|
||||
void _moveMailboxSuccess(MoveMailboxSuccess success) {
|
||||
if (success.moveAction == MoveAction.moving && currentOverlayContext != null && currentContext != null) {
|
||||
_appToast.showBottomToast(
|
||||
_appToast.showToastMessage(
|
||||
currentOverlayContext!,
|
||||
AppLocalizations.of(currentContext!).moved_to_mailbox(success.destinationMailboxName?.name ?? AppLocalizations.of(currentContext!).allMailboxes),
|
||||
actionName: AppLocalizations.of(currentContext!).undo,
|
||||
@@ -344,17 +344,11 @@ class SearchMailboxController extends BaseMailboxController with MailboxActionHa
|
||||
parentId: success.destinationMailboxId)
|
||||
);
|
||||
},
|
||||
leadingIcon: SvgPicture.asset(
|
||||
imagePaths.icFolderMailbox,
|
||||
width: 24,
|
||||
height: 24,
|
||||
colorFilter: Colors.white.asFilter(),
|
||||
fit: BoxFit.fill),
|
||||
leadingSVGIconColor: Colors.white,
|
||||
leadingSVGIcon: imagePaths.icFolderMailbox,
|
||||
backgroundColor: AppColor.toastSuccessBackgroundColor,
|
||||
textColor: Colors.white,
|
||||
textActionColor: Colors.white,
|
||||
actionIcon: SvgPicture.asset(imagePaths.icUndo),
|
||||
maxWidth: responsiveUtils.getMaxWidthToast(currentContext!)
|
||||
actionIcon: SvgPicture.asset(imagePaths.icUndo)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -396,11 +390,9 @@ class SearchMailboxController extends BaseMailboxController with MailboxActionHa
|
||||
|
||||
void _deleteMultipleMailboxSuccess(List<MailboxId> listMailboxIdDeleted, jmap.State? currentMailboxState) {
|
||||
if (currentOverlayContext != null && currentContext != null) {
|
||||
_appToast.showToastWithIcon(
|
||||
_appToast.showToastSuccessMessage(
|
||||
currentOverlayContext!,
|
||||
message: AppLocalizations.of(currentContext!).delete_mailboxes_successfully,
|
||||
icon: imagePaths.icSelected
|
||||
);
|
||||
AppLocalizations.of(currentContext!).delete_mailboxes_successfully);
|
||||
}
|
||||
|
||||
if (listMailboxIdDeleted.contains(dashboardController.selectedMailbox.value?.id)) {
|
||||
@@ -413,11 +405,9 @@ class SearchMailboxController extends BaseMailboxController with MailboxActionHa
|
||||
|
||||
void _deleteMailboxFailure(DeleteMultipleMailboxFailure failure) {
|
||||
if (currentOverlayContext != null && currentContext != null) {
|
||||
_appToast.showToastWithIcon(
|
||||
_appToast.showToastErrorMessage(
|
||||
currentOverlayContext!,
|
||||
message: AppLocalizations.of(currentContext!).delete_mailboxes_failure,
|
||||
icon: imagePaths.icDeleteToast
|
||||
);
|
||||
AppLocalizations.of(currentContext!).delete_mailboxes_failure);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -503,7 +493,7 @@ class SearchMailboxController extends BaseMailboxController with MailboxActionHa
|
||||
{List<MailboxId>? listDescendantMailboxIds}
|
||||
) {
|
||||
if (currentOverlayContext != null && currentContext != null) {
|
||||
_appToast.showBottomToast(
|
||||
_appToast.showToastMessage(
|
||||
currentOverlayContext!,
|
||||
subscribeAction.getToastMessageSuccess(currentContext!),
|
||||
actionName: AppLocalizations.of(currentContext!).undo,
|
||||
@@ -520,18 +510,11 @@ class SearchMailboxController extends BaseMailboxController with MailboxActionHa
|
||||
);
|
||||
}
|
||||
},
|
||||
leadingIcon: SvgPicture.asset(
|
||||
imagePaths.icFolderMailbox,
|
||||
width: 24,
|
||||
height: 24,
|
||||
colorFilter: Colors.white.asFilter(),
|
||||
fit: BoxFit.fill
|
||||
),
|
||||
leadingSVGIconColor: Colors.white,
|
||||
leadingSVGIcon: imagePaths.icFolderMailbox,
|
||||
backgroundColor: AppColor.toastSuccessBackgroundColor,
|
||||
textColor: Colors.white,
|
||||
textActionColor: Colors.white,
|
||||
actionIcon: SvgPicture.asset(imagePaths.icUndo),
|
||||
maxWidth: responsiveUtils.getMaxWidthToast(currentContext!)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,17 +71,23 @@ class SessionController extends ReloadableController {
|
||||
log('SessionController::_handleSessionFailure(): $failure');
|
||||
if (failure is GetSessionFailure) {
|
||||
final sessionException = failure.exception;
|
||||
var errorMessage = '';
|
||||
if (_checkUrlError(sessionException) && currentContext != null) {
|
||||
_appToast.showErrorToast(AppLocalizations.of(currentContext!).wrongUrlMessage);
|
||||
errorMessage = AppLocalizations.of(currentContext!).wrongUrlMessage;
|
||||
} else if (sessionException is BadCredentialsException && currentContext != null) {
|
||||
_appToast.showErrorToast(AppLocalizations.of(currentContext!).badCredentials);
|
||||
errorMessage = AppLocalizations.of(currentContext!).badCredentials;
|
||||
} else if (sessionException is UnknownError && currentContext != null) {
|
||||
if (sessionException.message != null) {
|
||||
_appToast.showErrorToast('[${sessionException.code}] ${sessionException.message}');
|
||||
errorMessage = '[${sessionException.code}] ${sessionException.message}';
|
||||
} else {
|
||||
_appToast.showErrorToast(AppLocalizations.of(currentContext!).unknownError);
|
||||
errorMessage = AppLocalizations.of(currentContext!).unknownError;
|
||||
}
|
||||
}
|
||||
|
||||
logError('SessionController::_handleSessionFailure():errorMessage: $errorMessage');
|
||||
if (errorMessage.isNotEmpty && currentOverlayContext != null && currentContext != null) {
|
||||
_appToast.showToastErrorMessage(currentOverlayContext!, errorMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -642,10 +642,11 @@ class ThreadController extends BaseController with EmailActionController {
|
||||
|
||||
mailboxDashBoardController.filterMessageOption.value = newFilterOption;
|
||||
|
||||
_appToast.showToastWithIcon(
|
||||
currentOverlayContext!,
|
||||
message: newFilterOption.getMessageToast(context),
|
||||
icon: newFilterOption.getIconToast(_imagePaths));
|
||||
_appToast.showToastMessage(
|
||||
context,
|
||||
newFilterOption.getMessageToast(context),
|
||||
leadingSVGIcon: newFilterOption.getIconToast(_imagePaths),
|
||||
);
|
||||
|
||||
if (searchController.isSearchEmailRunning) {
|
||||
_searchEmail();
|
||||
|
||||
@@ -126,20 +126,18 @@ class ThreadView extends GetWidget<ThreadController>
|
||||
if ((!BuildUtils.isWeb || (BuildUtils.isWeb && controller.isSelectionEnabled()
|
||||
&& controller.isSearchActive() && !_responsiveUtils.isDesktop(context)))
|
||||
&& controller.mailboxDashBoardController.emailsInCurrentMailbox.listEmailSelected.isNotEmpty) {
|
||||
return Column(children: [
|
||||
const Divider(color: AppColor.lineItemListColor, height: 1, thickness: 0.2),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(10),
|
||||
child: (BottomBarThreadSelectionWidget(
|
||||
context,
|
||||
_imagePaths,
|
||||
_responsiveUtils,
|
||||
controller.mailboxDashBoardController.emailsInCurrentMailbox.listEmailSelected,
|
||||
controller.mailboxDashBoardController.selectedMailbox.value)
|
||||
..addOnPressEmailSelectionActionClick((actionType, selectionEmail) =>
|
||||
controller.pressEmailSelectionAction(context, actionType, selectionEmail)))
|
||||
.build()),
|
||||
]);
|
||||
return BottomBarThreadSelectionWidget(
|
||||
_imagePaths,
|
||||
_responsiveUtils,
|
||||
controller.mailboxDashBoardController.emailsInCurrentMailbox.listEmailSelected,
|
||||
controller.mailboxDashBoardController.selectedMailbox.value,
|
||||
onPressEmailSelectionActionClick: (actionType, selectionEmail) =>
|
||||
controller.pressEmailSelectionAction(
|
||||
context,
|
||||
actionType,
|
||||
selectionEmail
|
||||
)
|
||||
);
|
||||
} else {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
|
||||
@@ -1,114 +1,120 @@
|
||||
import 'package:core/core.dart';
|
||||
import 'package:core/presentation/extensions/color_extension.dart';
|
||||
import 'package:core/presentation/resources/image_paths.dart';
|
||||
import 'package:core/presentation/utils/responsive_utils.dart';
|
||||
import 'package:core/presentation/views/button/button_builder.dart';
|
||||
import 'package:core/utils/build_utils.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:model/model.dart';
|
||||
import 'package:model/email/email_action_type.dart';
|
||||
import 'package:model/email/presentation_email.dart';
|
||||
import 'package:model/extensions/list_presentation_email_extension.dart';
|
||||
import 'package:model/mailbox/presentation_mailbox.dart';
|
||||
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
||||
|
||||
typedef OnPressEmailSelectionActionClick = void Function(EmailActionType, List<PresentationEmail>);
|
||||
|
||||
class BottomBarThreadSelectionWidget {
|
||||
class BottomBarThreadSelectionWidget extends StatelessWidget{
|
||||
|
||||
final BuildContext _context;
|
||||
final ImagePaths _imagePaths;
|
||||
final ResponsiveUtils _responsiveUtils;
|
||||
final List<PresentationEmail> _listSelectionEmail;
|
||||
final PresentationMailbox? _currentMailbox;
|
||||
final OnPressEmailSelectionActionClick? onPressEmailSelectionActionClick;
|
||||
|
||||
OnPressEmailSelectionActionClick? _onPressEmailSelectionActionClick;
|
||||
|
||||
BottomBarThreadSelectionWidget(
|
||||
this._context,
|
||||
const BottomBarThreadSelectionWidget(
|
||||
this._imagePaths,
|
||||
this._responsiveUtils,
|
||||
this._listSelectionEmail,
|
||||
this._currentMailbox,
|
||||
{
|
||||
super.key,
|
||||
this.onPressEmailSelectionActionClick,
|
||||
}
|
||||
);
|
||||
|
||||
void addOnPressEmailSelectionActionClick(OnPressEmailSelectionActionClick onPressEmailSelectionActionClick) {
|
||||
_onPressEmailSelectionActionClick = onPressEmailSelectionActionClick;
|
||||
}
|
||||
|
||||
Widget build() {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
key: const Key('bottom_bar_thread_selection_widget'),
|
||||
alignment: Alignment.center,
|
||||
color: Colors.white,
|
||||
child: MediaQuery(
|
||||
data: const MediaQueryData(padding: EdgeInsets.zero),
|
||||
child: _buildListOptionButton()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildListOptionButton() {
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
if(_currentMailbox?.isDrafts == false)
|
||||
Expanded(child: (ButtonBuilder(_listSelectionEmail.isAllEmailRead ? _imagePaths.icUnread : _imagePaths.icRead)
|
||||
decoration: const BoxDecoration(
|
||||
border: Border(top: BorderSide(
|
||||
color: AppColor.lineItemListColor,
|
||||
width: 0.2,
|
||||
)),
|
||||
color: Colors.white
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
if(_currentMailbox?.isDrafts == false)
|
||||
Expanded(child: (ButtonBuilder(_listSelectionEmail.isAllEmailRead ? _imagePaths.icUnread : _imagePaths.icRead)
|
||||
..key(const Key('button_mark_read_email'))
|
||||
..paddingIcon(const EdgeInsets.symmetric(horizontal: 8, vertical: 4))
|
||||
..padding(const EdgeInsets.all(8))
|
||||
..radiusSplash(8)
|
||||
..textStyle(const TextStyle(fontSize: 12, color: AppColor.colorTextButton))
|
||||
..onPressActionClick(() {
|
||||
if (_onPressEmailSelectionActionClick != null) {
|
||||
_onPressEmailSelectionActionClick!(
|
||||
_listSelectionEmail.isAllEmailRead ? EmailActionType.markAsUnread : EmailActionType.markAsRead,
|
||||
_listSelectionEmail);
|
||||
}})
|
||||
..text(_textButtonMarkAsRead, isVertical: _responsiveUtils.isMobile(_context)))
|
||||
onPressEmailSelectionActionClick?.call(
|
||||
_listSelectionEmail.isAllEmailRead ? EmailActionType.markAsUnread : EmailActionType.markAsRead,
|
||||
_listSelectionEmail
|
||||
);
|
||||
})
|
||||
..text(_getTextButtonMarkAsRead(context), isVertical: _responsiveUtils.isMobile(context)))
|
||||
.build()),
|
||||
Expanded(child: (ButtonBuilder(_listSelectionEmail.isAllEmailStarred ? _imagePaths.icUnStar : _imagePaths.icStar)
|
||||
Expanded(child: (ButtonBuilder(_listSelectionEmail.isAllEmailStarred ? _imagePaths.icUnStar : _imagePaths.icStar)
|
||||
..key(const Key('button_mark_as_star_email'))
|
||||
..paddingIcon(const EdgeInsets.symmetric(horizontal: 8, vertical: 4))
|
||||
..padding(const EdgeInsets.all(8))
|
||||
..radiusSplash(8)
|
||||
..textStyle(const TextStyle(fontSize: 12, color: AppColor.colorTextButton))
|
||||
..onPressActionClick(() {
|
||||
if (_onPressEmailSelectionActionClick != null) {
|
||||
_onPressEmailSelectionActionClick!(
|
||||
_listSelectionEmail.isAllEmailStarred ? EmailActionType.unMarkAsStarred : EmailActionType.markAsStarred,
|
||||
_listSelectionEmail);
|
||||
}})
|
||||
..text(_textButtonMarkAsStar, isVertical: _responsiveUtils.isMobile(_context)))
|
||||
onPressEmailSelectionActionClick?.call(
|
||||
_listSelectionEmail.isAllEmailStarred ? EmailActionType.unMarkAsStarred : EmailActionType.markAsStarred,
|
||||
_listSelectionEmail
|
||||
);
|
||||
})
|
||||
..text(_getTextButtonMarkAsStar(context), isVertical: _responsiveUtils.isMobile(context)))
|
||||
.build()),
|
||||
if (_currentMailbox?.isDrafts == false)
|
||||
Expanded(child: (ButtonBuilder(_imagePaths.icMove)
|
||||
if (_currentMailbox?.isDrafts == false)
|
||||
Expanded(child: (ButtonBuilder(_imagePaths.icMove)
|
||||
..key(const Key('button_move_to_mailbox'))
|
||||
..paddingIcon(const EdgeInsets.symmetric(horizontal: 8, vertical: 4))
|
||||
..padding(const EdgeInsets.all(8))
|
||||
..radiusSplash(8)
|
||||
..textStyle(const TextStyle(fontSize: 12, color: AppColor.colorTextButton))
|
||||
..onPressActionClick(() {
|
||||
if (_onPressEmailSelectionActionClick != null) {
|
||||
_onPressEmailSelectionActionClick!(EmailActionType.moveToMailbox, _listSelectionEmail);
|
||||
}})
|
||||
..text(_textButtonMove, isVertical: _responsiveUtils.isMobile(_context)))
|
||||
onPressEmailSelectionActionClick?.call(EmailActionType.moveToMailbox, _listSelectionEmail);
|
||||
})
|
||||
..text(_getTextButtonMove(context), isVertical: _responsiveUtils.isMobile(context)))
|
||||
.build()),
|
||||
if (_currentMailbox?.isDrafts == false)
|
||||
Expanded(child: (ButtonBuilder(_currentMailbox?.isSpam == true ? _imagePaths.icNotSpam : _imagePaths.icSpam)
|
||||
if (_currentMailbox?.isDrafts == false)
|
||||
Expanded(child: (ButtonBuilder(_currentMailbox?.isSpam == true ? _imagePaths.icNotSpam : _imagePaths.icSpam)
|
||||
..key(const Key('button_move_to_spam'))
|
||||
..paddingIcon(const EdgeInsets.symmetric(horizontal: 8, vertical: 4))
|
||||
..padding(const EdgeInsets.all(8))
|
||||
..radiusSplash(8)
|
||||
..textStyle(const TextStyle(fontSize: 12, color: AppColor.colorTextButton))
|
||||
..onPressActionClick(() {
|
||||
if (_currentMailbox?.isSpam == true) {
|
||||
_onPressEmailSelectionActionClick?.call(EmailActionType.unSpam, _listSelectionEmail);
|
||||
onPressEmailSelectionActionClick?.call(EmailActionType.unSpam, _listSelectionEmail);
|
||||
} else {
|
||||
_onPressEmailSelectionActionClick?.call(EmailActionType.moveToSpam, _listSelectionEmail);
|
||||
onPressEmailSelectionActionClick?.call(EmailActionType.moveToSpam, _listSelectionEmail);
|
||||
}
|
||||
})
|
||||
..text(_textButtonSpam, isVertical: _responsiveUtils.isMobile(_context)))
|
||||
..text(_getTextButtonSpam(context), isVertical: _responsiveUtils.isMobile(context)))
|
||||
.build()),
|
||||
Expanded(child: (ButtonBuilder(canDeletePermanently ? _imagePaths.icDeleteComposer : _imagePaths.icDelete)
|
||||
Expanded(child: (ButtonBuilder(canDeletePermanently ? _imagePaths.icDeleteComposer : _imagePaths.icDelete)
|
||||
..key(const Key('button_delete_email'))
|
||||
..iconColor(canDeletePermanently ? AppColor.colorDeletePermanentlyButton : AppColor.primaryColor)
|
||||
..paddingIcon(const EdgeInsets.symmetric(horizontal: 8, vertical: 4))
|
||||
..padding(const EdgeInsets.all(8))
|
||||
..radiusSplash(8)
|
||||
..textStyle(const TextStyle(fontSize: 12, color: AppColor.colorTextButton))
|
||||
..onPressActionClick(() {
|
||||
if (canDeletePermanently) {
|
||||
_onPressEmailSelectionActionClick?.call(EmailActionType.deletePermanently, _listSelectionEmail);
|
||||
onPressEmailSelectionActionClick?.call(EmailActionType.deletePermanently, _listSelectionEmail);
|
||||
} else {
|
||||
_onPressEmailSelectionActionClick?.call(EmailActionType.moveToTrash, _listSelectionEmail);
|
||||
onPressEmailSelectionActionClick?.call(EmailActionType.moveToTrash, _listSelectionEmail);
|
||||
}
|
||||
})
|
||||
..text(_textButtonDelete, isVertical: _responsiveUtils.isMobile(_context)))
|
||||
..text(_getTextButtonDelete(context), isVertical: _responsiveUtils.isMobile(context)))
|
||||
.build())
|
||||
]
|
||||
]
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -116,43 +122,43 @@ class BottomBarThreadSelectionWidget {
|
||||
return _currentMailbox?.isTrash == true || _currentMailbox?.isDrafts == true;
|
||||
}
|
||||
|
||||
String? get _textButtonMarkAsRead {
|
||||
if (!_isMailboxDashboardSplitView(_context)) {
|
||||
String? _getTextButtonMarkAsRead(BuildContext context) {
|
||||
if (!_isMailboxDashboardSplitView(context)) {
|
||||
return _listSelectionEmail.isAllEmailRead
|
||||
? AppLocalizations.of(_context).unread
|
||||
: AppLocalizations.of(_context).read;
|
||||
? AppLocalizations.of(context).unread
|
||||
: AppLocalizations.of(context).read;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
String? get _textButtonMarkAsStar {
|
||||
if (!_isMailboxDashboardSplitView(_context)) {
|
||||
String? _getTextButtonMarkAsStar(BuildContext context) {
|
||||
if (!_isMailboxDashboardSplitView(context)) {
|
||||
return _listSelectionEmail.isAllEmailStarred
|
||||
? AppLocalizations.of(_context).un_star
|
||||
: AppLocalizations.of(_context).star;
|
||||
? AppLocalizations.of(context).un_star
|
||||
: AppLocalizations.of(context).star;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
String? get _textButtonMove {
|
||||
if (!_isMailboxDashboardSplitView(_context)) {
|
||||
return AppLocalizations.of(_context).move;
|
||||
String? _getTextButtonMove(BuildContext context) {
|
||||
if (!_isMailboxDashboardSplitView(context)) {
|
||||
return AppLocalizations.of(context).move;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
String? get _textButtonSpam {
|
||||
if (!_isMailboxDashboardSplitView(_context)) {
|
||||
String? _getTextButtonSpam(BuildContext context) {
|
||||
if (!_isMailboxDashboardSplitView(context)) {
|
||||
return _currentMailbox?.isSpam == true
|
||||
? AppLocalizations.of(_context).un_spam
|
||||
: AppLocalizations.of(_context).spam;
|
||||
? AppLocalizations.of(context).un_spam
|
||||
: AppLocalizations.of(context).spam;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
String? get _textButtonDelete {
|
||||
if (!_isMailboxDashboardSplitView(_context)) {
|
||||
return AppLocalizations.of(_context).delete;
|
||||
String? _getTextButtonDelete(BuildContext context) {
|
||||
if (!_isMailboxDashboardSplitView(context)) {
|
||||
return AppLocalizations.of(context).delete;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -162,8 +168,8 @@ class BottomBarThreadSelectionWidget {
|
||||
return _responsiveUtils.isTabletLarge(context);
|
||||
} else {
|
||||
return _responsiveUtils.isLandscapeTablet(context) ||
|
||||
_responsiveUtils.isTabletLarge(context) ||
|
||||
_responsiveUtils.isDesktop(context);
|
||||
_responsiveUtils.isTabletLarge(context) ||
|
||||
_responsiveUtils.isDesktop(context);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
|
||||
import 'package:async/async.dart';
|
||||
import 'package:collection/collection.dart';
|
||||
import 'package:core/presentation/extensions/color_extension.dart';
|
||||
import 'package:core/presentation/resources/image_paths.dart';
|
||||
import 'package:core/presentation/state/failure.dart';
|
||||
import 'package:core/presentation/state/success.dart';
|
||||
@@ -9,6 +8,7 @@ import 'package:core/presentation/utils/app_toast.dart';
|
||||
import 'package:core/utils/app_logger.dart';
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:jmap_dart_client/jmap/mail/email/email_body_part.dart';
|
||||
import 'package:model/email/attachment.dart';
|
||||
@@ -128,13 +128,13 @@ class UploadController extends BaseController {
|
||||
if (failure is ErrorAttachmentUploadState) {
|
||||
uploadInlineViewState.value = Left(failure);
|
||||
_deleteInlineFileUploaded(failure.uploadId);
|
||||
|
||||
if (currentContext != null && currentOverlayContext != null) {
|
||||
_appToast.showToastWithIcon(currentOverlayContext!,
|
||||
message: AppLocalizations.of(currentContext!).thisImageCannotBeAdded,
|
||||
textColor: AppColor.toastErrorBackgroundColor,
|
||||
iconColor: AppColor.toastErrorBackgroundColor,
|
||||
icon: _imagePaths.icInsertImage
|
||||
);
|
||||
_appToast.showToastErrorMessage(
|
||||
currentOverlayContext!,
|
||||
AppLocalizations.of(currentContext!).thisImageCannotBeAdded,
|
||||
leadingSVGIconColor: Colors.white,
|
||||
leadingSVGIcon: _imagePaths.icInsertImage);
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -241,21 +241,22 @@ class UploadController extends BaseController {
|
||||
|
||||
void _handleUploadAttachmentsFailure(ErrorAttachmentUploadState failure) {
|
||||
if (currentContext != null && currentOverlayContext != null) {
|
||||
_appToast.showToastWithIcon(currentOverlayContext!,
|
||||
message: AppLocalizations.of(currentContext!).can_not_upload_this_file_as_attachments,
|
||||
textColor: AppColor.toastErrorBackgroundColor,
|
||||
iconColor: AppColor.toastErrorBackgroundColor,
|
||||
icon: _imagePaths.icAttachment);
|
||||
_appToast.showToastErrorMessage(
|
||||
currentOverlayContext!,
|
||||
AppLocalizations.of(currentContext!).can_not_upload_this_file_as_attachments,
|
||||
leadingSVGIconColor: Colors.white,
|
||||
leadingSVGIcon: _imagePaths.icAttachment);
|
||||
}
|
||||
}
|
||||
|
||||
void _handleUploadAttachmentsSuccess(SuccessAttachmentUploadState success) {
|
||||
log('UploadController::_handleUploadAttachmentsSuccess(): $success');
|
||||
if (currentContext != null && currentOverlayContext != null && _uploadingStateFiles.allSuccess) {
|
||||
_appToast.showToastWithIcon(currentOverlayContext!,
|
||||
message: AppLocalizations.of(currentContext!).attachments_uploaded_successfully,
|
||||
iconColor: AppColor.primaryColor,
|
||||
icon: _imagePaths.icAttachment);
|
||||
_appToast.showToastSuccessMessage(
|
||||
currentOverlayContext!,
|
||||
AppLocalizations.of(currentContext!).attachments_uploaded_successfully,
|
||||
leadingSVGIconColor: Colors.white,
|
||||
leadingSVGIcon: _imagePaths.icAttachment);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -348,21 +349,19 @@ class UploadController extends BaseController {
|
||||
if (failure is UploadAttachmentFailure) {
|
||||
if (failure.isInline) {
|
||||
if (currentContext != null && currentOverlayContext != null) {
|
||||
_appToast.showToastWithIcon(currentOverlayContext!,
|
||||
message: AppLocalizations.of(currentContext!).thisImageCannotBeAdded,
|
||||
textColor: AppColor.toastErrorBackgroundColor,
|
||||
iconColor: AppColor.toastErrorBackgroundColor,
|
||||
icon: _imagePaths.icInsertImage
|
||||
);
|
||||
_appToast.showToastErrorMessage(
|
||||
currentOverlayContext!,
|
||||
AppLocalizations.of(currentContext!).thisImageCannotBeAdded,
|
||||
leadingSVGIconColor: Colors.white,
|
||||
leadingSVGIcon: _imagePaths.icInsertImage);
|
||||
}
|
||||
} else {
|
||||
if (currentContext != null && currentOverlayContext != null) {
|
||||
_appToast.showToastWithIcon(currentOverlayContext!,
|
||||
message: AppLocalizations.of(currentContext!).can_not_upload_this_file_as_attachments,
|
||||
textColor: AppColor.toastErrorBackgroundColor,
|
||||
iconColor: AppColor.toastErrorBackgroundColor,
|
||||
icon: _imagePaths.icAttachment
|
||||
);
|
||||
_appToast.showToastErrorMessage(
|
||||
currentOverlayContext!,
|
||||
AppLocalizations.of(currentContext!).can_not_upload_this_file_as_attachments,
|
||||
leadingSVGIconColor: Colors.white,
|
||||
leadingSVGIcon: _imagePaths.icAttachment);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user