TF-1074 Handle go to path /emails_forward_creator
This commit is contained in:
@@ -8,6 +8,9 @@ import 'package:tmail_ui_user/features/contact/presentation/model/contact_argume
|
||||
import 'package:tmail_ui_user/features/destination_picker/presentation/destination_picker_bindings.dart';
|
||||
import 'package:tmail_ui_user/features/destination_picker/presentation/destination_picker_view.dart';
|
||||
import 'package:tmail_ui_user/features/destination_picker/presentation/model/destination_picker_arguments.dart';
|
||||
import 'package:tmail_ui_user/features/emails_forward_creator/presentation/emails_forward_creator_binding.dart';
|
||||
import 'package:tmail_ui_user/features/emails_forward_creator/presentation/emails_forward_creator_view.dart';
|
||||
import 'package:tmail_ui_user/features/emails_forward_creator/presentation/model/email_forward_creator_arguments.dart';
|
||||
import 'package:tmail_ui_user/features/identity_creator/presentation/identity_creator_bindings.dart';
|
||||
import 'package:tmail_ui_user/features/identity_creator/presentation/identity_creator_view.dart';
|
||||
import 'package:tmail_ui_user/features/identity_creator/presentation/model/identity_creator_arguments.dart';
|
||||
@@ -165,4 +168,34 @@ mixin ViewAsDialogActionMixin {
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
void showDialogEmailForwardCreator({
|
||||
required BuildContext context,
|
||||
required EmailForwardCreatorArguments arguments,
|
||||
required Function(List<EmailAddress>) onAddEmailForward
|
||||
}) {
|
||||
EmailsForwardCreatorBindings().dependencies();
|
||||
|
||||
showGeneralDialog(
|
||||
context: context,
|
||||
barrierDismissible: true,
|
||||
barrierLabel: '',
|
||||
barrierColor: Colors.black.withAlpha(24),
|
||||
pageBuilder: (context, animation, secondaryAnimation) {
|
||||
return EmailsForwardCreatorView.fromArguments(
|
||||
arguments,
|
||||
onDismissCallback: () {
|
||||
EmailsForwardCreatorBindings().dispose();
|
||||
popBack();
|
||||
},
|
||||
onAddEmailForwardCallback: (listEmailAddress) {
|
||||
EmailsForwardCreatorBindings().dispose();
|
||||
popBack();
|
||||
|
||||
if (listEmailAddress.isNotEmpty) {
|
||||
onAddEmailForward.call(listEmailAddress);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
+5
-17
@@ -1,26 +1,14 @@
|
||||
import 'package:get/get.dart';
|
||||
import 'package:tmail_ui_user/features/base/base_bindings.dart';
|
||||
import 'package:tmail_ui_user/features/emails_forward_creator/presentation/emails_forward_creator_controller.dart';
|
||||
|
||||
class EmailsForwardCreatorBindings extends BaseBindings {
|
||||
class EmailsForwardCreatorBindings extends Bindings {
|
||||
|
||||
@override
|
||||
void bindingsController() {
|
||||
void dependencies() {
|
||||
Get.lazyPut(() => EmailsForwardCreatorController());
|
||||
}
|
||||
|
||||
@override
|
||||
void bindingsDataSource() {}
|
||||
|
||||
@override
|
||||
void bindingsDataSourceImpl() {}
|
||||
|
||||
@override
|
||||
void bindingsInteractor() {}
|
||||
|
||||
@override
|
||||
void bindingsRepository() {}
|
||||
|
||||
@override
|
||||
void bindingsRepositoryImpl() {}
|
||||
void dispose() {
|
||||
Get.delete<EmailsForwardCreatorController>();
|
||||
}
|
||||
}
|
||||
+39
-31
@@ -1,7 +1,7 @@
|
||||
|
||||
import 'package:core/utils/app_logger.dart';
|
||||
import 'package:core/utils/build_utils.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:jmap_dart_client/jmap/account_id.dart';
|
||||
import 'package:jmap_dart_client/jmap/core/session/session.dart';
|
||||
@@ -12,35 +12,47 @@ import 'package:tmail_ui_user/features/composer/domain/model/contact_suggestion_
|
||||
import 'package:tmail_ui_user/features/composer/domain/state/get_autocomplete_state.dart';
|
||||
import 'package:tmail_ui_user/features/composer/domain/usecases/get_autocomplete_interactor.dart';
|
||||
import 'package:tmail_ui_user/features/composer/domain/usecases/get_autocomplete_with_device_contact_interactor.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/forward/forward_controller.dart';
|
||||
import 'package:tmail_ui_user/features/emails_forward_creator/presentation/model/email_forward_creator_arguments.dart';
|
||||
import 'package:tmail_ui_user/main/routes/route_navigation.dart';
|
||||
|
||||
typedef OnAddEmailForwardCallback = Function(List<EmailAddress> listEmailAddress);
|
||||
|
||||
class EmailsForwardCreatorController extends BaseController {
|
||||
|
||||
final inputEmailForwardController = TextEditingController();
|
||||
final ContactSuggestionSource _contactSuggestionSource = ContactSuggestionSource.tMailContact;
|
||||
final _forwardController = Get.find<ForwardController>();
|
||||
|
||||
GetAutoCompleteWithDeviceContactInteractor? _getAutoCompleteWithDeviceContactInteractor;
|
||||
GetAutoCompleteInteractor? _getAutoCompleteInteractor;
|
||||
|
||||
final listEmailForwards = RxSet<EmailAddress>();
|
||||
|
||||
EmailsForwardCreatorController();
|
||||
TextEditingController? inputEmailForwardController;
|
||||
|
||||
AccountId? get _accountId => _forwardController.emailsForwardCreatorArguments.value?.accountId;
|
||||
EmailForwardCreatorArguments? arguments;
|
||||
OnAddEmailForwardCallback? onAddEmailForwardCallback;
|
||||
VoidCallback? onDismissForwardCreatorCallback;
|
||||
AccountId? _accountId;
|
||||
Session? _session;
|
||||
|
||||
Session? get _session => _forwardController.emailsForwardCreatorArguments.value?.session;
|
||||
@override
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
inputEmailForwardController = TextEditingController();
|
||||
}
|
||||
|
||||
@override
|
||||
void onReady() {
|
||||
injectAutoCompleteBindings(_session, _accountId);
|
||||
super.onReady();
|
||||
if (arguments != null) {
|
||||
_accountId = arguments!.accountId;
|
||||
_session = arguments!.session;
|
||||
injectAutoCompleteBindings(_session, _accountId);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void onClose() {
|
||||
inputEmailForwardController.dispose();
|
||||
_disposeWidget();
|
||||
super.onClose();
|
||||
}
|
||||
|
||||
@@ -62,7 +74,6 @@ class EmailsForwardCreatorController extends BaseController {
|
||||
}
|
||||
|
||||
Future<List<EmailAddress>> getAutoCompleteSuggestion(String word) async {
|
||||
log('EmailsForwardCreatorController::getAutoCompleteSuggestion(): $word | $_contactSuggestionSource');
|
||||
try {
|
||||
_getAutoCompleteWithDeviceContactInteractor = Get.find<GetAutoCompleteWithDeviceContactInteractor>();
|
||||
_getAutoCompleteInteractor = Get.find<GetAutoCompleteInteractor>();
|
||||
@@ -72,7 +83,6 @@ class EmailsForwardCreatorController extends BaseController {
|
||||
|
||||
if (_contactSuggestionSource == ContactSuggestionSource.all) {
|
||||
if (_getAutoCompleteWithDeviceContactInteractor == null || _getAutoCompleteInteractor == null) {
|
||||
logError('EmailsForwardCreatorController::_getAutoCompleteWithDeviceContactInteractor(): is null');
|
||||
return <EmailAddress>[];
|
||||
} else {
|
||||
return await _getAutoCompleteWithDeviceContactInteractor!
|
||||
@@ -85,7 +95,6 @@ class EmailsForwardCreatorController extends BaseController {
|
||||
}
|
||||
} else {
|
||||
if (_getAutoCompleteInteractor == null) {
|
||||
logError('EmailsForwardCreatorController::_getAutoCompleteInteractor(): is null');
|
||||
return <EmailAddress>[];
|
||||
} else {
|
||||
return await _getAutoCompleteInteractor!
|
||||
@@ -100,26 +109,26 @@ class EmailsForwardCreatorController extends BaseController {
|
||||
}
|
||||
|
||||
void addToListEmailForwards(EmailAddress emailAddress) {
|
||||
if(emailAddress.email !=null && emailAddress.email!.isNotEmpty) {
|
||||
if (emailAddress.email != null && emailAddress.email!.isNotEmpty) {
|
||||
listEmailForwards.add(emailAddress);
|
||||
}
|
||||
}
|
||||
|
||||
void clearAll() {
|
||||
inputEmailForwardController.clear();
|
||||
inputEmailForwardController?.clear();
|
||||
}
|
||||
|
||||
void _clearListEmailForwards() {
|
||||
listEmailForwards.clear();
|
||||
void _disposeWidget() {
|
||||
inputEmailForwardController?.dispose();
|
||||
inputEmailForwardController = null;
|
||||
}
|
||||
|
||||
void closeView(BuildContext context) {
|
||||
FocusScope.of(context).unfocus();
|
||||
clearAll();
|
||||
|
||||
if(kIsWeb) {
|
||||
_clearListEmailForwards();
|
||||
_forwardController.accountDashBoardController.emailsForwardCreatorIsActive.toggle();
|
||||
if (BuildUtils.isWeb) {
|
||||
_disposeWidget();
|
||||
onDismissForwardCreatorCallback?.call();
|
||||
} else {
|
||||
popBack();
|
||||
}
|
||||
@@ -127,21 +136,20 @@ class EmailsForwardCreatorController extends BaseController {
|
||||
|
||||
void addEmailForwards(BuildContext context) {
|
||||
FocusScope.of(context).unfocus();
|
||||
if(inputEmailForwardController.text.trim().isNotEmpty) {
|
||||
listEmailForwards.add(EmailAddress(null, inputEmailForwardController.text.trim()));
|
||||
}
|
||||
clearAll();
|
||||
|
||||
if (listEmailForwards.isNotEmpty) {
|
||||
final newListEmailForwards = List<EmailAddress>.from(listEmailForwards);
|
||||
_forwardController.handleAddRecipients(newListEmailForwards);
|
||||
final emailInput = inputEmailForwardController?.text.trim();
|
||||
if (emailInput?.isNotEmpty == true && emailInput?.isEmail == true) {
|
||||
listEmailForwards.add(EmailAddress(null, emailInput));
|
||||
}
|
||||
|
||||
if(kIsWeb) {
|
||||
_clearListEmailForwards();
|
||||
_forwardController.accountDashBoardController.emailsForwardCreatorIsActive.toggle();
|
||||
final newListEmailForwardNeedAdded = listEmailForwards.toList();
|
||||
log('EmailsForwardCreatorController::addEmailForwards(): newListEmailForwardNeedAdded: $newListEmailForwardNeedAdded');
|
||||
|
||||
if (BuildUtils.isWeb) {
|
||||
_disposeWidget();
|
||||
onAddEmailForwardCallback?.call(newListEmailForwardNeedAdded);
|
||||
} else {
|
||||
popBack();
|
||||
popBack(result: newListEmailForwardNeedAdded);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import 'package:get/get.dart';
|
||||
import 'package:jmap_dart_client/jmap/mail/email/email_address.dart';
|
||||
import 'package:model/model.dart';
|
||||
import 'package:tmail_ui_user/features/emails_forward_creator/presentation/emails_forward_creator_controller.dart';
|
||||
import 'package:tmail_ui_user/features/emails_forward_creator/presentation/model/email_forward_creator_arguments.dart';
|
||||
import 'package:tmail_ui_user/features/emails_forward_creator/presentation/widgets/email_forward_creator_item_widget.dart';
|
||||
import 'package:tmail_ui_user/features/emails_forward_creator/presentation/widgets/emails_forward_input_with_drop_list_field_builder.dart';
|
||||
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
||||
@@ -14,82 +15,82 @@ class EmailsForwardCreatorView extends GetWidget<EmailsForwardCreatorController>
|
||||
final _imagePaths = Get.find<ImagePaths>();
|
||||
final _responsiveUtils = Get.find<ResponsiveUtils>();
|
||||
|
||||
EmailsForwardCreatorView({Key? key}) : super(key: key);
|
||||
@override
|
||||
final controller = Get.find<EmailsForwardCreatorController>();
|
||||
|
||||
EmailsForwardCreatorView({Key? key}) : super(key: key) {
|
||||
controller.arguments = Get.arguments;
|
||||
}
|
||||
|
||||
EmailsForwardCreatorView.fromArguments(
|
||||
EmailForwardCreatorArguments arguments, {
|
||||
Key? key,
|
||||
OnAddEmailForwardCallback? onAddEmailForwardCallback,
|
||||
VoidCallback? onDismissCallback
|
||||
}) : super(key: key) {
|
||||
controller.arguments = arguments;
|
||||
controller.onAddEmailForwardCallback = onAddEmailForwardCallback;
|
||||
controller.onDismissForwardCreatorCallback = onDismissCallback;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ResponsiveWidget(
|
||||
responsiveUtils: _responsiveUtils,
|
||||
mobile: Scaffold(
|
||||
backgroundColor: Colors.black38,
|
||||
backgroundColor: BuildUtils.isWeb
|
||||
? Colors.black.withAlpha(24)
|
||||
: Colors.black38,
|
||||
body: GestureDetector(
|
||||
onTap: () => FocusScope.of(context).unfocus(),
|
||||
child: SafeArea(
|
||||
child: Align(
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: Card(
|
||||
color: Colors.transparent,
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(16),
|
||||
topRight: Radius.circular(16),
|
||||
)),
|
||||
child: Container(
|
||||
decoration: const BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(16),
|
||||
topRight: Radius.circular(16),
|
||||
)),
|
||||
width: double.infinity,
|
||||
height: _responsiveUtils.getSizeScreenHeight(context) - 70,
|
||||
child: ClipRRect(
|
||||
borderRadius: const BorderRadius.only(
|
||||
topLeft: Radius.circular(16),
|
||||
topRight: Radius.circular(16)),
|
||||
child: _buildEmailForwardCreatorList(context)
|
||||
)
|
||||
)
|
||||
bottom: false,
|
||||
left: false,
|
||||
right: false,
|
||||
child: Container(
|
||||
decoration: const BoxDecoration(
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(16),
|
||||
topRight: Radius.circular(16)),
|
||||
color: Colors.white),
|
||||
margin: const EdgeInsets.only(top: BuildUtils.isWeb ? 70 : 0),
|
||||
child: ClipRRect(
|
||||
borderRadius: const BorderRadius.only(
|
||||
topLeft: Radius.circular(16),
|
||||
topRight: Radius.circular(16)),
|
||||
child: SafeArea(child: _buildEmailForwardCreatorList(context))
|
||||
)
|
||||
),
|
||||
),
|
||||
)
|
||||
),
|
||||
tablet: Scaffold(
|
||||
backgroundColor: Colors.black38,
|
||||
backgroundColor: Colors.black.withAlpha(24),
|
||||
body: GestureDetector(
|
||||
onTap: () => FocusScope.of(context).unfocus(),
|
||||
child: Align(alignment: Alignment.bottomCenter, child: Card(
|
||||
color: Colors.transparent,
|
||||
shape: const RoundedRectangleBorder(
|
||||
child: Align(alignment: Alignment.bottomCenter, child: Container(
|
||||
decoration: const BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(16),
|
||||
topRight: Radius.circular(16),
|
||||
)),
|
||||
child: Container(
|
||||
decoration: const BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(16),
|
||||
topRight: Radius.circular(16),
|
||||
)),
|
||||
width: double.infinity,
|
||||
height: _responsiveUtils.getSizeScreenHeight(context) * 0.7,
|
||||
child: ClipRRect(
|
||||
borderRadius: const BorderRadius.only(
|
||||
topLeft: Radius.circular(16),
|
||||
topRight: Radius.circular(16)),
|
||||
child: _buildEmailForwardCreatorList(context)
|
||||
)
|
||||
width: double.infinity,
|
||||
height: _responsiveUtils.getSizeScreenHeight(context) * 0.7,
|
||||
child: ClipRRect(
|
||||
borderRadius: const BorderRadius.only(
|
||||
topLeft: Radius.circular(16),
|
||||
topRight: Radius.circular(16)),
|
||||
child: _buildEmailForwardCreatorList(context)
|
||||
)
|
||||
)),
|
||||
)
|
||||
),
|
||||
desktop: Scaffold(
|
||||
backgroundColor: Colors.black38,
|
||||
backgroundColor: Colors.black.withAlpha(24),
|
||||
body: GestureDetector(
|
||||
onTap: () => FocusScope.of(context).unfocus(),
|
||||
child: Align(alignment: Alignment.center, child: Card(
|
||||
child: Center(child: Card(
|
||||
color: Colors.transparent,
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.all(Radius.circular(16))),
|
||||
@@ -104,8 +105,7 @@ class EmailsForwardCreatorView extends GetWidget<EmailsForwardCreatorController>
|
||||
child: _buildEmailForwardCreatorList(context)
|
||||
)
|
||||
)
|
||||
)
|
||||
),
|
||||
)),
|
||||
)
|
||||
)
|
||||
);
|
||||
@@ -125,7 +125,7 @@ class EmailsForwardCreatorView extends GetWidget<EmailsForwardCreatorController>
|
||||
fontSize: 20,
|
||||
color: Colors.black))),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8.0),
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: (EmailsForwardInputWithDropListFieldBuilder(
|
||||
AppLocalizations.of(context).recipientsLabel,
|
||||
controller.inputEmailForwardController)
|
||||
@@ -134,7 +134,7 @@ class EmailsForwardCreatorView extends GetWidget<EmailsForwardCreatorController>
|
||||
controller.clearAll();
|
||||
})
|
||||
..addOnSummitedCallbackAction((pattern) {
|
||||
if (pattern != null && pattern.trim().isNotEmpty) {
|
||||
if (pattern != null && pattern.trim().isNotEmpty && pattern.isEmail == true) {
|
||||
controller.addToListEmailForwards(EmailAddress(null, pattern.trim()));
|
||||
controller.clearAll();
|
||||
}
|
||||
@@ -156,7 +156,7 @@ class EmailsForwardCreatorView extends GetWidget<EmailsForwardCreatorController>
|
||||
)),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 8),
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: _buildButtonAddNewEmailsForward(context),
|
||||
),
|
||||
]),
|
||||
@@ -192,7 +192,7 @@ class EmailsForwardCreatorView extends GetWidget<EmailsForwardCreatorController>
|
||||
AppLocalizations.of(context).addRecipients,
|
||||
isVertical: false,
|
||||
))
|
||||
.build();
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
||||
+3
-2
@@ -3,10 +3,11 @@ import 'package:equatable/equatable.dart';
|
||||
import 'package:jmap_dart_client/jmap/account_id.dart';
|
||||
import 'package:jmap_dart_client/jmap/core/session/session.dart';
|
||||
|
||||
class MailsForwardCreatorArguments with EquatableMixin {
|
||||
class EmailForwardCreatorArguments with EquatableMixin {
|
||||
final AccountId accountId;
|
||||
final Session? session;
|
||||
MailsForwardCreatorArguments(this.accountId, this.session);
|
||||
|
||||
EmailForwardCreatorArguments(this.accountId, this.session);
|
||||
|
||||
@override
|
||||
List<Object?> get props => [accountId, session];
|
||||
+1
-1
@@ -12,7 +12,7 @@ typedef OnSummitedCallbackAction = Function(String? pattern);
|
||||
class EmailsForwardInputWithDropListFieldBuilder {
|
||||
|
||||
final String hintText;
|
||||
final TextEditingController editingController;
|
||||
final TextEditingController? editingController;
|
||||
|
||||
OnSelectedSuggestionAction? _onSelectedSuggestionAction;
|
||||
OnSuggestionCallbackAction? _onSuggestionCallbackAction;
|
||||
|
||||
@@ -4,23 +4,23 @@ import 'package:core/presentation/utils/app_toast.dart';
|
||||
import 'package:core/presentation/utils/responsive_utils.dart';
|
||||
import 'package:core/presentation/views/bottom_popup/confirmation_dialog_action_sheet_builder.dart';
|
||||
import 'package:core/presentation/views/dialog/confirmation_dialog_builder.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:core/utils/build_utils.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:forward/forward/tmail_forward.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:jmap_dart_client/jmap/account_id.dart';
|
||||
import 'package:model/extensions/email_address_extension.dart';
|
||||
import 'package:model/mailbox/select_mode.dart';
|
||||
import 'package:pointer_interceptor/pointer_interceptor.dart';
|
||||
import 'package:tmail_ui_user/features/base/base_controller.dart';
|
||||
import 'package:tmail_ui_user/features/emails_forward_creator/presentation/emails_forward_creator_binding.dart';
|
||||
import 'package:tmail_ui_user/features/emails_forward_creator/presentation/model/email_forward_creator_arguments.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/domain/model/add_recipients_in_forwarding_request.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/domain/model/delete_recipient_in_forwarding_request.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/domain/model/edit_local_copy_in_forwarding_request.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/domain/state/add_recipient_in_forwarding_state.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/domain/state/delete_recipient_in_forwarding_state.dart';
|
||||
import 'package:jmap_dart_client/jmap/mail/email/email_address.dart';
|
||||
import 'package:tmail_ui_user/features/emails_forward_creator/presentation/model/mails_forward_creator_arguments.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/domain/state/edit_local_copy_in_forwarding_state.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/domain/state/get_forward_state.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/domain/usecases/add_recipients_in_forwarding_interactor.dart';
|
||||
@@ -49,7 +49,6 @@ class ForwardController extends BaseController {
|
||||
final selectionMode = Rx<SelectMode>(SelectMode.INACTIVE);
|
||||
final listRecipientForward = RxList<RecipientForward>();
|
||||
final currentForward = Rxn<TMailForward>();
|
||||
final emailsForwardCreatorArguments = Rxn<MailsForwardCreatorArguments>();
|
||||
|
||||
final listForwards = <String>[].obs;
|
||||
|
||||
@@ -237,28 +236,32 @@ class ForwardController extends BaseController {
|
||||
.toList();
|
||||
}
|
||||
|
||||
void goToAddEmailsForward() async {
|
||||
void goToAddEmailsForward(BuildContext context) async {
|
||||
final accountId = accountDashBoardController.accountId.value;
|
||||
final session = accountDashBoardController.sessionCurrent.value;
|
||||
if (accountId != null && session != null) {
|
||||
emailsForwardCreatorArguments.value = MailsForwardCreatorArguments(accountId, session);
|
||||
if (kIsWeb) {
|
||||
_openMailsForwardCreatorOverlay();
|
||||
final arguments = EmailForwardCreatorArguments(accountId, session);
|
||||
|
||||
if (BuildUtils.isWeb) {
|
||||
showDialogEmailForwardCreator(
|
||||
context: context,
|
||||
arguments: arguments,
|
||||
onAddEmailForward: (listEmailAddress) => _handleAddRecipients(accountId, listEmailAddress));
|
||||
} else {
|
||||
push(AppRoutes.emailsForwardCreator);
|
||||
final newListEmailAddress = await push(
|
||||
AppRoutes.emailsForwardCreator,
|
||||
arguments: arguments);
|
||||
|
||||
if (newListEmailAddress is List<EmailAddress> && newListEmailAddress.isNotEmpty) {
|
||||
_handleAddRecipients(accountId, newListEmailAddress);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void _openMailsForwardCreatorOverlay() {
|
||||
EmailsForwardCreatorBindings().dependencies();
|
||||
accountDashBoardController.emailsForwardCreatorIsActive.toggle();
|
||||
}
|
||||
|
||||
void handleAddRecipients(List<EmailAddress> listEmailAddress) {
|
||||
final accountId = accountDashBoardController.accountId.value;
|
||||
void _handleAddRecipients(AccountId accountId, List<EmailAddress> listEmailAddress) {
|
||||
final listRecipients = listEmailAddress.map((e) => e.emailAddress).toSet();
|
||||
if (accountId != null && currentForward.value != null) {
|
||||
if (currentForward.value != null) {
|
||||
consumeState(_addRecipientsInForwardingInteractor.execute(
|
||||
accountId,
|
||||
AddRecipientInForwardingRequest(
|
||||
|
||||
@@ -59,7 +59,7 @@ class ForwardHeaderWidget extends GetWidget<ForwardController> {
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.w500,
|
||||
))
|
||||
..onPressActionClick(() => controller.goToAddEmailsForward())
|
||||
..onPressActionClick(() => controller.goToAddEmailsForward(context))
|
||||
..text(
|
||||
AppLocalizations.of(context).addRecipients,
|
||||
isVertical: false,
|
||||
@@ -81,7 +81,7 @@ class ForwardHeaderWidget extends GetWidget<ForwardController> {
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.w500,
|
||||
))
|
||||
..onPressActionClick(() => controller.goToAddEmailsForward())
|
||||
..onPressActionClick(() => controller.goToAddEmailsForward(context))
|
||||
..text(
|
||||
AppLocalizations.of(context).addRecipients,
|
||||
isVertical: false,
|
||||
|
||||
@@ -48,12 +48,9 @@ class ManageAccountDashBoardController extends ReloadableController {
|
||||
final accountId = Rxn<AccountId>();
|
||||
final accountMenuItemSelected = AccountMenuItem.profiles.obs;
|
||||
final settingsPageLevel = SettingsPageLevel.universal.obs;
|
||||
|
||||
final sessionCurrent = Rxn<Session>();
|
||||
final vacationResponse = Rxn<VacationResponse>();
|
||||
|
||||
final emailsForwardCreatorIsActive = false.obs;
|
||||
|
||||
ManageAccountDashBoardController(
|
||||
LogoutOidcInteractor logoutOidcInteractor,
|
||||
DeleteAuthorityOidcInteractor deleteAuthorityOidcInteractor,
|
||||
|
||||
@@ -1,8 +1,13 @@
|
||||
|
||||
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/image/avatar_builder.dart';
|
||||
import 'package:core/presentation/views/responsive/responsive_widget.dart';
|
||||
import 'package:core/presentation/views/text/slogan_builder.dart';
|
||||
import 'package:core/utils/build_utils.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:tmail_ui_user/features/emails_forward_creator/presentation/emails_forward_creator_view.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/mixin/user_setting_popup_menu_mixin.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/extensions/vacation_response_extension.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/vacation/widgets/vacation_notification_message_widget.dart';
|
||||
@@ -34,101 +39,94 @@ class ManageAccountDashBoardView extends GetWidget<ManageAccountDashBoardControl
|
||||
});
|
||||
}
|
||||
|
||||
return Obx(
|
||||
() => Stack(
|
||||
children: [
|
||||
Scaffold(
|
||||
key: controller.menuDrawerKey,
|
||||
backgroundColor: Colors.white,
|
||||
drawerEnableOpenDragGesture: false,
|
||||
body: GestureDetector(
|
||||
onTap: () => FocusScope.of(context).unfocus(),
|
||||
child: ResponsiveWidget(
|
||||
responsiveUtils: _responsiveUtils,
|
||||
desktop: Column(children: [
|
||||
Row(children: [
|
||||
Container(width: 256, color: Colors.white,
|
||||
padding: const EdgeInsets.only(top: 25, bottom: 25, left: 32),
|
||||
child: Row(children: [
|
||||
(SloganBuilder(arrangedByHorizontal: true)
|
||||
..setSloganText(AppLocalizations.of(context).app_name)
|
||||
..setSloganTextAlign(TextAlign.center)
|
||||
..setSloganTextStyle(const TextStyle(color: Colors.black, fontSize: 20, fontWeight: FontWeight.bold))
|
||||
..setSizeLogo(24)
|
||||
..addOnTapCallback(() => controller.backToMailboxDashBoard(context))
|
||||
..setLogo(_imagePaths.icLogoTMail))
|
||||
.build(),
|
||||
Obx(() {
|
||||
if (controller.appInformation.value != null) {
|
||||
return Padding(padding: const EdgeInsets.only(top: 6),
|
||||
child: Text(
|
||||
'v.${controller.appInformation.value!.version}',
|
||||
textAlign: TextAlign.center,
|
||||
style: const TextStyle(fontSize: 13, color: AppColor.colorContentEmail, fontWeight: FontWeight.w500),
|
||||
));
|
||||
} else {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
}),
|
||||
])
|
||||
),
|
||||
Expanded(child: Padding(
|
||||
padding: const EdgeInsets.only(right: 10, top: 16, bottom: 10, left: 48),
|
||||
child: _buildRightHeader(context)))
|
||||
return Scaffold(
|
||||
key: controller.menuDrawerKey,
|
||||
backgroundColor: Colors.white,
|
||||
drawerEnableOpenDragGesture: false,
|
||||
body: GestureDetector(
|
||||
onTap: () => FocusScope.of(context).unfocus(),
|
||||
child: ResponsiveWidget(
|
||||
responsiveUtils: _responsiveUtils,
|
||||
desktop: Column(children: [
|
||||
Row(children: [
|
||||
Container(width: 256, color: Colors.white,
|
||||
padding: const EdgeInsets.only(top: 25, bottom: 25, left: 32),
|
||||
child: Row(children: [
|
||||
(SloganBuilder(arrangedByHorizontal: true)
|
||||
..setSloganText(AppLocalizations.of(context).app_name)
|
||||
..setSloganTextAlign(TextAlign.center)
|
||||
..setSloganTextStyle(const TextStyle(color: Colors.black, fontSize: 20, fontWeight: FontWeight.bold))
|
||||
..setSizeLogo(24)
|
||||
..addOnTapCallback(() => controller.backToMailboxDashBoard(context))
|
||||
..setLogo(_imagePaths.icLogoTMail))
|
||||
.build(),
|
||||
Obx(() {
|
||||
if (controller.appInformation.value != null) {
|
||||
return Padding(padding: const EdgeInsets.only(top: 6),
|
||||
child: Text(
|
||||
'v.${controller.appInformation.value!.version}',
|
||||
textAlign: TextAlign.center,
|
||||
style: const TextStyle(fontSize: 13, color: AppColor.colorContentEmail, fontWeight: FontWeight.w500),
|
||||
));
|
||||
} else {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
}),
|
||||
])
|
||||
),
|
||||
Expanded(child: Padding(
|
||||
padding: const EdgeInsets.only(right: 10, top: 16, bottom: 10, left: 48),
|
||||
child: _buildRightHeader(context)))
|
||||
]),
|
||||
Expanded(child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(child: ManageAccountMenuView(), width: _responsiveUtils.defaultSizeMenu),
|
||||
Expanded(child: Container(
|
||||
color: AppColor.colorBgDesktop,
|
||||
child: Column(children: [
|
||||
Obx(() {
|
||||
if (controller.vacationResponse.value?.vacationResponderIsValid == true) {
|
||||
return VacationNotificationMessageWidget(
|
||||
margin: const EdgeInsets.only(
|
||||
top: 16,
|
||||
left: BuildUtils.isWeb ? 24 : 16,
|
||||
right: BuildUtils.isWeb ? 24 : 16),
|
||||
fromAccountDashBoard: true,
|
||||
vacationResponse: controller.vacationResponse.value!,
|
||||
actionGotoVacationSetting: !controller.inVacationSettings()
|
||||
? () => controller.selectAccountMenuItem(AccountMenuItem.vacation)
|
||||
: null,
|
||||
actionEndNow: () => controller.disableVacationResponder());
|
||||
} else if ((controller.vacationResponse.value?.vacationResponderIsWaiting == true
|
||||
|| controller.vacationResponse.value?.vacationResponderIsStopped == true)
|
||||
&& controller.accountMenuItemSelected.value == AccountMenuItem.vacation) {
|
||||
return VacationNotificationMessageWidget(
|
||||
margin: const EdgeInsets.only(
|
||||
top: 16,
|
||||
left: BuildUtils.isWeb ? 24 : 16,
|
||||
right: BuildUtils.isWeb ? 24 : 16),
|
||||
fromAccountDashBoard: true,
|
||||
vacationResponse: controller.vacationResponse.value!,
|
||||
padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 16),
|
||||
leadingIcon: const Padding(
|
||||
padding: EdgeInsets.only(right: 16),
|
||||
child: Icon(Icons.timer, size: 20),
|
||||
));
|
||||
} else {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
}),
|
||||
Expanded(child: _viewDisplayedOfAccountMenuItem())
|
||||
]),
|
||||
Expanded(child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(child: ManageAccountMenuView(), width: _responsiveUtils.defaultSizeMenu),
|
||||
Expanded(child: Container(
|
||||
color: AppColor.colorBgDesktop,
|
||||
child: Column(children: [
|
||||
Obx(() {
|
||||
if (controller.vacationResponse.value?.vacationResponderIsValid == true) {
|
||||
return VacationNotificationMessageWidget(
|
||||
margin: const EdgeInsets.only(
|
||||
top: 16,
|
||||
left: BuildUtils.isWeb ? 24 : 16,
|
||||
right: BuildUtils.isWeb ? 24 : 16),
|
||||
fromAccountDashBoard: true,
|
||||
vacationResponse: controller.vacationResponse.value!,
|
||||
actionGotoVacationSetting: !controller.inVacationSettings()
|
||||
? () => controller.selectAccountMenuItem(AccountMenuItem.vacation)
|
||||
: null,
|
||||
actionEndNow: () => controller.disableVacationResponder());
|
||||
} else if ((controller.vacationResponse.value?.vacationResponderIsWaiting == true
|
||||
|| controller.vacationResponse.value?.vacationResponderIsStopped == true)
|
||||
&& controller.accountMenuItemSelected.value == AccountMenuItem.vacation) {
|
||||
return VacationNotificationMessageWidget(
|
||||
margin: const EdgeInsets.only(
|
||||
top: 16,
|
||||
left: BuildUtils.isWeb ? 24 : 16,
|
||||
right: BuildUtils.isWeb ? 24 : 16),
|
||||
fromAccountDashBoard: true,
|
||||
vacationResponse: controller.vacationResponse.value!,
|
||||
padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 16),
|
||||
leadingIcon: const Padding(
|
||||
padding: EdgeInsets.only(right: 16),
|
||||
child: Icon(Icons.timer, size: 20),
|
||||
));
|
||||
} else {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
}),
|
||||
Expanded(child: _viewDisplayedOfAccountMenuItem())
|
||||
]),
|
||||
))
|
||||
],
|
||||
))
|
||||
]),
|
||||
mobile: SettingsView(closeAction: () => controller.backToMailboxDashBoard(context))
|
||||
),
|
||||
),
|
||||
),
|
||||
if(controller.emailsForwardCreatorIsActive.isTrue)
|
||||
EmailsForwardCreatorView(),
|
||||
]
|
||||
));
|
||||
))
|
||||
],
|
||||
))
|
||||
]),
|
||||
mobile: SettingsView(closeAction: () => controller.backToMailboxDashBoard(context))
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildRightHeader(BuildContext context) {
|
||||
|
||||
@@ -97,7 +97,7 @@ class RuleFilterCreatorView extends GetWidget<RulesFilterCreatorController> {
|
||||
backgroundColor: Colors.black.withAlpha(24),
|
||||
body: GestureDetector(
|
||||
onTap: () => FocusScope.of(context).unfocus(),
|
||||
child: Align(alignment: Alignment.center, child: Card(
|
||||
child: Center(child: Card(
|
||||
color: Colors.transparent,
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.all(Radius.circular(16))),
|
||||
|
||||
@@ -35,33 +35,52 @@ class AppPages {
|
||||
GetPage(
|
||||
name: AppRoutes.composer,
|
||||
opaque: false,
|
||||
page: () => DeferredWidget(composer.loadLibrary, () => composer.ComposerView()),
|
||||
page: () => DeferredWidget(
|
||||
composer.loadLibrary,
|
||||
() => composer.ComposerView()),
|
||||
binding: ComposerBindings()),
|
||||
GetPage(
|
||||
name: AppRoutes.destinationPicker,
|
||||
opaque: false,
|
||||
page: () => DeferredWidget(destination_picker.loadLibrary, () => destination_picker.DestinationPickerView()),
|
||||
page: () => DeferredWidget(
|
||||
destination_picker.loadLibrary,
|
||||
() => destination_picker.DestinationPickerView()),
|
||||
binding: DestinationPickerBindings()),
|
||||
GetPage(
|
||||
name: AppRoutes.mailboxCreator,
|
||||
opaque: false,
|
||||
page: () => DeferredWidget(mailbox_creator.loadLibrary, () => mailbox_creator.MailboxCreatorView()),
|
||||
page: () => DeferredWidget(
|
||||
mailbox_creator.loadLibrary,
|
||||
() => mailbox_creator.MailboxCreatorView()),
|
||||
binding: MailboxCreatorBindings()),
|
||||
GetPage(
|
||||
name: AppRoutes.contact,
|
||||
opaque: false,
|
||||
page: () => DeferredWidget(contact_view.loadLibrary, () => contact_view.ContactView()),
|
||||
page: () => DeferredWidget(
|
||||
contact_view.loadLibrary,
|
||||
() => contact_view.ContactView()),
|
||||
binding: ContactBindings()),
|
||||
GetPage(
|
||||
name: AppRoutes.identityCreator,
|
||||
opaque: false,
|
||||
page: () => DeferredWidget(identity_creator.loadLibrary, () => identity_creator.IdentityCreatorView()),
|
||||
page: () => DeferredWidget(
|
||||
identity_creator.loadLibrary,
|
||||
() => identity_creator.IdentityCreatorView()),
|
||||
binding: IdentityCreatorBindings()),
|
||||
GetPage(
|
||||
name: AppRoutes.rulesFilterCreator,
|
||||
opaque: false,
|
||||
page: () => DeferredWidget(rules_filter_creator.loadLibrary, () => rules_filter_creator.RuleFilterCreatorView()),
|
||||
page: () => DeferredWidget(
|
||||
rules_filter_creator.loadLibrary,
|
||||
() => rules_filter_creator.RuleFilterCreatorView()),
|
||||
binding: RulesFilterCreatorBindings()),
|
||||
GetPage(
|
||||
name: AppRoutes.emailsForwardCreator,
|
||||
opaque: false,
|
||||
page: () => DeferredWidget(
|
||||
emails_forward_creator.loadLibrary,
|
||||
() => emails_forward_creator.EmailsForwardCreatorView()),
|
||||
binding: EmailsForwardCreatorBindings()),
|
||||
];
|
||||
|
||||
static final pages = [
|
||||
@@ -79,19 +98,16 @@ class AppPages {
|
||||
binding: SessionPageBindings()),
|
||||
GetPage(
|
||||
name: AppRoutes.dashboard,
|
||||
page: () => DeferredWidget(mailbox_dashboard.loadLibrary, () => mailbox_dashboard.MailboxDashBoardView()),
|
||||
page: () => DeferredWidget(
|
||||
mailbox_dashboard.loadLibrary,
|
||||
() => mailbox_dashboard.MailboxDashBoardView()),
|
||||
binding: MailboxDashBoardBindings()),
|
||||
GetPage(
|
||||
name: AppRoutes.settings,
|
||||
page: () => DeferredWidget(manage_account_dashboard.loadLibrary,
|
||||
page: () => DeferredWidget(
|
||||
manage_account_dashboard.loadLibrary,
|
||||
() => manage_account_dashboard.ManageAccountDashBoardView()),
|
||||
binding: ManageAccountDashBoardBindings()),
|
||||
GetPage(
|
||||
name: AppRoutes.emailsForwardCreator,
|
||||
opaque: false,
|
||||
page: () => DeferredWidget(emails_forward_creator.loadLibrary,
|
||||
() => emails_forward_creator.EmailsForwardCreatorView()),
|
||||
binding: EmailsForwardCreatorBindings()),
|
||||
if (!BuildUtils.isWeb)
|
||||
...pagesOnlyOnMobile
|
||||
];
|
||||
|
||||
@@ -4,12 +4,11 @@ abstract class AppRoutes {
|
||||
static const session = '/session';
|
||||
static const dashboard = '/dashboard';
|
||||
static const settings = '/settings';
|
||||
|
||||
static const composer = '/composer';
|
||||
static const destinationPicker = '/destination_picker';
|
||||
static const mailboxCreator = '/mailbox_creator';
|
||||
static const contact = '/contact';
|
||||
static const identityCreator = '/identity_creator';
|
||||
static const rulesFilterCreator = '/rules_filter_creator';
|
||||
static const emailsForwardCreator = '$settings/emails_forward_creator';
|
||||
static const emailsForwardCreator = '/emails_forward_creator';
|
||||
}
|
||||
Reference in New Issue
Block a user