TF-4195 Implement add a Label to an email on mobile
This commit is contained in:
@@ -391,7 +391,7 @@ abstract class BaseMailboxController extends BaseController
|
|||||||
);
|
);
|
||||||
|
|
||||||
final destinationMailbox = PlatformInfo.isWeb
|
final destinationMailbox = PlatformInfo.isWeb
|
||||||
? await DialogRouter.pushGeneralDialog(routeName: AppRoutes.destinationPicker, arguments: arguments)
|
? await DialogRouter().pushGeneralDialog(routeName: AppRoutes.destinationPicker, arguments: arguments)
|
||||||
: await push(AppRoutes.destinationPicker, arguments: arguments);
|
: await push(AppRoutes.destinationPicker, arguments: arguments);
|
||||||
|
|
||||||
if (destinationMailbox is PresentationMailbox) {
|
if (destinationMailbox is PresentationMailbox) {
|
||||||
@@ -660,7 +660,7 @@ abstract class BaseMailboxController extends BaseController
|
|||||||
);
|
);
|
||||||
|
|
||||||
final destinationMailbox = PlatformInfo.isWeb
|
final destinationMailbox = PlatformInfo.isWeb
|
||||||
? await DialogRouter.pushGeneralDialog(
|
? await DialogRouter().pushGeneralDialog(
|
||||||
routeName: AppRoutes.destinationPicker,
|
routeName: AppRoutes.destinationPicker,
|
||||||
arguments: arguments,
|
arguments: arguments,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -59,8 +59,8 @@ class ComposerView extends GetWidget<ComposerController> {
|
|||||||
MessageDialogActionManager().isDialogOpened ||
|
MessageDialogActionManager().isDialogOpened ||
|
||||||
EmailActionReactor.isDialogOpened ||
|
EmailActionReactor.isDialogOpened ||
|
||||||
ColorDialogPicker().isOpened.isTrue ||
|
ColorDialogPicker().isOpened.isTrue ||
|
||||||
DialogRouter.isRuleFilterDialogOpened.isTrue ||
|
DialogRouter().isRuleFilterDialogOpened.isTrue ||
|
||||||
DialogRouter.isDialogOpened;
|
DialogRouter().isDialogOpened;
|
||||||
|
|
||||||
if (isOverlayEnabled) {
|
if (isOverlayEnabled) {
|
||||||
return Positioned.fill(
|
return Positioned.fill(
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:jmap_dart_client/jmap/mail/email/email.dart';
|
import 'package:jmap_dart_client/jmap/mail/email/email.dart';
|
||||||
|
import 'package:tmail_ui_user/features/email/domain/usecases/add_a_label_to_an_email_interactor.dart';
|
||||||
import 'package:tmail_ui_user/features/email/domain/usecases/get_email_content_interactor.dart';
|
import 'package:tmail_ui_user/features/email/domain/usecases/get_email_content_interactor.dart';
|
||||||
import 'package:tmail_ui_user/features/email/domain/usecases/mark_as_email_read_interactor.dart';
|
import 'package:tmail_ui_user/features/email/domain/usecases/mark_as_email_read_interactor.dart';
|
||||||
import 'package:tmail_ui_user/features/email/domain/usecases/mark_as_star_email_interactor.dart';
|
import 'package:tmail_ui_user/features/email/domain/usecases/mark_as_star_email_interactor.dart';
|
||||||
@@ -23,6 +24,7 @@ class EmailBindings extends Bindings {
|
|||||||
Get.find<MarkAsStarEmailInteractor>(),
|
Get.find<MarkAsStarEmailInteractor>(),
|
||||||
Get.find<GetAllIdentitiesInteractor>(),
|
Get.find<GetAllIdentitiesInteractor>(),
|
||||||
Get.find<StoreOpenedEmailInteractor>(),
|
Get.find<StoreOpenedEmailInteractor>(),
|
||||||
|
Get.find<AddALabelToAnEmailInteractor>(),
|
||||||
Get.find<PrintEmailInteractor>(),
|
Get.find<PrintEmailInteractor>(),
|
||||||
currentEmailId: currentEmailId,
|
currentEmailId: currentEmailId,
|
||||||
), tag: tag);
|
), tag: tag);
|
||||||
|
|||||||
@@ -118,6 +118,7 @@ class SingleEmailController extends BaseController with AppLoaderMixin {
|
|||||||
final GetAllIdentitiesInteractor _getAllIdentitiesInteractor;
|
final GetAllIdentitiesInteractor _getAllIdentitiesInteractor;
|
||||||
final StoreOpenedEmailInteractor _storeOpenedEmailInteractor;
|
final StoreOpenedEmailInteractor _storeOpenedEmailInteractor;
|
||||||
final PrintEmailInteractor _printEmailInteractor;
|
final PrintEmailInteractor _printEmailInteractor;
|
||||||
|
final AddALabelToAnEmailInteractor addALabelToAnEmailInteractor;
|
||||||
final EmailId? _currentEmailId;
|
final EmailId? _currentEmailId;
|
||||||
|
|
||||||
CreateNewEmailRuleFilterInteractor? _createNewEmailRuleFilterInteractor;
|
CreateNewEmailRuleFilterInteractor? _createNewEmailRuleFilterInteractor;
|
||||||
@@ -128,7 +129,6 @@ class SingleEmailController extends BaseController with AppLoaderMixin {
|
|||||||
RejectCalendarEventInteractor? _rejectCalendarEventInteractor;
|
RejectCalendarEventInteractor? _rejectCalendarEventInteractor;
|
||||||
AcceptCounterCalendarEventInteractor? _acceptCounterCalendarEventInteractor;
|
AcceptCounterCalendarEventInteractor? _acceptCounterCalendarEventInteractor;
|
||||||
ThreadDetailController? _threadDetailController;
|
ThreadDetailController? _threadDetailController;
|
||||||
AddALabelToAnEmailInteractor? addALabelToAnEmailInteractor;
|
|
||||||
|
|
||||||
final emailContents = RxnString();
|
final emailContents = RxnString();
|
||||||
final attachments = <Attachment>[].obs;
|
final attachments = <Attachment>[].obs;
|
||||||
@@ -188,6 +188,7 @@ class SingleEmailController extends BaseController with AppLoaderMixin {
|
|||||||
this._markAsStarEmailInteractor,
|
this._markAsStarEmailInteractor,
|
||||||
this._getAllIdentitiesInteractor,
|
this._getAllIdentitiesInteractor,
|
||||||
this._storeOpenedEmailInteractor,
|
this._storeOpenedEmailInteractor,
|
||||||
|
this.addALabelToAnEmailInteractor,
|
||||||
this._printEmailInteractor, {
|
this._printEmailInteractor, {
|
||||||
EmailId? currentEmailId,
|
EmailId? currentEmailId,
|
||||||
}) : _currentEmailId = currentEmailId;
|
}) : _currentEmailId = currentEmailId;
|
||||||
@@ -220,6 +221,7 @@ class SingleEmailController extends BaseController with AppLoaderMixin {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void handleSuccessViewState(Success success) {
|
void handleSuccessViewState(Success success) {
|
||||||
|
log('SingleEmailController::handleSuccessViewState(): $success');
|
||||||
if (success is GetEmailContentSuccess) {
|
if (success is GetEmailContentSuccess) {
|
||||||
_getEmailContentSuccess(success);
|
_getEmailContentSuccess(success);
|
||||||
} else if (success is GetEmailContentFromCacheSuccess) {
|
} else if (success is GetEmailContentFromCacheSuccess) {
|
||||||
@@ -253,6 +255,7 @@ class SingleEmailController extends BaseController with AppLoaderMixin {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void handleFailureViewState(Failure failure) {
|
void handleFailureViewState(Failure failure) {
|
||||||
|
logError('SingleEmailController::handleFailureViewState(): $failure');
|
||||||
if (failure is MarkAsEmailReadFailure) {
|
if (failure is MarkAsEmailReadFailure) {
|
||||||
_handleMarkAsEmailReadFailure(failure);
|
_handleMarkAsEmailReadFailure(failure);
|
||||||
} else if (failure is ParseCalendarEventFailure) {
|
} else if (failure is ParseCalendarEventFailure) {
|
||||||
@@ -895,6 +898,9 @@ class SingleEmailController extends BaseController with AppLoaderMixin {
|
|||||||
case EmailActionType.compose:
|
case EmailActionType.compose:
|
||||||
pressEmailAction(actionType, presentationEmail);
|
pressEmailAction(actionType, presentationEmail);
|
||||||
break;
|
break;
|
||||||
|
case EmailActionType.labelAs:
|
||||||
|
openAddLabelToEmailDialogModal(presentationEmail);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -600,8 +600,8 @@ class EmailView extends GetWidget<SingleEmailController> {
|
|||||||
MessageDialogActionManager().isDialogOpened ||
|
MessageDialogActionManager().isDialogOpened ||
|
||||||
EmailActionReactor.isDialogOpened ||
|
EmailActionReactor.isDialogOpened ||
|
||||||
ColorDialogPicker().isOpened.isTrue ||
|
ColorDialogPicker().isOpened.isTrue ||
|
||||||
DialogRouter.isRuleFilterDialogOpened.isTrue ||
|
DialogRouter().isRuleFilterDialogOpened.isTrue ||
|
||||||
DialogRouter.isDialogOpened;
|
DialogRouter().isDialogOpened;
|
||||||
|
|
||||||
if (isOverlayEnabled) {
|
if (isOverlayEnabled) {
|
||||||
return Positioned.fill(
|
return Positioned.fill(
|
||||||
|
|||||||
@@ -6,17 +6,19 @@ import 'package:jmap_dart_client/jmap/mail/email/email.dart';
|
|||||||
import 'package:jmap_dart_client/jmap/mail/email/keyword_identifier.dart';
|
import 'package:jmap_dart_client/jmap/mail/email/keyword_identifier.dart';
|
||||||
import 'package:labels/extensions/label_extension.dart';
|
import 'package:labels/extensions/label_extension.dart';
|
||||||
import 'package:labels/model/label.dart';
|
import 'package:labels/model/label.dart';
|
||||||
|
import 'package:model/email/presentation_email.dart';
|
||||||
import 'package:tmail_ui_user/features/email/domain/state/add_a_label_to_an_email_state.dart';
|
import 'package:tmail_ui_user/features/email/domain/state/add_a_label_to_an_email_state.dart';
|
||||||
import 'package:tmail_ui_user/features/email/domain/usecases/add_a_label_to_an_email_interactor.dart';
|
|
||||||
import 'package:tmail_ui_user/features/email/presentation/controller/single_email_controller.dart';
|
import 'package:tmail_ui_user/features/email/presentation/controller/single_email_controller.dart';
|
||||||
import 'package:tmail_ui_user/features/email/presentation/extensions/email_loaded_extension.dart';
|
import 'package:tmail_ui_user/features/email/presentation/extensions/email_loaded_extension.dart';
|
||||||
import 'package:tmail_ui_user/features/email/presentation/extensions/presentation_email_extension.dart';
|
import 'package:tmail_ui_user/features/email/presentation/extensions/presentation_email_extension.dart';
|
||||||
import 'package:tmail_ui_user/features/home/data/exceptions/session_exceptions.dart';
|
import 'package:tmail_ui_user/features/home/data/exceptions/session_exceptions.dart';
|
||||||
import 'package:tmail_ui_user/features/labels/domain/exceptions/label_exceptions.dart';
|
import 'package:tmail_ui_user/features/labels/domain/exceptions/label_exceptions.dart';
|
||||||
|
import 'package:tmail_ui_user/features/labels/presentation/widgets/add_label_to_email_modal.dart';
|
||||||
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/extensions/update_current_emails_flags_extension.dart';
|
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/extensions/update_current_emails_flags_extension.dart';
|
||||||
|
import 'package:tmail_ui_user/features/thread/data/extensions/map_keywords_extension.dart';
|
||||||
import 'package:tmail_ui_user/features/thread/domain/extensions/presentation_email_map_extension.dart';
|
import 'package:tmail_ui_user/features/thread/domain/extensions/presentation_email_map_extension.dart';
|
||||||
import 'package:tmail_ui_user/features/thread_detail/domain/extensions/list_email_in_thread_detail_info_extension.dart';
|
import 'package:tmail_ui_user/features/thread_detail/domain/extensions/list_email_in_thread_detail_info_extension.dart';
|
||||||
import 'package:tmail_ui_user/main/routes/route_navigation.dart';
|
import 'package:tmail_ui_user/main/routes/dialog_router.dart';
|
||||||
|
|
||||||
extension HandleLabelForEmailExtension on SingleEmailController {
|
extension HandleLabelForEmailExtension on SingleEmailController {
|
||||||
bool get isLabelFeatureEnabled {
|
bool get isLabelFeatureEnabled {
|
||||||
@@ -68,24 +70,12 @@ extension HandleLabelForEmailExtension on SingleEmailController {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
addALabelToAnEmailInteractor = getBinding<AddALabelToAnEmailInteractor>();
|
consumeState(addALabelToAnEmailInteractor.execute(
|
||||||
if (addALabelToAnEmailInteractor != null) {
|
accountId,
|
||||||
consumeState(addALabelToAnEmailInteractor!.execute(
|
emailId,
|
||||||
accountId,
|
labelKeyword,
|
||||||
emailId,
|
label.safeDisplayName,
|
||||||
labelKeyword,
|
));
|
||||||
label.safeDisplayName,
|
|
||||||
));
|
|
||||||
} else {
|
|
||||||
consumeState(
|
|
||||||
Stream.value(
|
|
||||||
Left(AddALabelToAnEmailFailure(
|
|
||||||
exception: LabelInteractorIsNull(),
|
|
||||||
labelDisplay: labelDisplay,
|
|
||||||
)),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void handleAddLabelToEmailSuccess(AddALabelToAnEmailSuccess success) {
|
void handleAddLabelToEmailSuccess(AddALabelToAnEmailSuccess success) {
|
||||||
@@ -105,36 +95,43 @@ extension HandleLabelForEmailExtension on SingleEmailController {
|
|||||||
required EmailId emailId,
|
required EmailId emailId,
|
||||||
required KeyWordIdentifier labelKeyword,
|
required KeyWordIdentifier labelKeyword,
|
||||||
}) {
|
}) {
|
||||||
if (PlatformInfo.isMobile && !isThreadDetailEnabled) {
|
_updateLabelInEmailOnMemory(
|
||||||
_updateLabelInEmailWithThreadDisabledOnMobile(
|
emailId: emailId,
|
||||||
emailId: emailId,
|
labelKeyword: labelKeyword,
|
||||||
labelKeyword: labelKeyword,
|
isMobileThreadDisabled: PlatformInfo.isMobile && !isThreadDetailEnabled,
|
||||||
);
|
);
|
||||||
} else {
|
|
||||||
_updateLabelInEmailWithThreadEnabled(
|
|
||||||
emailId: emailId,
|
|
||||||
labelKeyword: labelKeyword,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void _updateLabelInEmailWithThreadDisabledOnMobile({
|
void _updateLabelInEmailOnMemory({
|
||||||
required EmailId emailId,
|
required EmailId emailId,
|
||||||
required KeyWordIdentifier labelKeyword,
|
required KeyWordIdentifier labelKeyword,
|
||||||
|
required bool isMobileThreadDisabled,
|
||||||
}) {
|
}) {
|
||||||
final selectedEmail = mailboxDashBoardController.selectedEmail.value;
|
if (isMobileThreadDisabled) {
|
||||||
final selectedEmailId = selectedEmail?.id;
|
final selectedEmail = mailboxDashBoardController.selectedEmail.value;
|
||||||
if (selectedEmail == null ||
|
if (selectedEmail?.id == emailId) {
|
||||||
selectedEmailId == null ||
|
mailboxDashBoardController.selectedEmail.value?.keywords
|
||||||
selectedEmailId != emailId) {
|
?.addKeyword(labelKeyword);
|
||||||
return;
|
}
|
||||||
|
} else {
|
||||||
|
final controller = threadDetailController;
|
||||||
|
if (controller != null) {
|
||||||
|
controller.emailIdsPresentation.value =
|
||||||
|
controller.emailIdsPresentation.addEmailKeywordById(
|
||||||
|
emailId: emailId,
|
||||||
|
keyword: labelKeyword,
|
||||||
|
);
|
||||||
|
|
||||||
|
controller.emailsInThreadDetailInfo.value =
|
||||||
|
controller.emailsInThreadDetailInfo.addEmailKeywordById(
|
||||||
|
emailId: emailId,
|
||||||
|
keyword: labelKeyword,
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mailboxDashBoardController.selectedEmail.value =
|
|
||||||
selectedEmail.addKeyword(labelKeyword);
|
|
||||||
|
|
||||||
final emailLoaded = currentEmailLoaded.value;
|
final emailLoaded = currentEmailLoaded.value;
|
||||||
if (emailLoaded != null) {
|
if (emailLoaded != null && emailLoaded.emailCurrent?.id == emailId) {
|
||||||
currentEmailLoaded.value = emailLoaded.addEmailKeyword(
|
currentEmailLoaded.value = emailLoaded.addEmailKeyword(
|
||||||
emailId: emailId,
|
emailId: emailId,
|
||||||
keyword: labelKeyword,
|
keyword: labelKeyword,
|
||||||
@@ -146,42 +143,26 @@ extension HandleLabelForEmailExtension on SingleEmailController {
|
|||||||
isLabelAdded: true,
|
isLabelAdded: true,
|
||||||
labelKeyword: labelKeyword,
|
labelKeyword: labelKeyword,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
mailboxDashBoardController.labelController.isLabelSettingEnabled.refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
void _updateLabelInEmailWithThreadEnabled({
|
Future<void> openAddLabelToEmailDialogModal(PresentationEmail email) async {
|
||||||
required EmailId emailId,
|
final labels = mailboxDashBoardController.labelController.labels;
|
||||||
required KeyWordIdentifier labelKeyword,
|
final emailLabels = email.getLabelList(labels);
|
||||||
}) {
|
final emailId = email.id;
|
||||||
final controller = threadDetailController;
|
if (emailId == null || labels.isEmpty) {
|
||||||
if (controller == null) return;
|
return;
|
||||||
|
|
||||||
final currentEmailId = currentEmail?.id;
|
|
||||||
if (currentEmailId == null || currentEmailId != emailId) return;
|
|
||||||
|
|
||||||
controller.emailIdsPresentation.value =
|
|
||||||
controller.emailIdsPresentation.addEmailKeywordById(
|
|
||||||
emailId: emailId,
|
|
||||||
keyword: labelKeyword,
|
|
||||||
);
|
|
||||||
|
|
||||||
controller.emailsInThreadDetailInfo.value =
|
|
||||||
controller.emailsInThreadDetailInfo.addEmailKeywordById(
|
|
||||||
emailId: emailId,
|
|
||||||
keyword: labelKeyword,
|
|
||||||
);
|
|
||||||
|
|
||||||
final emailLoaded = controller.currentEmailLoaded.value;
|
|
||||||
if (emailLoaded != null) {
|
|
||||||
controller.currentEmailLoaded.value = emailLoaded.addEmailKeyword(
|
|
||||||
emailId: emailId,
|
|
||||||
keyword: labelKeyword,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mailboxDashBoardController.updateEmailFlagByEmailIds(
|
await DialogRouter().openDialogModal(
|
||||||
[emailId],
|
child: AddLabelToEmailModal(
|
||||||
isLabelAdded: true,
|
labels: labels,
|
||||||
labelKeyword: labelKeyword,
|
emailLabels: emailLabels,
|
||||||
|
emailId: emailId,
|
||||||
|
onAddLabelToEmailCallback: toggleLabelToEmail,
|
||||||
|
),
|
||||||
|
dialogLabel: 'add-label-to-email-modal',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-3
@@ -296,7 +296,7 @@ class EmailActionReactor {
|
|||||||
);
|
);
|
||||||
|
|
||||||
final newRuleFilterRequest = PlatformInfo.isWeb
|
final newRuleFilterRequest = PlatformInfo.isWeb
|
||||||
? await DialogRouter.pushGeneralDialog(
|
? await DialogRouter().pushGeneralDialog(
|
||||||
routeName: AppRoutes.rulesFilterCreator,
|
routeName: AppRoutes.rulesFilterCreator,
|
||||||
arguments: arguments,
|
arguments: arguments,
|
||||||
)
|
)
|
||||||
@@ -593,7 +593,9 @@ class EmailActionReactor {
|
|||||||
actions: popupMenuItemEmailActions,
|
actions: popupMenuItemEmailActions,
|
||||||
submenuController: submenuController,
|
submenuController: submenuController,
|
||||||
onActionSelected: (action) {
|
onActionSelected: (action) {
|
||||||
handleEmailAction(presentationEmail, action.action);
|
if (action.action != EmailActionType.labelAs) {
|
||||||
|
handleEmailAction(presentationEmail, action.action);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -738,7 +740,7 @@ class EmailActionReactor {
|
|||||||
);
|
);
|
||||||
|
|
||||||
final destinationMailbox = PlatformInfo.isWeb
|
final destinationMailbox = PlatformInfo.isWeb
|
||||||
? await DialogRouter.pushGeneralDialog(routeName: AppRoutes.destinationPicker, arguments: arguments)
|
? await DialogRouter().pushGeneralDialog(routeName: AppRoutes.destinationPicker, arguments: arguments)
|
||||||
: await push(AppRoutes.destinationPicker, arguments: arguments);
|
: await push(AppRoutes.destinationPicker, arguments: arguments);
|
||||||
|
|
||||||
if (destinationMailbox is PresentationMailbox) {
|
if (destinationMailbox is PresentationMailbox) {
|
||||||
|
|||||||
@@ -1,3 +1 @@
|
|||||||
class LabelInteractorIsNull implements Exception {}
|
class LabelKeywordIsNull implements Exception {}
|
||||||
|
|
||||||
class LabelKeywordIsNull implements Exception {}
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import 'package:core/presentation/state/failure.dart';
|
import 'package:core/presentation/state/failure.dart';
|
||||||
import 'package:core/presentation/state/success.dart';
|
import 'package:core/presentation/state/success.dart';
|
||||||
import 'package:core/utils/app_logger.dart';
|
import 'package:core/utils/app_logger.dart';
|
||||||
import 'package:core/utils/platform_info.dart';
|
|
||||||
import 'package:dartz/dartz.dart';
|
import 'package:dartz/dartz.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:jmap_dart_client/jmap/account_id.dart';
|
import 'package:jmap_dart_client/jmap/account_id.dart';
|
||||||
@@ -22,12 +21,12 @@ import 'package:tmail_ui_user/features/manage_account/domain/state/get_label_set
|
|||||||
import 'package:tmail_ui_user/features/manage_account/domain/usecases/get_label_setting_state_interactor.dart';
|
import 'package:tmail_ui_user/features/manage_account/domain/usecases/get_label_setting_state_interactor.dart';
|
||||||
import 'package:tmail_ui_user/main/error/capability_validator.dart';
|
import 'package:tmail_ui_user/main/error/capability_validator.dart';
|
||||||
import 'package:tmail_ui_user/main/exceptions/logic_exception.dart';
|
import 'package:tmail_ui_user/main/exceptions/logic_exception.dart';
|
||||||
|
import 'package:tmail_ui_user/main/routes/dialog_router.dart';
|
||||||
import 'package:tmail_ui_user/main/routes/route_navigation.dart';
|
import 'package:tmail_ui_user/main/routes/route_navigation.dart';
|
||||||
|
|
||||||
class LabelController extends BaseController {
|
class LabelController extends BaseController {
|
||||||
final labels = <Label>[].obs;
|
final labels = <Label>[].obs;
|
||||||
final labelListExpandMode = Rx(ExpandMode.EXPAND);
|
final labelListExpandMode = Rx(ExpandMode.EXPAND);
|
||||||
final isCreateNewLabelModalVisible = RxBool(false);
|
|
||||||
final isLabelSettingEnabled = RxBool(false);
|
final isLabelSettingEnabled = RxBool(false);
|
||||||
|
|
||||||
GetAllLabelInteractor? _getAllLabelInteractor;
|
GetAllLabelInteractor? _getAllLabelInteractor;
|
||||||
@@ -72,22 +71,13 @@ class LabelController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> openCreateNewLabelModal(AccountId? accountId) async {
|
Future<void> openCreateNewLabelModal(AccountId? accountId) async {
|
||||||
if (PlatformInfo.isWeb) {
|
await DialogRouter().openDialogModal(
|
||||||
isCreateNewLabelModalVisible.value = true;
|
child: CreateNewLabelModal(
|
||||||
}
|
|
||||||
|
|
||||||
await Get.generalDialog(
|
|
||||||
barrierDismissible: true,
|
|
||||||
barrierLabel: 'create-new-label-modal',
|
|
||||||
pageBuilder: (_, __, ___) => CreateNewLabelModal(
|
|
||||||
labels: labels,
|
labels: labels,
|
||||||
onCreateNewLabelCallback: (label) => _createNewLabel(accountId, label),
|
onCreateNewLabelCallback: (label) => _createNewLabel(accountId, label),
|
||||||
),
|
),
|
||||||
).whenComplete(() {
|
dialogLabel: 'create-new-label-modal',
|
||||||
if (PlatformInfo.isWeb) {
|
);
|
||||||
isCreateNewLabelModalVisible.value = false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void _createNewLabel(AccountId? accountId, Label label) {
|
void _createNewLabel(AccountId? accountId, Label label) {
|
||||||
|
|||||||
@@ -0,0 +1,156 @@
|
|||||||
|
import 'dart:math' as math;
|
||||||
|
|
||||||
|
import 'package:core/presentation/extensions/color_extension.dart';
|
||||||
|
import 'package:core/presentation/resources/image_paths.dart';
|
||||||
|
import 'package:core/presentation/views/button/default_close_button_widget.dart';
|
||||||
|
import 'package:core/utils/platform_info.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:jmap_dart_client/jmap/mail/email/email.dart';
|
||||||
|
import 'package:labels/labels.dart';
|
||||||
|
import 'package:tmail_ui_user/features/labels/presentation/widgets/label_item_context_menu.dart';
|
||||||
|
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
||||||
|
import 'package:tmail_ui_user/main/routes/route_navigation.dart';
|
||||||
|
|
||||||
|
typedef OnAddLabelToEmailCallback = Function(
|
||||||
|
EmailId emailId,
|
||||||
|
Label label,
|
||||||
|
bool isSelected,
|
||||||
|
);
|
||||||
|
|
||||||
|
class AddLabelToEmailModal extends StatefulWidget {
|
||||||
|
final List<Label> labels;
|
||||||
|
final List<Label> emailLabels;
|
||||||
|
final EmailId emailId;
|
||||||
|
final OnAddLabelToEmailCallback onAddLabelToEmailCallback;
|
||||||
|
|
||||||
|
const AddLabelToEmailModal({
|
||||||
|
super.key,
|
||||||
|
required this.labels,
|
||||||
|
required this.emailLabels,
|
||||||
|
required this.emailId,
|
||||||
|
required this.onAddLabelToEmailCallback,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<AddLabelToEmailModal> createState() => _AddLabelToEmailModalState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _AddLabelToEmailModalState extends State<AddLabelToEmailModal> {
|
||||||
|
final ImagePaths _imagePaths = Get.find<ImagePaths>();
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final appLocalizations = AppLocalizations.of(context);
|
||||||
|
final theme = Theme.of(context);
|
||||||
|
|
||||||
|
return LayoutBuilder(builder: (_, constraints) {
|
||||||
|
final currentScreenWidth = constraints.maxWidth;
|
||||||
|
final currentScreenHeight = constraints.maxHeight;
|
||||||
|
final maxHeight = math.min(currentScreenHeight, 450).toDouble();
|
||||||
|
|
||||||
|
Widget bodyWidget = Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
borderRadius: const BorderRadius.all(Radius.circular(16)),
|
||||||
|
boxShadow: [
|
||||||
|
BoxShadow(
|
||||||
|
color: Colors.black.withValues(alpha: 0.08),
|
||||||
|
blurRadius: 24,
|
||||||
|
offset: const Offset(0, 2),
|
||||||
|
),
|
||||||
|
BoxShadow(
|
||||||
|
color: Colors.black.withValues(alpha: 0.08),
|
||||||
|
blurRadius: 2,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
width: math.min(
|
||||||
|
currentScreenWidth - 32,
|
||||||
|
554,
|
||||||
|
),
|
||||||
|
constraints: BoxConstraints(maxHeight: maxHeight),
|
||||||
|
clipBehavior: Clip.antiAlias,
|
||||||
|
child: Stack(
|
||||||
|
children: [
|
||||||
|
Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
height: 64,
|
||||||
|
alignment: Alignment.center,
|
||||||
|
padding: const EdgeInsetsDirectional.only(
|
||||||
|
start: 32,
|
||||||
|
end: 32,
|
||||||
|
top: 16,
|
||||||
|
bottom: 16,
|
||||||
|
),
|
||||||
|
child: Text(
|
||||||
|
appLocalizations.addLabel,
|
||||||
|
style: theme.textTheme.headlineSmall?.copyWith(
|
||||||
|
color: AppColor.m3SurfaceBackground,
|
||||||
|
),
|
||||||
|
maxLines: 1,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Flexible(
|
||||||
|
child: Container(
|
||||||
|
padding: const EdgeInsetsDirectional.only(
|
||||||
|
start: 22,
|
||||||
|
end: 22,
|
||||||
|
bottom: 16,
|
||||||
|
),
|
||||||
|
child: ListView.builder(
|
||||||
|
shrinkWrap: true,
|
||||||
|
padding: EdgeInsets.zero,
|
||||||
|
itemCount: widget.labels.length,
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
final label = widget.labels[index];
|
||||||
|
final isSelected = widget.emailLabels.contains(label);
|
||||||
|
return LabelItemContextMenu(
|
||||||
|
label: label,
|
||||||
|
imagePaths: _imagePaths,
|
||||||
|
isSelected: isSelected,
|
||||||
|
onSelectLabelAction: _onSelectLabel,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
DefaultCloseButtonWidget(
|
||||||
|
iconClose: _imagePaths.icCloseDialog,
|
||||||
|
onTapActionCallback: _onCloseModal,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
bodyWidget = Center(child: bodyWidget);
|
||||||
|
|
||||||
|
if (PlatformInfo.isMobile) {
|
||||||
|
bodyWidget = GestureDetector(
|
||||||
|
onTap: _onCloseModal,
|
||||||
|
child: Scaffold(
|
||||||
|
backgroundColor: AppColor.blackAlpha20,
|
||||||
|
body: bodyWidget,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return bodyWidget;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void _onSelectLabel(Label label, bool isSelected) {
|
||||||
|
widget.onAddLabelToEmailCallback(widget.emailId, label, isSelected);
|
||||||
|
popBack();
|
||||||
|
}
|
||||||
|
|
||||||
|
void _onCloseModal() {
|
||||||
|
popBack();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -894,7 +894,7 @@ class MailboxController extends BaseMailboxController
|
|||||||
final arguments = MailboxCreatorArguments(allMailboxes, parentMailbox);
|
final arguments = MailboxCreatorArguments(allMailboxes, parentMailbox);
|
||||||
|
|
||||||
final result = PlatformInfo.isWeb
|
final result = PlatformInfo.isWeb
|
||||||
? await DialogRouter.pushGeneralDialog(routeName: AppRoutes.mailboxCreator, arguments: arguments)
|
? await DialogRouter().pushGeneralDialog(routeName: AppRoutes.mailboxCreator, arguments: arguments)
|
||||||
: await push(AppRoutes.mailboxCreator, arguments: arguments);
|
: await push(AppRoutes.mailboxCreator, arguments: arguments);
|
||||||
|
|
||||||
if (result != null && result is NewMailboxArguments) {
|
if (result != null && result is NewMailboxArguments) {
|
||||||
|
|||||||
+1
-1
@@ -221,7 +221,7 @@ class AdvancedFilterController extends BaseController {
|
|||||||
);
|
);
|
||||||
|
|
||||||
final destinationMailbox = PlatformInfo.isWeb
|
final destinationMailbox = PlatformInfo.isWeb
|
||||||
? await DialogRouter.pushGeneralDialog(
|
? await DialogRouter().pushGeneralDialog(
|
||||||
routeName: AppRoutes.destinationPicker,
|
routeName: AppRoutes.destinationPicker,
|
||||||
arguments: arguments)
|
arguments: arguments)
|
||||||
: await push(AppRoutes.destinationPicker, arguments: arguments);
|
: await push(AppRoutes.destinationPicker, arguments: arguments);
|
||||||
|
|||||||
+6
-6
@@ -1342,7 +1342,7 @@ class MailboxDashBoardController extends ReloadableController
|
|||||||
);
|
);
|
||||||
|
|
||||||
final destinationMailbox = PlatformInfo.isWeb
|
final destinationMailbox = PlatformInfo.isWeb
|
||||||
? await DialogRouter.pushGeneralDialog(routeName: AppRoutes.destinationPicker, arguments: arguments)
|
? await DialogRouter().pushGeneralDialog(routeName: AppRoutes.destinationPicker, arguments: arguments)
|
||||||
: await push(AppRoutes.destinationPicker, arguments: arguments);
|
: await push(AppRoutes.destinationPicker, arguments: arguments);
|
||||||
|
|
||||||
if (destinationMailbox != null &&
|
if (destinationMailbox != null &&
|
||||||
@@ -2201,7 +2201,7 @@ class MailboxDashBoardController extends ReloadableController
|
|||||||
contactViewTitle: '${appLocalizations.findEmails} ${appLocalizations.from_email_address_prefix.toLowerCase()}'
|
contactViewTitle: '${appLocalizations.findEmails} ${appLocalizations.from_email_address_prefix.toLowerCase()}'
|
||||||
);
|
);
|
||||||
|
|
||||||
final newListContact = await DialogRouter.pushGeneralDialog(
|
final newListContact = await DialogRouter().pushGeneralDialog(
|
||||||
routeName: AppRoutes.contact,
|
routeName: AppRoutes.contact,
|
||||||
arguments: contactArgument);
|
arguments: contactArgument);
|
||||||
|
|
||||||
@@ -2224,7 +2224,7 @@ class MailboxDashBoardController extends ReloadableController
|
|||||||
contactViewTitle: '${appLocalizations.findEmails} ${appLocalizations.to_email_address_prefix.toLowerCase()}'
|
contactViewTitle: '${appLocalizations.findEmails} ${appLocalizations.to_email_address_prefix.toLowerCase()}'
|
||||||
);
|
);
|
||||||
|
|
||||||
final newListContact = await DialogRouter.pushGeneralDialog(
|
final newListContact = await DialogRouter().pushGeneralDialog(
|
||||||
routeName: AppRoutes.contact,
|
routeName: AppRoutes.contact,
|
||||||
arguments: contactArgument);
|
arguments: contactArgument);
|
||||||
|
|
||||||
@@ -2249,7 +2249,7 @@ class MailboxDashBoardController extends ReloadableController
|
|||||||
mailboxIdSelected: mailboxIdSelected);
|
mailboxIdSelected: mailboxIdSelected);
|
||||||
|
|
||||||
final destinationMailbox = PlatformInfo.isWeb
|
final destinationMailbox = PlatformInfo.isWeb
|
||||||
? await DialogRouter.pushGeneralDialog(
|
? await DialogRouter().pushGeneralDialog(
|
||||||
routeName: AppRoutes.destinationPicker,
|
routeName: AppRoutes.destinationPicker,
|
||||||
arguments: destinationArgument)
|
arguments: destinationArgument)
|
||||||
: await push(
|
: await push(
|
||||||
@@ -3275,8 +3275,8 @@ class MailboxDashBoardController extends ReloadableController
|
|||||||
if (currentAccountId != null && currentSession != null) {
|
if (currentAccountId != null && currentSession != null) {
|
||||||
final arguments = EmailRecoveryArguments(currentAccountId, currentSession);
|
final arguments = EmailRecoveryArguments(currentAccountId, currentSession);
|
||||||
|
|
||||||
final result = PlatformInfo.isWeb
|
final result = PlatformInfo.isWeb
|
||||||
? await DialogRouter.pushGeneralDialog(
|
? await DialogRouter().pushGeneralDialog(
|
||||||
routeName: AppRoutes.emailRecovery,
|
routeName: AppRoutes.emailRecovery,
|
||||||
arguments: arguments,
|
arguments: arguments,
|
||||||
)
|
)
|
||||||
|
|||||||
+1
-1
@@ -44,7 +44,7 @@ extension HandleCreateNewRuleFilter on MailboxDashBoardController {
|
|||||||
);
|
);
|
||||||
|
|
||||||
final newRuleFilterRequest = PlatformInfo.isWeb
|
final newRuleFilterRequest = PlatformInfo.isWeb
|
||||||
? await DialogRouter.pushGeneralDialog(
|
? await DialogRouter().pushGeneralDialog(
|
||||||
routeName: AppRoutes.rulesFilterCreator,
|
routeName: AppRoutes.rulesFilterCreator,
|
||||||
arguments: arguments,
|
arguments: arguments,
|
||||||
)
|
)
|
||||||
|
|||||||
+1
-2
@@ -9,7 +9,6 @@ extension VerifyDisplayOverlayViewOnIframeExtension
|
|||||||
isAppGridDialogDisplayed.isTrue ||
|
isAppGridDialogDisplayed.isTrue ||
|
||||||
isDrawerOpened.isTrue ||
|
isDrawerOpened.isTrue ||
|
||||||
isContextMenuOpened.isTrue ||
|
isContextMenuOpened.isTrue ||
|
||||||
isPopupMenuOpened.isTrue ||
|
isPopupMenuOpened.isTrue;
|
||||||
labelController.isCreateNewLabelModalVisible.isTrue;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ class EmailRulesController extends BaseController {
|
|||||||
final arguments = RulesFilterCreatorArguments(accountId, session);
|
final arguments = RulesFilterCreatorArguments(accountId, session);
|
||||||
|
|
||||||
final newRuleFilterRequest = PlatformInfo.isWeb
|
final newRuleFilterRequest = PlatformInfo.isWeb
|
||||||
? await DialogRouter.pushGeneralDialog(routeName: AppRoutes.rulesFilterCreator, arguments: arguments)
|
? await DialogRouter().pushGeneralDialog(routeName: AppRoutes.rulesFilterCreator, arguments: arguments)
|
||||||
: await push(AppRoutes.rulesFilterCreator, arguments: arguments);
|
: await push(AppRoutes.rulesFilterCreator, arguments: arguments);
|
||||||
|
|
||||||
if (newRuleFilterRequest is CreateNewEmailRuleFilterRequest) {
|
if (newRuleFilterRequest is CreateNewEmailRuleFilterRequest) {
|
||||||
@@ -139,7 +139,7 @@ class EmailRulesController extends BaseController {
|
|||||||
tMailRule: rule);
|
tMailRule: rule);
|
||||||
|
|
||||||
final newRuleFilterRequest = PlatformInfo.isWeb
|
final newRuleFilterRequest = PlatformInfo.isWeb
|
||||||
? await DialogRouter.pushGeneralDialog(routeName: AppRoutes.rulesFilterCreator, arguments: arguments)
|
? await DialogRouter().pushGeneralDialog(routeName: AppRoutes.rulesFilterCreator, arguments: arguments)
|
||||||
: await push(AppRoutes.rulesFilterCreator, arguments: arguments);
|
: await push(AppRoutes.rulesFilterCreator, arguments: arguments);
|
||||||
|
|
||||||
if (newRuleFilterRequest is EditEmailRuleFilterRequest) {
|
if (newRuleFilterRequest is EditEmailRuleFilterRequest) {
|
||||||
|
|||||||
@@ -230,7 +230,7 @@ class IdentitiesController extends ReloadableController implements BeforeReconne
|
|||||||
);
|
);
|
||||||
|
|
||||||
newIdentityArguments = PlatformInfo.isWeb
|
newIdentityArguments = PlatformInfo.isWeb
|
||||||
? await DialogRouter.pushGeneralDialog(routeName: AppRoutes.identityCreator, arguments: arguments)
|
? await DialogRouter().pushGeneralDialog(routeName: AppRoutes.identityCreator, arguments: arguments)
|
||||||
: await push(AppRoutes.identityCreator, arguments: arguments);
|
: await push(AppRoutes.identityCreator, arguments: arguments);
|
||||||
|
|
||||||
if (newIdentityArguments is CreateNewIdentityRequest) {
|
if (newIdentityArguments is CreateNewIdentityRequest) {
|
||||||
@@ -382,7 +382,7 @@ class IdentitiesController extends ReloadableController implements BeforeReconne
|
|||||||
actionType: IdentityActionType.edit);
|
actionType: IdentityActionType.edit);
|
||||||
|
|
||||||
newIdentityArguments = PlatformInfo.isWeb
|
newIdentityArguments = PlatformInfo.isWeb
|
||||||
? await DialogRouter.pushGeneralDialog(routeName: AppRoutes.identityCreator, arguments: arguments)
|
? await DialogRouter().pushGeneralDialog(routeName: AppRoutes.identityCreator, arguments: arguments)
|
||||||
: await push(AppRoutes.identityCreator, arguments: arguments);
|
: await push(AppRoutes.identityCreator, arguments: arguments);
|
||||||
|
|
||||||
if (newIdentityArguments is CreateNewIdentityRequest) {
|
if (newIdentityArguments is CreateNewIdentityRequest) {
|
||||||
@@ -480,7 +480,7 @@ class IdentitiesController extends ReloadableController implements BeforeReconne
|
|||||||
actionType: identityCache.identityActionType);
|
actionType: identityCache.identityActionType);
|
||||||
|
|
||||||
newIdentityArguments = PlatformInfo.isWeb
|
newIdentityArguments = PlatformInfo.isWeb
|
||||||
? await DialogRouter.pushGeneralDialog(routeName: AppRoutes.identityCreator, arguments: arguments)
|
? await DialogRouter().pushGeneralDialog(routeName: AppRoutes.identityCreator, arguments: arguments)
|
||||||
: await push(AppRoutes.identityCreator, arguments: arguments);
|
: await push(AppRoutes.identityCreator, arguments: arguments);
|
||||||
|
|
||||||
if (newIdentityArguments == null) {
|
if (newIdentityArguments == null) {
|
||||||
|
|||||||
@@ -30,8 +30,8 @@ class SignatureBuilder extends StatelessWidget {
|
|||||||
if (PlatformInfo.isWeb) {
|
if (PlatformInfo.isWeb) {
|
||||||
final iframeOverlay = Obx(() {
|
final iframeOverlay = Obx(() {
|
||||||
if (MessageDialogActionManager().isDialogOpened ||
|
if (MessageDialogActionManager().isDialogOpened ||
|
||||||
DialogRouter.isDialogOpened ||
|
DialogRouter().isDialogOpened ||
|
||||||
DialogRouter.isRuleFilterDialogOpened.isTrue) {
|
DialogRouter().isRuleFilterDialogOpened.isTrue) {
|
||||||
return Positioned.fill(
|
return Positioned.fill(
|
||||||
child: PointerInterceptor(
|
child: PointerInterceptor(
|
||||||
child: const SizedBox.expand(),
|
child: const SizedBox.expand(),
|
||||||
|
|||||||
@@ -441,7 +441,7 @@ class RulesFilterCreatorController extends BaseMailboxController {
|
|||||||
_session);
|
_session);
|
||||||
|
|
||||||
final destinationMailbox = PlatformInfo.isWeb
|
final destinationMailbox = PlatformInfo.isWeb
|
||||||
? await DialogRouter.pushGeneralDialog(routeName: AppRoutes.destinationPicker, arguments: arguments)
|
? await DialogRouter().pushGeneralDialog(routeName: AppRoutes.destinationPicker, arguments: arguments)
|
||||||
: await push(AppRoutes.destinationPicker, arguments: arguments);
|
: await push(AppRoutes.destinationPicker, arguments: arguments);
|
||||||
|
|
||||||
if (destinationMailbox is PresentationMailbox && context.mounted) {
|
if (destinationMailbox is PresentationMailbox && context.mounted) {
|
||||||
|
|||||||
@@ -705,7 +705,7 @@ class SearchEmailController extends BaseController
|
|||||||
mailboxIdSelected: mailbox?.id);
|
mailboxIdSelected: mailbox?.id);
|
||||||
|
|
||||||
final destinationMailbox = PlatformInfo.isWeb
|
final destinationMailbox = PlatformInfo.isWeb
|
||||||
? await DialogRouter.pushGeneralDialog(routeName: AppRoutes.destinationPicker, arguments: arguments)
|
? await DialogRouter().pushGeneralDialog(routeName: AppRoutes.destinationPicker, arguments: arguments)
|
||||||
: await push(AppRoutes.destinationPicker, arguments: arguments);
|
: await push(AppRoutes.destinationPicker, arguments: arguments);
|
||||||
|
|
||||||
if (destinationMailbox is! PresentationMailbox) return;
|
if (destinationMailbox is! PresentationMailbox) return;
|
||||||
|
|||||||
@@ -827,7 +827,7 @@ class SearchMailboxController extends BaseMailboxController with MailboxActionHa
|
|||||||
final arguments = MailboxCreatorArguments(allMailboxes, parentMailbox);
|
final arguments = MailboxCreatorArguments(allMailboxes, parentMailbox);
|
||||||
|
|
||||||
final result = PlatformInfo.isWeb
|
final result = PlatformInfo.isWeb
|
||||||
? await DialogRouter.pushGeneralDialog(routeName: AppRoutes.mailboxCreator, arguments: arguments)
|
? await DialogRouter().pushGeneralDialog(routeName: AppRoutes.mailboxCreator, arguments: arguments)
|
||||||
: await push(AppRoutes.mailboxCreator, arguments: arguments);
|
: await push(AppRoutes.mailboxCreator, arguments: arguments);
|
||||||
|
|
||||||
if (result != null && result is NewMailboxArguments) {
|
if (result != null && result is NewMailboxArguments) {
|
||||||
|
|||||||
@@ -16,4 +16,8 @@ extension MapKeywordsExtension on Map<KeyWordIdentifier, bool>? {
|
|||||||
Map<KeyWordIdentifier, bool> withoutKeyword(KeyWordIdentifier keyword) {
|
Map<KeyWordIdentifier, bool> withoutKeyword(KeyWordIdentifier keyword) {
|
||||||
return Map<KeyWordIdentifier, bool>.from(this ?? {})..remove(keyword);
|
return Map<KeyWordIdentifier, bool>.from(this ?? {})..remove(keyword);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void addKeyword(KeyWordIdentifier keyword) {
|
||||||
|
this?[keyword] = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -160,7 +160,7 @@ mixin EmailActionController {
|
|||||||
mailboxIdSelected: mailboxContain.mailboxId);
|
mailboxIdSelected: mailboxContain.mailboxId);
|
||||||
|
|
||||||
final destinationMailbox = PlatformInfo.isWeb
|
final destinationMailbox = PlatformInfo.isWeb
|
||||||
? await DialogRouter.pushGeneralDialog(routeName: AppRoutes.destinationPicker, arguments: arguments)
|
? await DialogRouter().pushGeneralDialog(routeName: AppRoutes.destinationPicker, arguments: arguments)
|
||||||
: await push(AppRoutes.destinationPicker, arguments: arguments);
|
: await push(AppRoutes.destinationPicker, arguments: arguments);
|
||||||
|
|
||||||
if (destinationMailbox != null &&
|
if (destinationMailbox != null &&
|
||||||
|
|||||||
+1
-1
@@ -211,7 +211,7 @@ extension OnThreadDetailActionClick on ThreadDetailController {
|
|||||||
mailboxIdSelected: mailboxIdSelected,
|
mailboxIdSelected: mailboxIdSelected,
|
||||||
);
|
);
|
||||||
final destinationMailbox = PlatformInfo.isWeb
|
final destinationMailbox = PlatformInfo.isWeb
|
||||||
? await DialogRouter.pushGeneralDialog(
|
? await DialogRouter().pushGeneralDialog(
|
||||||
routeName: AppRoutes.destinationPicker,
|
routeName: AppRoutes.destinationPicker,
|
||||||
arguments: arguments,
|
arguments: arguments,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -5315,5 +5315,11 @@
|
|||||||
"placeholders": {
|
"placeholders": {
|
||||||
"labelName": {}
|
"labelName": {}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"addLabel": "Add label",
|
||||||
|
"@addLabel": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders_order": [],
|
||||||
|
"placeholders": {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5642,4 +5642,11 @@ class AppLocalizations {
|
|||||||
args: [labelName],
|
args: [labelName],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String get addLabel {
|
||||||
|
return Intl.message(
|
||||||
|
'Add label',
|
||||||
|
name: 'addLabel',
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
import 'package:core/utils/app_logger.dart';
|
import 'package:core/utils/app_logger.dart';
|
||||||
|
import 'package:core/utils/platform_info.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:tmail_ui_user/features/contact/presentation/contact_bindings.dart';
|
import 'package:tmail_ui_user/features/contact/presentation/contact_bindings.dart';
|
||||||
@@ -17,12 +17,19 @@ import 'package:tmail_ui_user/features/rules_filter_creator/presentation/rules_f
|
|||||||
import 'package:tmail_ui_user/main/routes/app_routes.dart';
|
import 'package:tmail_ui_user/main/routes/app_routes.dart';
|
||||||
|
|
||||||
class DialogRouter {
|
class DialogRouter {
|
||||||
|
static final _instance = DialogRouter._();
|
||||||
|
|
||||||
static Future<dynamic> pushGeneralDialog({
|
factory DialogRouter() => _instance;
|
||||||
|
|
||||||
|
DialogRouter._();
|
||||||
|
|
||||||
|
Future<dynamic> pushGeneralDialog({
|
||||||
required String routeName,
|
required String routeName,
|
||||||
required Object? arguments
|
required Object? arguments
|
||||||
}) async {
|
}) async {
|
||||||
_isDialogOpened.value = true;
|
if (PlatformInfo.isWeb) {
|
||||||
|
_isDialogOpened.value = true;
|
||||||
|
}
|
||||||
_bindingDI(routeName);
|
_bindingDI(routeName);
|
||||||
|
|
||||||
final returnedValue = await Get.generalDialog(
|
final returnedValue = await Get.generalDialog(
|
||||||
@@ -32,19 +39,21 @@ class DialogRouter {
|
|||||||
pageBuilder: (_, __, ___) => _generateView(routeName: routeName)
|
pageBuilder: (_, __, ___) => _generateView(routeName: routeName)
|
||||||
);
|
);
|
||||||
|
|
||||||
_isDialogOpened.value = false;
|
if (PlatformInfo.isWeb) {
|
||||||
if (routeName == AppRoutes.rulesFilterCreator) {
|
_isDialogOpened.value = false;
|
||||||
isRuleFilterDialogOpened.value = false;
|
if (routeName == AppRoutes.rulesFilterCreator) {
|
||||||
|
isRuleFilterDialogOpened.value = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return returnedValue;
|
return returnedValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
static final RxBool _isDialogOpened = false.obs;
|
final RxBool _isDialogOpened = false.obs;
|
||||||
static final RxBool isRuleFilterDialogOpened = false.obs;
|
final RxBool isRuleFilterDialogOpened = false.obs;
|
||||||
|
|
||||||
static bool get isDialogOpened => _isDialogOpened.value;
|
bool get isDialogOpened => _isDialogOpened.value;
|
||||||
|
|
||||||
static void _bindingDI(String routeName) {
|
void _bindingDI(String routeName) {
|
||||||
log('DialogRouter::_bindingDI():routeName: $routeName');
|
log('DialogRouter::_bindingDI():routeName: $routeName');
|
||||||
switch(routeName) {
|
switch(routeName) {
|
||||||
case AppRoutes.mailboxCreator:
|
case AppRoutes.mailboxCreator:
|
||||||
@@ -69,7 +78,7 @@ class DialogRouter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static Widget _generateView({required String routeName}) {
|
Widget _generateView({required String routeName}) {
|
||||||
switch(routeName) {
|
switch(routeName) {
|
||||||
case AppRoutes.mailboxCreator:
|
case AppRoutes.mailboxCreator:
|
||||||
return MailboxCreatorView();
|
return MailboxCreatorView();
|
||||||
@@ -87,4 +96,23 @@ class DialogRouter {
|
|||||||
return const SizedBox.shrink();
|
return const SizedBox.shrink();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> openDialogModal({
|
||||||
|
required Widget child,
|
||||||
|
String? dialogLabel,
|
||||||
|
}) async {
|
||||||
|
if (PlatformInfo.isWeb) {
|
||||||
|
_isDialogOpened.value = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
await Get.generalDialog(
|
||||||
|
barrierDismissible: true,
|
||||||
|
barrierLabel: dialogLabel,
|
||||||
|
pageBuilder: (_, __, ___) => child,
|
||||||
|
).whenComplete(() {
|
||||||
|
if (PlatformInfo.isWeb) {
|
||||||
|
_isDialogOpened.value = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -105,9 +105,6 @@ class MockLabelController extends Mock implements LabelController {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Rx<ExpandMode> get labelListExpandMode => Rx(ExpandMode.EXPAND);
|
Rx<ExpandMode> get labelListExpandMode => Rx(ExpandMode.EXPAND);
|
||||||
|
|
||||||
@override
|
|
||||||
RxBool get isCreateNewLabelModalVisible => RxBool(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class MockMailboxDashBoardController extends Mock implements MailboxDashBoardController {
|
class MockMailboxDashBoardController extends Mock implements MailboxDashBoardController {
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import 'package:tmail_ui_user/features/email/data/repository/calendar_event_repo
|
|||||||
import 'package:tmail_ui_user/features/email/domain/model/event_action.dart';
|
import 'package:tmail_ui_user/features/email/domain/model/event_action.dart';
|
||||||
import 'package:tmail_ui_user/features/email/domain/state/get_email_content_state.dart';
|
import 'package:tmail_ui_user/features/email/domain/state/get_email_content_state.dart';
|
||||||
import 'package:tmail_ui_user/features/email/domain/state/parse_calendar_event_state.dart';
|
import 'package:tmail_ui_user/features/email/domain/state/parse_calendar_event_state.dart';
|
||||||
|
import 'package:tmail_ui_user/features/email/domain/usecases/add_a_label_to_an_email_interactor.dart';
|
||||||
import 'package:tmail_ui_user/features/email/domain/usecases/calendar_event_accept_interactor.dart';
|
import 'package:tmail_ui_user/features/email/domain/usecases/calendar_event_accept_interactor.dart';
|
||||||
import 'package:tmail_ui_user/features/email/domain/usecases/calendar_event_reject_interactor.dart';
|
import 'package:tmail_ui_user/features/email/domain/usecases/calendar_event_reject_interactor.dart';
|
||||||
import 'package:tmail_ui_user/features/email/domain/usecases/get_email_content_interactor.dart';
|
import 'package:tmail_ui_user/features/email/domain/usecases/get_email_content_interactor.dart';
|
||||||
@@ -73,6 +74,7 @@ const fallbackGenerators = {
|
|||||||
MockSpec<MarkAsStarEmailInteractor>(),
|
MockSpec<MarkAsStarEmailInteractor>(),
|
||||||
MockSpec<GetAllIdentitiesInteractor>(),
|
MockSpec<GetAllIdentitiesInteractor>(),
|
||||||
MockSpec<StoreOpenedEmailInteractor>(),
|
MockSpec<StoreOpenedEmailInteractor>(),
|
||||||
|
MockSpec<AddALabelToAnEmailInteractor>(),
|
||||||
MockSpec<MailboxDashBoardController>(fallbackGenerators: fallbackGenerators),
|
MockSpec<MailboxDashBoardController>(fallbackGenerators: fallbackGenerators),
|
||||||
MockSpec<DownloadController>(fallbackGenerators: fallbackGenerators),
|
MockSpec<DownloadController>(fallbackGenerators: fallbackGenerators),
|
||||||
MockSpec<DownloadManager>(fallbackGenerators: fallbackGenerators),
|
MockSpec<DownloadManager>(fallbackGenerators: fallbackGenerators),
|
||||||
@@ -106,6 +108,7 @@ void main() {
|
|||||||
final markAsStarEmailInteractor = MockMarkAsStarEmailInteractor();
|
final markAsStarEmailInteractor = MockMarkAsStarEmailInteractor();
|
||||||
final getAllIdentitiesInteractor = MockGetAllIdentitiesInteractor();
|
final getAllIdentitiesInteractor = MockGetAllIdentitiesInteractor();
|
||||||
final storeOpenedEmailInteractor = MockStoreOpenedEmailInteractor();
|
final storeOpenedEmailInteractor = MockStoreOpenedEmailInteractor();
|
||||||
|
final addALabelToAnEmailInteractor = MockAddALabelToAnEmailInteractor();
|
||||||
final mailboxDashboardController = MockMailboxDashBoardController();
|
final mailboxDashboardController = MockMailboxDashBoardController();
|
||||||
final downloadController = MockDownloadController();
|
final downloadController = MockDownloadController();
|
||||||
final downloadManager = MockDownloadManager();
|
final downloadManager = MockDownloadManager();
|
||||||
@@ -171,6 +174,7 @@ void main() {
|
|||||||
markAsStarEmailInteractor,
|
markAsStarEmailInteractor,
|
||||||
getAllIdentitiesInteractor,
|
getAllIdentitiesInteractor,
|
||||||
storeOpenedEmailInteractor,
|
storeOpenedEmailInteractor,
|
||||||
|
addALabelToAnEmailInteractor,
|
||||||
printEmailInteractor,
|
printEmailInteractor,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user