TF-1074 Handle go to path /identity_creator
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
|
|
||||||
|
import 'package:core/utils/app_logger.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:jmap_dart_client/jmap/mail/email/email_address.dart';
|
import 'package:jmap_dart_client/jmap/mail/email/email_address.dart';
|
||||||
import 'package:model/mailbox/presentation_mailbox.dart';
|
import 'package:model/mailbox/presentation_mailbox.dart';
|
||||||
@@ -8,6 +9,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_bindings.dart';
|
||||||
import 'package:tmail_ui_user/features/destination_picker/presentation/destination_picker_view.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/destination_picker/presentation/model/destination_picker_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';
|
||||||
import 'package:tmail_ui_user/features/mailbox_creator/presentation/mailbox_creator_bindings.dart';
|
import 'package:tmail_ui_user/features/mailbox_creator/presentation/mailbox_creator_bindings.dart';
|
||||||
import 'package:tmail_ui_user/features/mailbox_creator/presentation/mailbox_creator_view.dart';
|
import 'package:tmail_ui_user/features/mailbox_creator/presentation/mailbox_creator_view.dart';
|
||||||
import 'package:tmail_ui_user/features/mailbox_creator/presentation/model/mailbox_creator_arguments.dart';
|
import 'package:tmail_ui_user/features/mailbox_creator/presentation/model/mailbox_creator_arguments.dart';
|
||||||
@@ -103,4 +107,33 @@ mixin ViewAsDialogActionMixin {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void showDialogIdentityCreator({
|
||||||
|
required BuildContext context,
|
||||||
|
required IdentityCreatorArguments arguments,
|
||||||
|
required Function(dynamic) onCreatedIdentity
|
||||||
|
}) {
|
||||||
|
log('ViewAsDialogActionMixin::showDialogIdentityCreator(): ');
|
||||||
|
IdentityCreatorBindings().dependencies();
|
||||||
|
|
||||||
|
showGeneralDialog(
|
||||||
|
context: context,
|
||||||
|
barrierDismissible: true,
|
||||||
|
barrierLabel: '',
|
||||||
|
barrierColor: Colors.black.withAlpha(24),
|
||||||
|
pageBuilder: (context, animation, secondaryAnimation) {
|
||||||
|
return IdentityCreatorView.fromArguments(
|
||||||
|
arguments,
|
||||||
|
onDismissCallback: () {
|
||||||
|
IdentityCreatorBindings().dispose();
|
||||||
|
popBack();
|
||||||
|
},
|
||||||
|
onCreatedIdentityCallback: (args) {
|
||||||
|
IdentityCreatorBindings().dispose();
|
||||||
|
popBack();
|
||||||
|
|
||||||
|
onCreatedIdentity.call(args);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -36,7 +36,6 @@ class ContactView extends GetWidget<ContactController> {
|
|||||||
controller.arguments = arguments;
|
controller.arguments = arguments;
|
||||||
controller.onSelectedContactCallback = onSelectedContactCallback;
|
controller.onSelectedContactCallback = onSelectedContactCallback;
|
||||||
controller.onDismissContactView = onDismissCallback;
|
controller.onDismissContactView = onDismissCallback;
|
||||||
controller.onInit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
@@ -51,7 +51,6 @@ class DestinationPickerView extends GetWidget<DestinationPickerController>
|
|||||||
controller.arguments = arguments;
|
controller.arguments = arguments;
|
||||||
controller.onSelectedMailboxCallback = onSelectedMailboxCallback;
|
controller.onSelectedMailboxCallback = onSelectedMailboxCallback;
|
||||||
controller.onDismissDestinationPicker = onDismissCallback;
|
controller.onDismissDestinationPicker = onDismissCallback;
|
||||||
controller.onInit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
@@ -16,4 +16,8 @@ class IdentityCreatorBindings extends Bindings {
|
|||||||
Get.find<GetAllIdentitiesInteractor>(),
|
Get.find<GetAllIdentitiesInteractor>(),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void dispose() {
|
||||||
|
Get.delete<IdentityCreatorController>();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
|
|
||||||
import 'package:core/core.dart';
|
import 'package:core/utils/app_logger.dart';
|
||||||
|
import 'package:core/utils/build_utils.dart';
|
||||||
import 'package:enough_html_editor/enough_html_editor.dart';
|
import 'package:enough_html_editor/enough_html_editor.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/foundation.dart';
|
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:html_editor_enhanced/html_editor.dart';
|
import 'package:html_editor_enhanced/html_editor.dart';
|
||||||
import 'package:jmap_dart_client/jmap/account_id.dart';
|
import 'package:jmap_dart_client/jmap/account_id.dart';
|
||||||
@@ -10,9 +10,12 @@ import 'package:jmap_dart_client/jmap/core/id.dart';
|
|||||||
import 'package:jmap_dart_client/jmap/core/properties/properties.dart';
|
import 'package:jmap_dart_client/jmap/core/properties/properties.dart';
|
||||||
import 'package:jmap_dart_client/jmap/identities/identity.dart';
|
import 'package:jmap_dart_client/jmap/identities/identity.dart';
|
||||||
import 'package:jmap_dart_client/jmap/mail/email/email_address.dart';
|
import 'package:jmap_dart_client/jmap/mail/email/email_address.dart';
|
||||||
import 'package:model/model.dart';
|
import 'package:model/extensions/email_address_extension.dart';
|
||||||
|
import 'package:model/extensions/identity_extension.dart';
|
||||||
|
import 'package:model/user/user_profile.dart';
|
||||||
import 'package:rich_text_composer/richtext_controller.dart';
|
import 'package:rich_text_composer/richtext_controller.dart';
|
||||||
import 'package:tmail_ui_user/features/base/base_controller.dart';
|
import 'package:tmail_ui_user/features/base/base_controller.dart';
|
||||||
|
import 'package:tmail_ui_user/features/identity_creator/presentation/model/identity_creator_arguments.dart';
|
||||||
import 'package:tmail_ui_user/features/identity_creator/presentation/model/signature_type.dart';
|
import 'package:tmail_ui_user/features/identity_creator/presentation/model/signature_type.dart';
|
||||||
import 'package:tmail_ui_user/features/mailbox_creator/domain/model/verification/email_address_validator.dart';
|
import 'package:tmail_ui_user/features/mailbox_creator/domain/model/verification/email_address_validator.dart';
|
||||||
import 'package:tmail_ui_user/features/mailbox_creator/domain/model/verification/empty_name_validator.dart';
|
import 'package:tmail_ui_user/features/mailbox_creator/domain/model/verification/empty_name_validator.dart';
|
||||||
@@ -23,17 +26,19 @@ import 'package:tmail_ui_user/features/manage_account/domain/model/create_new_id
|
|||||||
import 'package:tmail_ui_user/features/manage_account/domain/model/edit_identity_request.dart';
|
import 'package:tmail_ui_user/features/manage_account/domain/model/edit_identity_request.dart';
|
||||||
import 'package:tmail_ui_user/features/manage_account/domain/state/get_all_identities_state.dart';
|
import 'package:tmail_ui_user/features/manage_account/domain/state/get_all_identities_state.dart';
|
||||||
import 'package:tmail_ui_user/features/manage_account/domain/usecases/get_all_identities_interactor.dart';
|
import 'package:tmail_ui_user/features/manage_account/domain/usecases/get_all_identities_interactor.dart';
|
||||||
import 'package:tmail_ui_user/features/manage_account/presentation/manage_account_dashboard_controller.dart';
|
|
||||||
import 'package:tmail_ui_user/features/manage_account/presentation/model/identity_action_type.dart';
|
import 'package:tmail_ui_user/features/manage_account/presentation/model/identity_action_type.dart';
|
||||||
import 'package:tmail_ui_user/features/manage_account/presentation/profiles/identities/identities_controller.dart';
|
|
||||||
import 'package:tmail_ui_user/main/routes/route_navigation.dart';
|
import 'package:tmail_ui_user/main/routes/route_navigation.dart';
|
||||||
import 'package:uuid/uuid.dart';
|
import 'package:uuid/uuid.dart';
|
||||||
|
|
||||||
|
typedef OnCreatedIdentityCallback = Function(dynamic arguments);
|
||||||
|
|
||||||
class IdentityCreatorController extends BaseController {
|
class IdentityCreatorController extends BaseController {
|
||||||
|
|
||||||
final VerifyNameInteractor _verifyNameInteractor;
|
final VerifyNameInteractor _verifyNameInteractor;
|
||||||
final GetAllIdentitiesInteractor _getAllIdentitiesInteractor;
|
final GetAllIdentitiesInteractor _getAllIdentitiesInteractor;
|
||||||
|
|
||||||
|
final _uuid = Get.find<Uuid>();
|
||||||
|
|
||||||
final noneEmailAddress = EmailAddress(null, 'None');
|
final noneEmailAddress = EmailAddress(null, 'None');
|
||||||
final signatureType = SignatureType.plainText.obs;
|
final signatureType = SignatureType.plainText.obs;
|
||||||
final listEmailAddressDefault = <EmailAddress>[].obs;
|
final listEmailAddressDefault = <EmailAddress>[].obs;
|
||||||
@@ -43,29 +48,26 @@ class IdentityCreatorController extends BaseController {
|
|||||||
final emailOfIdentity = Rxn<EmailAddress>();
|
final emailOfIdentity = Rxn<EmailAddress>();
|
||||||
final replyToOfIdentity = Rxn<EmailAddress>();
|
final replyToOfIdentity = Rxn<EmailAddress>();
|
||||||
final bccOfIdentity = Rxn<EmailAddress>();
|
final bccOfIdentity = Rxn<EmailAddress>();
|
||||||
final _uuid = Get.find<Uuid>();
|
final actionType = IdentityActionType.create.obs;
|
||||||
final _identitiesController = Get.find<IdentitiesController>();
|
|
||||||
final _accountDashBoardController = Get.find<ManageAccountDashBoardController>();
|
|
||||||
|
|
||||||
final RichTextController keyboardRichTextController = RichTextController();
|
late RichTextController keyboardRichTextController;
|
||||||
|
late HtmlEditorController signatureHtmlEditorController;
|
||||||
final HtmlEditorController signatureHtmlEditorController = HtmlEditorController(processNewLineAsBr: true);
|
TextEditingController? signaturePlainEditorController;
|
||||||
final TextEditingController signaturePlainEditorController = TextEditingController();
|
TextEditingController? inputNameIdentityController;
|
||||||
final TextEditingController inputNameIdentityController = TextEditingController();
|
TextEditingController? inputBccIdentityController;
|
||||||
final TextEditingController inputBccIdentityController = TextEditingController();
|
FocusNode? inputNameIdentityFocusNode;
|
||||||
final FocusNode inputNameIdentityFocusNode = FocusNode();
|
|
||||||
|
|
||||||
late Worker identityCreatorIsActiveWorker;
|
|
||||||
|
|
||||||
HtmlEditorApi? signatureHtmlEditorMobileController;
|
HtmlEditorApi? signatureHtmlEditorMobileController;
|
||||||
AccountId? get accountId => _identitiesController.identityCreatorArguments.value!.accountId;
|
|
||||||
UserProfile? get userProfile => _identitiesController.identityCreatorArguments.value!.userProfile;
|
|
||||||
Identity? get identity => _identitiesController.identityCreatorArguments.value!.identity;
|
|
||||||
IdentityActionType get actionType => _identitiesController.identityCreatorArguments.value!.actionType;
|
|
||||||
String? _nameIdentity;
|
String? _nameIdentity;
|
||||||
String? _contentHtmlEditor;
|
String? _contentHtmlEditor;
|
||||||
|
AccountId? accountId;
|
||||||
|
UserProfile? userProfile;
|
||||||
|
Identity? identity;
|
||||||
|
IdentityCreatorArguments? arguments;
|
||||||
|
OnCreatedIdentityCallback? onCreatedIdentityCallback;
|
||||||
|
VoidCallback? onDismissIdentityCreator;
|
||||||
|
ScrollController? scrollController;
|
||||||
|
|
||||||
final ScrollController scrollController = ScrollController();
|
|
||||||
final GlobalKey htmlKey = GlobalKey();
|
final GlobalKey htmlKey = GlobalKey();
|
||||||
|
|
||||||
void updateNameIdentity(BuildContext context, String? value) {
|
void updateNameIdentity(BuildContext context, String? value) {
|
||||||
@@ -83,33 +85,34 @@ class IdentityCreatorController extends BaseController {
|
|||||||
);
|
);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onReady() {
|
void onInit() {
|
||||||
_setUpValueFromIdentity();
|
super.onInit();
|
||||||
_getAllIdentities();
|
keyboardRichTextController = RichTextController();
|
||||||
_initWorker();
|
signatureHtmlEditorController = HtmlEditorController(processNewLineAsBr: true);
|
||||||
super.onReady();
|
signaturePlainEditorController = TextEditingController();
|
||||||
|
inputNameIdentityController = TextEditingController();
|
||||||
|
inputBccIdentityController = TextEditingController();
|
||||||
|
inputNameIdentityFocusNode = FocusNode();
|
||||||
|
scrollController = ScrollController();
|
||||||
}
|
}
|
||||||
|
|
||||||
void _initWorker() {
|
@override
|
||||||
identityCreatorIsActiveWorker = ever(_accountDashBoardController.identityCreatorIsActive, (identityCreatorIsActive) {
|
void onReady() {
|
||||||
if (identityCreatorIsActive == true) {
|
super.onReady();
|
||||||
if (actionType == IdentityActionType.edit && identity != null) {
|
if (arguments != null) {
|
||||||
_setUpValueFromIdentity();
|
accountId = arguments!.accountId;
|
||||||
_setUpAllFieldEmailAddress();
|
userProfile = arguments!.userProfile;
|
||||||
}
|
identity = arguments!.identity;
|
||||||
}
|
actionType.value = arguments!.actionType;
|
||||||
});
|
_setUpValueFromIdentity();
|
||||||
|
_getAllIdentities();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onClose() {
|
void onClose() {
|
||||||
signaturePlainEditorController.dispose();
|
|
||||||
inputNameIdentityFocusNode.dispose();
|
|
||||||
inputNameIdentityController.dispose();
|
|
||||||
inputBccIdentityController.dispose();
|
|
||||||
identityCreatorIsActiveWorker.dispose();
|
|
||||||
keyboardRichTextController.dispose();
|
keyboardRichTextController.dispose();
|
||||||
scrollController.dispose();
|
_disposeWidget();
|
||||||
super.onClose();
|
super.onClose();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -134,10 +137,10 @@ class IdentityCreatorController extends BaseController {
|
|||||||
|
|
||||||
void _setUpValueFromIdentity() {
|
void _setUpValueFromIdentity() {
|
||||||
_nameIdentity = identity?.name ?? '';
|
_nameIdentity = identity?.name ?? '';
|
||||||
inputNameIdentityController.text = identity?.name ?? '';
|
inputNameIdentityController?.text = identity?.name ?? '';
|
||||||
|
|
||||||
if (identity?.textSignature?.value.isNotEmpty == true) {
|
if (identity?.textSignature?.value.isNotEmpty == true) {
|
||||||
signaturePlainEditorController.text = identity?.textSignature?.value ?? '';
|
signaturePlainEditorController?.text = identity?.textSignature?.value ?? '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (identity?.htmlSignature?.value.isNotEmpty == true) {
|
if (identity?.htmlSignature?.value.isNotEmpty == true) {
|
||||||
@@ -147,6 +150,7 @@ class IdentityCreatorController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void _getAllIdentities() {
|
void _getAllIdentities() {
|
||||||
|
log('IdentityCreatorController::_getAllIdentities() ');
|
||||||
if (accountId != null) {
|
if (accountId != null) {
|
||||||
consumeState(_getAllIdentitiesInteractor.execute(
|
consumeState(_getAllIdentitiesInteractor.execute(
|
||||||
accountId!,
|
accountId!,
|
||||||
@@ -164,8 +168,6 @@ class IdentityCreatorController extends BaseController {
|
|||||||
listEmailAddressOfReplyTo.add(noneEmailAddress);
|
listEmailAddressOfReplyTo.add(noneEmailAddress);
|
||||||
listEmailAddressOfReplyTo.addAll(listEmailAddressDefault);
|
listEmailAddressOfReplyTo.addAll(listEmailAddressDefault);
|
||||||
|
|
||||||
log('IdentityCreatorController::_getALlIdentitiesSuccess(): listEmailAddressOfReplyTo: ${listEmailAddressOfReplyTo.toJson()}');
|
|
||||||
|
|
||||||
_setUpAllFieldEmailAddress();
|
_setUpAllFieldEmailAddress();
|
||||||
} else {
|
} else {
|
||||||
_setDefaultEmailAddressList();
|
_setDefaultEmailAddressList();
|
||||||
@@ -189,7 +191,10 @@ class IdentityCreatorController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void _setUpAllFieldEmailAddress() {
|
void _setUpAllFieldEmailAddress() {
|
||||||
if (actionType == IdentityActionType.edit && identity != null) {
|
listEmailAddressOfReplyTo.value = listEmailAddressOfReplyTo.toSet().toList();
|
||||||
|
listEmailAddressDefault.value = listEmailAddressDefault.toSet().toList();
|
||||||
|
|
||||||
|
if (actionType.value == IdentityActionType.edit && identity != null) {
|
||||||
if (identity?.replyTo?.isNotEmpty == true) {
|
if (identity?.replyTo?.isNotEmpty == true) {
|
||||||
try {
|
try {
|
||||||
replyToOfIdentity.value = listEmailAddressOfReplyTo
|
replyToOfIdentity.value = listEmailAddressOfReplyTo
|
||||||
@@ -200,17 +205,14 @@ class IdentityCreatorController extends BaseController {
|
|||||||
} else {
|
} else {
|
||||||
replyToOfIdentity.value = noneEmailAddress;
|
replyToOfIdentity.value = noneEmailAddress;
|
||||||
}
|
}
|
||||||
log('IdentityCreatorController::_setUpAllFieldEmailAddress(): replyToOfIdentity: ${replyToOfIdentity.value}');
|
|
||||||
|
|
||||||
if (identity?.bcc?.isNotEmpty == true) {
|
if (identity?.bcc?.isNotEmpty == true) {
|
||||||
bccOfIdentity.value = identity?.bcc!.first;
|
bccOfIdentity.value = identity?.bcc!.first;
|
||||||
inputBccIdentityController.text = identity?.bcc!.first.emailAddress ?? '';
|
inputBccIdentityController?.text = identity?.bcc!.first.emailAddress ?? '';
|
||||||
} else {
|
} else {
|
||||||
bccOfIdentity.value = null;
|
bccOfIdentity.value = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
log('IdentityCreatorController::_setUpAllFieldEmailAddress(): bccOfIdentity: ${bccOfIdentity.value}');
|
|
||||||
|
|
||||||
if (identity?.email?.isNotEmpty == true) {
|
if (identity?.email?.isNotEmpty == true) {
|
||||||
try {
|
try {
|
||||||
emailOfIdentity.value = listEmailAddressDefault
|
emailOfIdentity.value = listEmailAddressDefault
|
||||||
@@ -235,7 +237,6 @@ class IdentityCreatorController extends BaseController {
|
|||||||
void selectSignatureType(BuildContext context, SignatureType newSignatureType) async {
|
void selectSignatureType(BuildContext context, SignatureType newSignatureType) async {
|
||||||
if (newSignatureType == SignatureType.plainText && !BuildUtils.isWeb) {
|
if (newSignatureType == SignatureType.plainText && !BuildUtils.isWeb) {
|
||||||
final signatureText = await _getSignatureHtmlText();
|
final signatureText = await _getSignatureHtmlText();
|
||||||
log('IdentityCreatorController::selectSignatureType(): signatureText: $signatureText');
|
|
||||||
updateContentHtmlEditor(signatureText);
|
updateContentHtmlEditor(signatureText);
|
||||||
}
|
}
|
||||||
clearFocusEditor(context);
|
clearFocusEditor(context);
|
||||||
@@ -267,19 +268,17 @@ class IdentityCreatorController extends BaseController {
|
|||||||
|
|
||||||
final error = _getErrorInputNameString(context);
|
final error = _getErrorInputNameString(context);
|
||||||
if (error?.isNotEmpty == true) {
|
if (error?.isNotEmpty == true) {
|
||||||
log('IdentityCreatorController::createNewIdentity(): error: $error');
|
|
||||||
errorNameIdentity.value = error;
|
errorNameIdentity.value = error;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final errorBcc = _getErrorInputAddressString(context);
|
final errorBcc = _getErrorInputAddressString(context);
|
||||||
if (errorBcc?.isNotEmpty == true) {
|
if (errorBcc?.isNotEmpty == true) {
|
||||||
log('IdentityCreatorController::createNewIdentity(): errorBcc: $errorBcc');
|
|
||||||
errorBccIdentity.value = errorBcc;
|
errorBccIdentity.value = errorBcc;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final signaturePlainText = signaturePlainEditorController.text;
|
final signaturePlainText = signaturePlainEditorController?.text ?? '';
|
||||||
final signatureHtmlText = BuildUtils.isWeb
|
final signatureHtmlText = BuildUtils.isWeb
|
||||||
? contentHtmlEditor
|
? contentHtmlEditor
|
||||||
: await _getSignatureHtmlText();
|
: await _getSignatureHtmlText();
|
||||||
@@ -290,11 +289,6 @@ class IdentityCreatorController extends BaseController {
|
|||||||
? {replyToOfIdentity.value!}
|
? {replyToOfIdentity.value!}
|
||||||
: <EmailAddress>{};
|
: <EmailAddress>{};
|
||||||
|
|
||||||
log('IdentityCreatorController::createNewIdentity(): bccAddress: $bccAddress');
|
|
||||||
log('IdentityCreatorController::createNewIdentity(): replyToAddress: $replyToAddress');
|
|
||||||
log('IdentityCreatorController::createNewIdentity(): signaturePlainText: $signaturePlainText');
|
|
||||||
log('IdentityCreatorController::createNewIdentity(): signatureHtmlText: $signatureHtmlText');
|
|
||||||
|
|
||||||
final newIdentity = Identity(
|
final newIdentity = Identity(
|
||||||
name: _nameIdentity,
|
name: _nameIdentity,
|
||||||
email: emailOfIdentity.value?.email,
|
email: emailOfIdentity.value?.email,
|
||||||
@@ -303,29 +297,29 @@ class IdentityCreatorController extends BaseController {
|
|||||||
textSignature: Signature(signaturePlainText),
|
textSignature: Signature(signaturePlainText),
|
||||||
htmlSignature: Signature(signatureHtmlText ?? ''));
|
htmlSignature: Signature(signatureHtmlText ?? ''));
|
||||||
|
|
||||||
log('IdentityCreatorController::createNewIdentity(): $newIdentity');
|
|
||||||
|
|
||||||
final generateCreateId = Id(_uuid.v1());
|
final generateCreateId = Id(_uuid.v1());
|
||||||
|
|
||||||
if(actionType == IdentityActionType.create) {
|
if (actionType.value == IdentityActionType.create) {
|
||||||
_identitiesController.createNewIdentityAction(
|
final identityRequest = CreateNewIdentityRequest(generateCreateId, newIdentity);
|
||||||
accountId!,
|
|
||||||
CreateNewIdentityRequest(generateCreateId, newIdentity),
|
if (BuildUtils.isWeb) {
|
||||||
);
|
_disposeWidget();
|
||||||
} else {
|
onCreatedIdentityCallback?.call(identityRequest);
|
||||||
_identitiesController.editIdentityAction(
|
} else {
|
||||||
accountId!,
|
popBack(result: identityRequest);
|
||||||
EditIdentityRequest(
|
}
|
||||||
identityId: identity!.id!,
|
|
||||||
identityRequest: newIdentity.toIdentityRequest(),
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(kIsWeb) {
|
|
||||||
_accountDashBoardController.identityCreatorIsActive.toggle();
|
|
||||||
} else {
|
} else {
|
||||||
popBack();
|
final identityRequest = EditIdentityRequest(
|
||||||
|
identityId: identity!.id!,
|
||||||
|
identityRequest: newIdentity.toIdentityRequest());
|
||||||
|
|
||||||
|
if (BuildUtils.isWeb) {
|
||||||
|
_disposeWidget();
|
||||||
|
onCreatedIdentityCallback?.call(identityRequest);
|
||||||
|
} else {
|
||||||
|
popBack(result: identityRequest);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -346,7 +340,7 @@ class IdentityCreatorController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String? _getErrorInputAddressString(BuildContext context, {String? value}) {
|
String? _getErrorInputAddressString(BuildContext context, {String? value}) {
|
||||||
final emailAddress = value ?? inputBccIdentityController.text;
|
final emailAddress = value ?? inputBccIdentityController?.text ?? '';
|
||||||
if (emailAddress.trim().isEmpty) {
|
if (emailAddress.trim().isEmpty) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -374,9 +368,9 @@ class IdentityCreatorController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void _clearAll() {
|
void _clearAll() {
|
||||||
signaturePlainEditorController.clear();
|
signaturePlainEditorController?.clear();
|
||||||
inputNameIdentityController.clear();
|
inputNameIdentityController?.clear();
|
||||||
inputBccIdentityController.clear();
|
inputBccIdentityController?.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
List<EmailAddress> getSuggestionEmailAddress(String? pattern) {
|
List<EmailAddress> getSuggestionEmailAddress(String? pattern) {
|
||||||
@@ -398,28 +392,46 @@ class IdentityCreatorController extends BaseController {
|
|||||||
void closeView(BuildContext context) {
|
void closeView(BuildContext context) {
|
||||||
_clearAll();
|
_clearAll();
|
||||||
clearFocusEditor(context);
|
clearFocusEditor(context);
|
||||||
if(kIsWeb) {
|
|
||||||
_accountDashBoardController.identityCreatorIsActive.toggle();
|
if (BuildUtils.isWeb) {
|
||||||
|
_disposeWidget();
|
||||||
|
onDismissIdentityCreator?.call();
|
||||||
} else {
|
} else {
|
||||||
popBack();
|
popBack();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _disposeWidget() {
|
||||||
|
signaturePlainEditorController?.dispose();
|
||||||
|
signaturePlainEditorController = null;
|
||||||
|
inputNameIdentityFocusNode?.dispose();
|
||||||
|
inputNameIdentityFocusNode = null;
|
||||||
|
inputNameIdentityController?.dispose();
|
||||||
|
inputNameIdentityController = null;
|
||||||
|
inputBccIdentityController?.dispose();
|
||||||
|
inputBccIdentityController = null;
|
||||||
|
scrollController?.dispose();
|
||||||
|
scrollController = null;
|
||||||
|
}
|
||||||
|
|
||||||
void onFocusHTMLEditor() async {
|
void onFocusHTMLEditor() async {
|
||||||
await Scrollable.ensureVisible(htmlKey.currentContext!);
|
await Scrollable.ensureVisible(htmlKey.currentContext!);
|
||||||
await Future.delayed(const Duration(milliseconds: 500), () {
|
await Future.delayed(const Duration(milliseconds: 500), () {
|
||||||
scrollController.animateTo(
|
if (scrollController != null) {
|
||||||
scrollController.position.pixels + defaultKeyboardToolbarHeight,
|
scrollController!.animateTo(
|
||||||
duration: const Duration(milliseconds: 1),
|
scrollController!.position.pixels + defaultKeyboardToolbarHeight,
|
||||||
curve: Curves.linear,
|
duration: const Duration(milliseconds: 1),
|
||||||
);
|
curve: Curves.linear,
|
||||||
|
);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void onEnterKeyDown() {
|
void onEnterKeyDown() {
|
||||||
if(scrollController.position.pixels < scrollController.position.maxScrollExtent) {
|
if(scrollController != null &&
|
||||||
scrollController.animateTo(
|
scrollController!.position.pixels < scrollController!.position.maxScrollExtent) {
|
||||||
scrollController.position.pixels + 20,
|
scrollController!.animateTo(
|
||||||
|
scrollController!.position.pixels + 20,
|
||||||
duration: const Duration(milliseconds: 1),
|
duration: const Duration(milliseconds: 1),
|
||||||
curve: Curves.linear,
|
curve: Curves.linear,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import 'package:jmap_dart_client/jmap/mail/email/email_address.dart';
|
|||||||
import 'package:rich_text_composer/views/keyboard_richtext.dart';
|
import 'package:rich_text_composer/views/keyboard_richtext.dart';
|
||||||
import 'package:rich_text_composer/views/widgets/rich_text_keyboard_toolbar.dart';
|
import 'package:rich_text_composer/views/widgets/rich_text_keyboard_toolbar.dart';
|
||||||
import 'package:tmail_ui_user/features/identity_creator/presentation/identity_creator_controller.dart';
|
import 'package:tmail_ui_user/features/identity_creator/presentation/identity_creator_controller.dart';
|
||||||
|
import 'package:tmail_ui_user/features/identity_creator/presentation/model/identity_creator_arguments.dart';
|
||||||
import 'package:tmail_ui_user/features/identity_creator/presentation/model/signature_type.dart';
|
import 'package:tmail_ui_user/features/identity_creator/presentation/model/signature_type.dart';
|
||||||
import 'package:tmail_ui_user/features/identity_creator/presentation/widgets/identity_drop_list_field_builder.dart';
|
import 'package:tmail_ui_user/features/identity_creator/presentation/widgets/identity_drop_list_field_builder.dart';
|
||||||
import 'package:tmail_ui_user/features/identity_creator/presentation/widgets/identity_field_no_editable_builder.dart';
|
import 'package:tmail_ui_user/features/identity_creator/presentation/widgets/identity_field_no_editable_builder.dart';
|
||||||
@@ -21,7 +22,23 @@ class IdentityCreatorView extends GetWidget<IdentityCreatorController> {
|
|||||||
final _imagePaths = Get.find<ImagePaths>();
|
final _imagePaths = Get.find<ImagePaths>();
|
||||||
final _responsiveUtils = Get.find<ResponsiveUtils>();
|
final _responsiveUtils = Get.find<ResponsiveUtils>();
|
||||||
|
|
||||||
IdentityCreatorView({Key? key}) : super(key: key);
|
@override
|
||||||
|
final controller = Get.find<IdentityCreatorController>();
|
||||||
|
|
||||||
|
IdentityCreatorView({Key? key}) : super(key: key) {
|
||||||
|
controller.arguments = Get.arguments;
|
||||||
|
}
|
||||||
|
|
||||||
|
IdentityCreatorView.fromArguments(
|
||||||
|
IdentityCreatorArguments arguments, {
|
||||||
|
Key? key,
|
||||||
|
OnCreatedIdentityCallback? onCreatedIdentityCallback,
|
||||||
|
VoidCallback? onDismissCallback
|
||||||
|
}) : super(key: key) {
|
||||||
|
controller.arguments = arguments;
|
||||||
|
controller.onCreatedIdentityCallback = onCreatedIdentityCallback;
|
||||||
|
controller.onDismissIdentityCreator = onDismissCallback;
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@@ -52,7 +69,7 @@ class IdentityCreatorView extends GetWidget<IdentityCreatorController> {
|
|||||||
)
|
)
|
||||||
),
|
),
|
||||||
tablet: Scaffold(
|
tablet: Scaffold(
|
||||||
backgroundColor: Colors.black38,
|
backgroundColor: Colors.black.withAlpha(24),
|
||||||
body: GestureDetector(
|
body: GestureDetector(
|
||||||
onTap: () => controller.clearFocusEditor(context),
|
onTap: () => controller.clearFocusEditor(context),
|
||||||
child: KeyboardRichText(
|
child: KeyboardRichText(
|
||||||
@@ -66,7 +83,7 @@ class IdentityCreatorView extends GetWidget<IdentityCreatorController> {
|
|||||||
titleFormatBottomSheet: AppLocalizations.of(context).titleFormat,
|
titleFormatBottomSheet: AppLocalizations.of(context).titleFormat,
|
||||||
titleBack: AppLocalizations.of(context).format,
|
titleBack: AppLocalizations.of(context).format,
|
||||||
),
|
),
|
||||||
child: Align(alignment: Alignment.center, child: Card(
|
child: Center(child: Card(
|
||||||
color: Colors.transparent,
|
color: Colors.transparent,
|
||||||
shape: const RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(16))),
|
shape: const RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(16))),
|
||||||
child: Container(
|
child: Container(
|
||||||
@@ -85,7 +102,7 @@ class IdentityCreatorView extends GetWidget<IdentityCreatorController> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
tabletLarge: Scaffold(
|
tabletLarge: Scaffold(
|
||||||
backgroundColor: Colors.black38,
|
backgroundColor: Colors.black.withAlpha(24),
|
||||||
body: GestureDetector(
|
body: GestureDetector(
|
||||||
onTap: () => controller.clearFocusEditor(context),
|
onTap: () => controller.clearFocusEditor(context),
|
||||||
child: KeyboardRichText(
|
child: KeyboardRichText(
|
||||||
@@ -99,7 +116,7 @@ class IdentityCreatorView extends GetWidget<IdentityCreatorController> {
|
|||||||
titleFormatBottomSheet: AppLocalizations.of(context).titleFormat,
|
titleFormatBottomSheet: AppLocalizations.of(context).titleFormat,
|
||||||
titleBack: AppLocalizations.of(context).format,
|
titleBack: AppLocalizations.of(context).format,
|
||||||
),
|
),
|
||||||
child: Align(alignment: Alignment.center, child: Card(
|
child: Center(child: Card(
|
||||||
color: Colors.transparent,
|
color: Colors.transparent,
|
||||||
shape: const RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(16))),
|
shape: const RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(16))),
|
||||||
child: Container(
|
child: Container(
|
||||||
@@ -118,10 +135,10 @@ class IdentityCreatorView extends GetWidget<IdentityCreatorController> {
|
|||||||
)
|
)
|
||||||
),
|
),
|
||||||
desktop: Scaffold(
|
desktop: Scaffold(
|
||||||
backgroundColor: Colors.black38,
|
backgroundColor: Colors.black.withAlpha(24),
|
||||||
body: GestureDetector(
|
body: GestureDetector(
|
||||||
onTap: () => controller.clearFocusEditor(context),
|
onTap: () => controller.clearFocusEditor(context),
|
||||||
child: Align(alignment: Alignment.center, child: Card(
|
child: Center(child: Card(
|
||||||
color: Colors.transparent,
|
color: Colors.transparent,
|
||||||
shape: const RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(16))),
|
shape: const RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(16))),
|
||||||
child: Container(
|
child: Container(
|
||||||
@@ -135,8 +152,7 @@ class IdentityCreatorView extends GetWidget<IdentityCreatorController> {
|
|||||||
child: _buildBodyDesktop(context)
|
child: _buildBodyDesktop(context)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)),
|
||||||
),
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@@ -148,7 +164,7 @@ class IdentityCreatorView extends GetWidget<IdentityCreatorController> {
|
|||||||
Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(left: 24, top: 24),
|
padding: const EdgeInsets.only(left: 24, top: 24),
|
||||||
child: Obx(() => Text(controller.actionType == IdentityActionType.create
|
child: Obx(() => Text(controller.actionType.value == IdentityActionType.create
|
||||||
? AppLocalizations.of(context).new_identity.inCaps
|
? AppLocalizations.of(context).new_identity.inCaps
|
||||||
: AppLocalizations.of(context).edit_identity.inCaps,
|
: AppLocalizations.of(context).edit_identity.inCaps,
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
@@ -173,7 +189,7 @@ class IdentityCreatorView extends GetWidget<IdentityCreatorController> {
|
|||||||
.build())),
|
.build())),
|
||||||
const SizedBox(width: 24),
|
const SizedBox(width: 24),
|
||||||
Expanded(child: Obx(() {
|
Expanded(child: Obx(() {
|
||||||
if (controller.actionType == IdentityActionType.create) {
|
if (controller.actionType.value == IdentityActionType.create) {
|
||||||
return (IdentityDropListFieldBuilder(
|
return (IdentityDropListFieldBuilder(
|
||||||
_imagePaths,
|
_imagePaths,
|
||||||
AppLocalizations.of(context).email.inCaps,
|
AppLocalizations.of(context).email.inCaps,
|
||||||
@@ -206,7 +222,7 @@ class IdentityCreatorView extends GetWidget<IdentityCreatorController> {
|
|||||||
controller.errorBccIdentity.value,
|
controller.errorBccIdentity.value,
|
||||||
controller.inputBccIdentityController)
|
controller.inputBccIdentityController)
|
||||||
..addOnSelectedSuggestionAction((newEmailAddress) {
|
..addOnSelectedSuggestionAction((newEmailAddress) {
|
||||||
controller.inputBccIdentityController.text = newEmailAddress?.email ?? '';
|
controller.inputBccIdentityController?.text = newEmailAddress?.email ?? '';
|
||||||
controller.updateBccOfIdentity(newEmailAddress);
|
controller.updateBccOfIdentity(newEmailAddress);
|
||||||
})
|
})
|
||||||
..addOnChangeInputSuggestionAction((pattern) {
|
..addOnChangeInputSuggestionAction((pattern) {
|
||||||
@@ -273,7 +289,7 @@ class IdentityCreatorView extends GetWidget<IdentityCreatorController> {
|
|||||||
onTap: () => controller.closeView(context)),
|
onTap: () => controller.closeView(context)),
|
||||||
const SizedBox(width: 12),
|
const SizedBox(width: 12),
|
||||||
Obx(() => buildTextButton(
|
Obx(() => buildTextButton(
|
||||||
controller.actionType == IdentityActionType.create
|
controller.actionType.value == IdentityActionType.create
|
||||||
? AppLocalizations.of(context).create
|
? AppLocalizations.of(context).create
|
||||||
: AppLocalizations.of(context).save,
|
: AppLocalizations.of(context).save,
|
||||||
width: 128,
|
width: 128,
|
||||||
@@ -299,7 +315,7 @@ class IdentityCreatorView extends GetWidget<IdentityCreatorController> {
|
|||||||
Column(children: [
|
Column(children: [
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(top: 16),
|
padding: const EdgeInsets.only(top: 16),
|
||||||
child: Text(controller.actionType == IdentityActionType.create
|
child: Text(controller.actionType.value == IdentityActionType.create
|
||||||
? AppLocalizations.of(context).new_identity.inCaps
|
? AppLocalizations.of(context).new_identity.inCaps
|
||||||
: AppLocalizations.of(context).edit_identity.inCaps,
|
: AppLocalizations.of(context).edit_identity.inCaps,
|
||||||
style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 21, color: Colors.black))),
|
style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 21, color: Colors.black))),
|
||||||
@@ -321,7 +337,7 @@ class IdentityCreatorView extends GetWidget<IdentityCreatorController> {
|
|||||||
.build()),
|
.build()),
|
||||||
const SizedBox(height: 24),
|
const SizedBox(height: 24),
|
||||||
Obx(() {
|
Obx(() {
|
||||||
if (controller.actionType == IdentityActionType.create) {
|
if (controller.actionType.value == IdentityActionType.create) {
|
||||||
return (IdentityDropListFieldBuilder(
|
return (IdentityDropListFieldBuilder(
|
||||||
_imagePaths,
|
_imagePaths,
|
||||||
AppLocalizations.of(context).email.inCaps,
|
AppLocalizations.of(context).email.inCaps,
|
||||||
@@ -352,7 +368,7 @@ class IdentityCreatorView extends GetWidget<IdentityCreatorController> {
|
|||||||
controller.errorBccIdentity.value,
|
controller.errorBccIdentity.value,
|
||||||
controller.inputBccIdentityController)
|
controller.inputBccIdentityController)
|
||||||
..addOnSelectedSuggestionAction((newEmailAddress) {
|
..addOnSelectedSuggestionAction((newEmailAddress) {
|
||||||
controller.inputBccIdentityController.text = newEmailAddress?.email ?? '';
|
controller.inputBccIdentityController?.text = newEmailAddress?.email ?? '';
|
||||||
controller.updateBccOfIdentity(newEmailAddress);
|
controller.updateBccOfIdentity(newEmailAddress);
|
||||||
})
|
})
|
||||||
..addOnChangeInputSuggestionAction((pattern) {
|
..addOnChangeInputSuggestionAction((pattern) {
|
||||||
@@ -422,7 +438,7 @@ class IdentityCreatorView extends GetWidget<IdentityCreatorController> {
|
|||||||
const SizedBox(width: 12),
|
const SizedBox(width: 12),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Obx(() => buildTextButton(
|
child: Obx(() => buildTextButton(
|
||||||
controller.actionType == IdentityActionType.create
|
controller.actionType.value == IdentityActionType.create
|
||||||
? AppLocalizations.of(context).create
|
? AppLocalizations.of(context).create
|
||||||
: AppLocalizations.of(context).save,
|
: AppLocalizations.of(context).save,
|
||||||
width: 128,
|
width: 128,
|
||||||
@@ -459,7 +475,7 @@ class IdentityCreatorView extends GetWidget<IdentityCreatorController> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildSignatureButton(BuildContext context, SignatureType signatureType) {
|
Widget _buildSignatureButton(BuildContext context, SignatureType signatureType) {
|
||||||
return buildTextButton(
|
return buildButtonWrapText(
|
||||||
signatureType.getTitle(context),
|
signatureType.getTitle(context),
|
||||||
textStyle: TextStyle(
|
textStyle: TextStyle(
|
||||||
fontWeight: FontWeight.w500,
|
fontWeight: FontWeight.w500,
|
||||||
@@ -467,10 +483,9 @@ class IdentityCreatorView extends GetWidget<IdentityCreatorController> {
|
|||||||
color: controller.signatureType.value == signatureType
|
color: controller.signatureType.value == signatureType
|
||||||
? AppColor.colorContentEmail
|
? AppColor.colorContentEmail
|
||||||
: AppColor.colorHintSearchBar),
|
: AppColor.colorHintSearchBar),
|
||||||
backgroundColor: controller.signatureType.value == signatureType
|
bgColor: controller.signatureType.value == signatureType
|
||||||
? AppColor.emailAddressChipColor
|
? AppColor.emailAddressChipColor
|
||||||
: Colors.transparent,
|
: Colors.transparent,
|
||||||
width: signatureType == SignatureType.plainText ? 85 : 110,
|
|
||||||
height: 30,
|
height: 30,
|
||||||
radius: 10,
|
radius: 10,
|
||||||
onTap: () => controller.selectSignatureType(context, signatureType));
|
onTap: () => controller.selectSignatureType(context, signatureType));
|
||||||
|
|||||||
+4
-2
@@ -43,7 +43,8 @@ class IdentityDropListFieldBuilder {
|
|||||||
_emailAddressSelected?.email ?? '',
|
_emailAddressSelected?.email ?? '',
|
||||||
style: const TextStyle(fontSize: 16, fontWeight: FontWeight.normal, color: Colors.black),
|
style: const TextStyle(fontSize: 16, fontWeight: FontWeight.normal, color: Colors.black),
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
overflow: BuildUtils.isWeb ? null : TextOverflow.ellipsis,
|
overflow: CommonTextStyle.defaultTextOverFlow,
|
||||||
|
softWrap: CommonTextStyle.defaultSoftWrap,
|
||||||
)),
|
)),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -53,7 +54,8 @@ class IdentityDropListFieldBuilder {
|
|||||||
item.email ?? '',
|
item.email ?? '',
|
||||||
style: const TextStyle(fontSize: 16, fontWeight: FontWeight.normal, color: Colors.black),
|
style: const TextStyle(fontSize: 16, fontWeight: FontWeight.normal, color: Colors.black),
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
overflow: BuildUtils.isWeb ? null : TextOverflow.ellipsis,
|
overflow: CommonTextStyle.defaultTextOverFlow,
|
||||||
|
softWrap: CommonTextStyle.defaultSoftWrap,
|
||||||
),
|
),
|
||||||
)).toList(),
|
)).toList(),
|
||||||
value: _emailAddressSelected,
|
value: _emailAddressSelected,
|
||||||
|
|||||||
+1
-1
@@ -13,7 +13,7 @@ class IdentityInputWithDropListFieldBuilder {
|
|||||||
|
|
||||||
final String _label;
|
final String _label;
|
||||||
final String? _error;
|
final String? _error;
|
||||||
final TextEditingController editingController;
|
final TextEditingController? editingController;
|
||||||
|
|
||||||
OnSelectedSuggestionAction? _onSelectedSuggestionAction;
|
OnSelectedSuggestionAction? _onSelectedSuggestionAction;
|
||||||
OnSuggestionCallbackAction? _onSuggestionCallbackAction;
|
OnSuggestionCallbackAction? _onSuggestionCallbackAction;
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ class MailboxCreatorController extends BaseController {
|
|||||||
@override
|
@override
|
||||||
void onReady() {
|
void onReady() {
|
||||||
super.onReady();
|
super.onReady();
|
||||||
|
log('MailboxCreatorController::onReady(): ');
|
||||||
if (arguments != null) {
|
if (arguments != null) {
|
||||||
folderMailboxTree = arguments!.folderMailboxTree;
|
folderMailboxTree = arguments!.folderMailboxTree;
|
||||||
defaultMailboxTree = arguments!.defaultMailboxTree;
|
defaultMailboxTree = arguments!.defaultMailboxTree;
|
||||||
|
|||||||
@@ -37,7 +37,6 @@ class MailboxCreatorView extends GetWidget<MailboxCreatorController> {
|
|||||||
controller.arguments = arguments;
|
controller.arguments = arguments;
|
||||||
controller.onCreatedMailboxCallback = onCreatedMailboxCallback;
|
controller.onCreatedMailboxCallback = onCreatedMailboxCallback;
|
||||||
controller.onDismissMailboxCreator = onDismissCallback;
|
controller.onDismissMailboxCreator = onDismissCallback;
|
||||||
controller.onInit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
@@ -54,7 +54,6 @@ class ManageAccountDashBoardController extends ReloadableController {
|
|||||||
|
|
||||||
final emailsForwardCreatorIsActive = false.obs;
|
final emailsForwardCreatorIsActive = false.obs;
|
||||||
final rulesFilterCreatorIsActive = false.obs;
|
final rulesFilterCreatorIsActive = false.obs;
|
||||||
final identityCreatorIsActive = false.obs;
|
|
||||||
|
|
||||||
ManageAccountDashBoardController(
|
ManageAccountDashBoardController(
|
||||||
LogoutOidcInteractor logoutOidcInteractor,
|
LogoutOidcInteractor logoutOidcInteractor,
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import 'package:core/core.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/emails_forward_creator/presentation/emails_forward_creator_view.dart';
|
import 'package:tmail_ui_user/features/emails_forward_creator/presentation/emails_forward_creator_view.dart';
|
||||||
import 'package:tmail_ui_user/features/identity_creator/presentation/identity_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/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/extensions/vacation_response_extension.dart';
|
||||||
import 'package:tmail_ui_user/features/manage_account/presentation/vacation/widgets/vacation_notification_message_widget.dart';
|
import 'package:tmail_ui_user/features/manage_account/presentation/vacation/widgets/vacation_notification_message_widget.dart';
|
||||||
@@ -131,8 +130,6 @@ class ManageAccountDashBoardView extends GetWidget<ManageAccountDashBoardControl
|
|||||||
EmailsForwardCreatorView(),
|
EmailsForwardCreatorView(),
|
||||||
if(controller.rulesFilterCreatorIsActive.isTrue)
|
if(controller.rulesFilterCreatorIsActive.isTrue)
|
||||||
RuleFilterCreatorView(),
|
RuleFilterCreatorView(),
|
||||||
if(controller.identityCreatorIsActive.isTrue)
|
|
||||||
IdentityCreatorView()
|
|
||||||
]
|
]
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|||||||
+56
-25
@@ -1,6 +1,12 @@
|
|||||||
|
|
||||||
import 'package:core/core.dart';
|
import 'package:core/presentation/extensions/capitalize_extension.dart';
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:core/presentation/extensions/color_extension.dart';
|
||||||
|
import 'package:core/presentation/resources/image_paths.dart';
|
||||||
|
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:core/utils/build_utils.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_svg/flutter_svg.dart';
|
import 'package:flutter_svg/flutter_svg.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
@@ -8,7 +14,6 @@ import 'package:jmap_dart_client/jmap/account_id.dart';
|
|||||||
import 'package:jmap_dart_client/jmap/core/id.dart';
|
import 'package:jmap_dart_client/jmap/core/id.dart';
|
||||||
import 'package:jmap_dart_client/jmap/identities/identity.dart';
|
import 'package:jmap_dart_client/jmap/identities/identity.dart';
|
||||||
import 'package:tmail_ui_user/features/base/base_controller.dart';
|
import 'package:tmail_ui_user/features/base/base_controller.dart';
|
||||||
import 'package:tmail_ui_user/features/identity_creator/presentation/identity_creator_bindings.dart';
|
|
||||||
import 'package:tmail_ui_user/features/identity_creator/presentation/model/identity_creator_arguments.dart';
|
import 'package:tmail_ui_user/features/identity_creator/presentation/model/identity_creator_arguments.dart';
|
||||||
import 'package:tmail_ui_user/features/manage_account/domain/model/create_new_identity_request.dart';
|
import 'package:tmail_ui_user/features/manage_account/domain/model/create_new_identity_request.dart';
|
||||||
import 'package:tmail_ui_user/features/manage_account/domain/model/edit_identity_request.dart';
|
import 'package:tmail_ui_user/features/manage_account/domain/model/edit_identity_request.dart';
|
||||||
@@ -45,8 +50,6 @@ class IdentitiesController extends BaseController {
|
|||||||
|
|
||||||
final idIdentityAll = IdentityId(Id('all'));
|
final idIdentityAll = IdentityId(Id('all'));
|
||||||
|
|
||||||
final identityCreatorArguments = Rxn<IdentityCreatorArguments>();
|
|
||||||
|
|
||||||
late Worker accountIdWorker;
|
late Worker accountIdWorker;
|
||||||
|
|
||||||
IdentitiesController(
|
IdentitiesController(
|
||||||
@@ -118,7 +121,6 @@ class IdentitiesController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void _getAllIdentities(AccountId accountId) {
|
void _getAllIdentities(AccountId accountId) {
|
||||||
log('IdentitiesController::_getAllIdentities(): $accountId');
|
|
||||||
consumeState(_getAllIdentitiesInteractor.execute(accountId));
|
consumeState(_getAllIdentitiesInteractor.execute(accountId));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -141,11 +143,6 @@ class IdentitiesController extends BaseController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void _openIdentityCreatorOverlay() {
|
|
||||||
IdentityCreatorBindings().dependencies();
|
|
||||||
_accountDashBoardController.identityCreatorIsActive.toggle();
|
|
||||||
}
|
|
||||||
|
|
||||||
void selectIdentity(Identity? newIdentity) {
|
void selectIdentity(Identity? newIdentity) {
|
||||||
identitySelected.value = newIdentity;
|
identitySelected.value = newIdentity;
|
||||||
if (newIdentity != null) {
|
if (newIdentity != null) {
|
||||||
@@ -161,20 +158,38 @@ class IdentitiesController extends BaseController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void goToCreateNewIdentity() async {
|
void goToCreateNewIdentity(BuildContext context) async {
|
||||||
final accountId = _accountDashBoardController.accountId.value;
|
final accountId = _accountDashBoardController.accountId.value;
|
||||||
final userProfile = _accountDashBoardController.userProfile.value;
|
final userProfile = _accountDashBoardController.userProfile.value;
|
||||||
if (accountId != null && userProfile != null) {
|
if (accountId != null && userProfile != null) {
|
||||||
identityCreatorArguments.value = IdentityCreatorArguments(accountId, userProfile);
|
final arguments = IdentityCreatorArguments(accountId, userProfile);
|
||||||
if (kIsWeb) {
|
|
||||||
_openIdentityCreatorOverlay();
|
if (BuildUtils.isWeb) {
|
||||||
|
showDialogIdentityCreator(
|
||||||
|
context: context,
|
||||||
|
arguments: arguments,
|
||||||
|
onCreatedIdentity: (arguments) {
|
||||||
|
if (arguments is CreateNewIdentityRequest) {
|
||||||
|
_createNewIdentityAction(accountId, arguments);
|
||||||
|
} else if (arguments is EditIdentityRequest) {
|
||||||
|
_editIdentityAction(accountId, arguments);
|
||||||
|
}
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
push(AppRoutes.identityCreator);
|
final newIdentityArguments = await push(
|
||||||
|
AppRoutes.identityCreator,
|
||||||
|
arguments: arguments);
|
||||||
|
|
||||||
|
if (newIdentityArguments is CreateNewIdentityRequest) {
|
||||||
|
_createNewIdentityAction(accountId, newIdentityArguments);
|
||||||
|
} else if (newIdentityArguments is EditIdentityRequest) {
|
||||||
|
_editIdentityAction(accountId, newIdentityArguments);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void createNewIdentityAction(AccountId accountId, CreateNewIdentityRequest identityRequest) async {
|
void _createNewIdentityAction(AccountId accountId, CreateNewIdentityRequest identityRequest) async {
|
||||||
consumeState(_createNewIdentityInteractor.execute(accountId, identityRequest));
|
consumeState(_createNewIdentityInteractor.execute(accountId, identityRequest));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -281,32 +296,48 @@ class IdentitiesController extends BaseController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void goToEditIdentity(Identity identity) async {
|
void goToEditIdentity(BuildContext context, Identity identity) async {
|
||||||
popBack();
|
popBack();
|
||||||
|
|
||||||
final accountId = _accountDashBoardController.accountId.value;
|
final accountId = _accountDashBoardController.accountId.value;
|
||||||
final userProfile = _accountDashBoardController.userProfile.value;
|
final userProfile = _accountDashBoardController.userProfile.value;
|
||||||
if (accountId != null && userProfile != null) {
|
if (accountId != null && userProfile != null) {
|
||||||
identityCreatorArguments.value = IdentityCreatorArguments(
|
final arguments = IdentityCreatorArguments(
|
||||||
accountId,
|
accountId,
|
||||||
userProfile,
|
userProfile,
|
||||||
identity: identity,
|
identity: identity,
|
||||||
actionType: IdentityActionType.edit);
|
actionType: IdentityActionType.edit);
|
||||||
if (kIsWeb) {
|
|
||||||
_openIdentityCreatorOverlay();
|
if (BuildUtils.isWeb) {
|
||||||
|
showDialogIdentityCreator(
|
||||||
|
context: context,
|
||||||
|
arguments: arguments,
|
||||||
|
onCreatedIdentity: (arguments) {
|
||||||
|
if (arguments is CreateNewIdentityRequest) {
|
||||||
|
_createNewIdentityAction(accountId, arguments);
|
||||||
|
} else if (arguments is EditIdentityRequest) {
|
||||||
|
_editIdentityAction(accountId, arguments);
|
||||||
|
}
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
push(AppRoutes.identityCreator);
|
final newIdentityArguments = await push(
|
||||||
|
AppRoutes.identityCreator,
|
||||||
|
arguments: arguments);
|
||||||
|
|
||||||
|
if (newIdentityArguments is CreateNewIdentityRequest) {
|
||||||
|
_createNewIdentityAction(accountId, newIdentityArguments);
|
||||||
|
} else if (newIdentityArguments is EditIdentityRequest) {
|
||||||
|
_editIdentityAction(accountId, newIdentityArguments);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void editIdentityAction(AccountId accountId, EditIdentityRequest editIdentityRequest) async {
|
void _editIdentityAction(AccountId accountId, EditIdentityRequest editIdentityRequest) async {
|
||||||
log('IdentitiesController::_editIdentityAction(): $editIdentityRequest');
|
|
||||||
consumeState(_editIdentityInteractor.execute(accountId, editIdentityRequest));
|
consumeState(_editIdentityInteractor.execute(accountId, editIdentityRequest));
|
||||||
}
|
}
|
||||||
|
|
||||||
void _editIdentitySuccess(EditIdentitySuccess success) {
|
void _editIdentitySuccess(EditIdentitySuccess success) {
|
||||||
log('IdentitiesController::_editIdentitySuccess(): $success');
|
|
||||||
if (currentOverlayContext != null && currentContext != null) {
|
if (currentOverlayContext != null && currentContext != null) {
|
||||||
_appToast.showToastWithIcon(
|
_appToast.showToastWithIcon(
|
||||||
currentOverlayContext!,
|
currentOverlayContext!,
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
|
|
||||||
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/state/success.dart';
|
||||||
|
import 'package:core/presentation/utils/responsive_utils.dart';
|
||||||
|
import 'package:core/presentation/views/button/button_builder.dart';
|
||||||
|
import 'package:core/presentation/views/responsive/responsive_widget.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart';
|
import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart';
|
||||||
import 'package:flutter_svg/flutter_svg.dart';
|
import 'package:flutter_svg/flutter_svg.dart';
|
||||||
@@ -42,7 +47,7 @@ class IdentitiesView extends GetWidget<IdentitiesController> with PopupMenuWidge
|
|||||||
..radiusSplash(10)
|
..radiusSplash(10)
|
||||||
..padding(const EdgeInsets.symmetric(vertical: 12))
|
..padding(const EdgeInsets.symmetric(vertical: 12))
|
||||||
..textStyle(const TextStyle(fontSize: 17, color: Colors.white, fontWeight: FontWeight.w500))
|
..textStyle(const TextStyle(fontSize: 17, color: Colors.white, fontWeight: FontWeight.w500))
|
||||||
..onPressActionClick(() => controller.goToCreateNewIdentity())
|
..onPressActionClick(() => controller.goToCreateNewIdentity(context))
|
||||||
..text(AppLocalizations.of(context).new_identity, isVertical: false))
|
..text(AppLocalizations.of(context).new_identity, isVertical: false))
|
||||||
.build()
|
.build()
|
||||||
]);
|
]);
|
||||||
@@ -77,7 +82,7 @@ class IdentitiesView extends GetWidget<IdentitiesController> with PopupMenuWidge
|
|||||||
floatingActionButton: _responsiveUtils.isMobile(context)
|
floatingActionButton: _responsiveUtils.isMobile(context)
|
||||||
? FloatingActionButton(
|
? FloatingActionButton(
|
||||||
key: const Key('add_new_identity'),
|
key: const Key('add_new_identity'),
|
||||||
onPressed: () => controller.goToCreateNewIdentity(),
|
onPressed: () => controller.goToCreateNewIdentity(context),
|
||||||
backgroundColor: AppColor.primaryColor,
|
backgroundColor: AppColor.primaryColor,
|
||||||
child: SvgPicture.asset(_imagePaths.icAddIdentity, width: 24, height: 24))
|
child: SvgPicture.asset(_imagePaths.icAddIdentity, width: 24, height: 24))
|
||||||
: null),
|
: null),
|
||||||
@@ -140,7 +145,7 @@ class IdentitiesView extends GetWidget<IdentitiesController> with PopupMenuWidge
|
|||||||
fontWeight: FontWeight.normal,
|
fontWeight: FontWeight.normal,
|
||||||
fontSize: 17,
|
fontSize: 17,
|
||||||
color: Colors.black),
|
color: Colors.black),
|
||||||
onCallbackAction: () => controller.goToEditIdentity(identity))),
|
onCallbackAction: () => controller.goToEditIdentity(context, identity))),
|
||||||
if (identity.mayDelete == true)
|
if (identity.mayDelete == true)
|
||||||
PopupMenuItem(
|
PopupMenuItem(
|
||||||
padding: EdgeInsets.zero,
|
padding: EdgeInsets.zero,
|
||||||
@@ -192,7 +197,7 @@ class IdentitiesView extends GetWidget<IdentitiesController> with PopupMenuWidge
|
|||||||
iconRightPadding: _responsiveUtils.isMobile(context)
|
iconRightPadding: _responsiveUtils.isMobile(context)
|
||||||
? const EdgeInsets.only(right: 12)
|
? const EdgeInsets.only(right: 12)
|
||||||
: EdgeInsets.zero)
|
: EdgeInsets.zero)
|
||||||
..onActionClick((identity) => controller.goToEditIdentity(identity)))
|
..onActionClick((identity) => controller.goToEditIdentity(context, identity)))
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -52,6 +52,11 @@ class AppPages {
|
|||||||
opaque: false,
|
opaque: false,
|
||||||
page: () => DeferredWidget(contact_view.loadLibrary, () => contact_view.ContactView()),
|
page: () => DeferredWidget(contact_view.loadLibrary, () => contact_view.ContactView()),
|
||||||
binding: ContactBindings()),
|
binding: ContactBindings()),
|
||||||
|
GetPage(
|
||||||
|
name: AppRoutes.identityCreator,
|
||||||
|
opaque: false,
|
||||||
|
page: () => DeferredWidget(identity_creator.loadLibrary, () => identity_creator.IdentityCreatorView()),
|
||||||
|
binding: IdentityCreatorBindings()),
|
||||||
];
|
];
|
||||||
|
|
||||||
static final pages = [
|
static final pages = [
|
||||||
@@ -76,12 +81,6 @@ class AppPages {
|
|||||||
page: () => DeferredWidget(manage_account_dashboard.loadLibrary,
|
page: () => DeferredWidget(manage_account_dashboard.loadLibrary,
|
||||||
() => manage_account_dashboard.ManageAccountDashBoardView()),
|
() => manage_account_dashboard.ManageAccountDashBoardView()),
|
||||||
binding: ManageAccountDashBoardBindings()),
|
binding: ManageAccountDashBoardBindings()),
|
||||||
GetPage(
|
|
||||||
name: AppRoutes.identityCreator,
|
|
||||||
opaque: false,
|
|
||||||
page: () => DeferredWidget(identity_creator.loadLibrary,
|
|
||||||
() => identity_creator.IdentityCreatorView()),
|
|
||||||
binding: IdentityCreatorBindings()),
|
|
||||||
GetPage(
|
GetPage(
|
||||||
name: AppRoutes.rulesFilterCreator,
|
name: AppRoutes.rulesFilterCreator,
|
||||||
opaque: false,
|
opaque: false,
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ abstract class AppRoutes {
|
|||||||
static const destinationPicker = '/destination_picker';
|
static const destinationPicker = '/destination_picker';
|
||||||
static const mailboxCreator = '/mailbox_creator';
|
static const mailboxCreator = '/mailbox_creator';
|
||||||
static const contact = '/contact';
|
static const contact = '/contact';
|
||||||
static const identityCreator = '$settings/identity_creator';
|
static const identityCreator = '/identity_creator';
|
||||||
static const rulesFilterCreator = '$settings/rules_filter_creator';
|
static const rulesFilterCreator = '$settings/rules_filter_creator';
|
||||||
static const emailsForwardCreator = '$settings/emails_forward_creator';
|
static const emailsForwardCreator = '$settings/emails_forward_creator';
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user