TF-597 Fix cannot update null value for identity bcc and replyTo address
This commit is contained in:
@@ -176,22 +176,16 @@ class IdentityCreatorController extends BaseController {
|
|||||||
replyToOfIdentity.value = listEmailAddressOfReplyTo
|
replyToOfIdentity.value = listEmailAddressOfReplyTo
|
||||||
.firstWhere((emailAddress) => emailAddress == identity?.replyTo!.first);
|
.firstWhere((emailAddress) => emailAddress == identity?.replyTo!.first);
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
replyToOfIdentity.value = null;
|
replyToOfIdentity.value = noneEmailAddress;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
replyToOfIdentity.value = null;
|
replyToOfIdentity.value = noneEmailAddress;
|
||||||
}
|
}
|
||||||
log('IdentityCreatorController::_setUpAllFieldEmailAddress(): replyToOfIdentity: ${replyToOfIdentity.value}');
|
log('IdentityCreatorController::_setUpAllFieldEmailAddress(): replyToOfIdentity: ${replyToOfIdentity.value}');
|
||||||
|
|
||||||
if (identity?.bcc?.isNotEmpty == true) {
|
if (identity?.bcc?.isNotEmpty == true) {
|
||||||
try {
|
bccOfIdentity.value = identity?.bcc!.first;
|
||||||
bccOfIdentity.value = listEmailAddressOfReplyTo
|
inputBccIdentityController.text = identity?.bcc!.first.emailAddress ?? '';
|
||||||
.firstWhere((emailAddress) => emailAddress == identity?.bcc!.first);
|
|
||||||
|
|
||||||
inputBccIdentityController.text = bccOfIdentity.value?.email ?? '';
|
|
||||||
} catch(e) {
|
|
||||||
bccOfIdentity.value = null;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
bccOfIdentity.value = null;
|
bccOfIdentity.value = null;
|
||||||
}
|
}
|
||||||
@@ -220,7 +214,7 @@ class IdentityCreatorController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void selectSignatureType(BuildContext context, SignatureType newSignatureType) async {
|
void selectSignatureType(BuildContext context, SignatureType newSignatureType) async {
|
||||||
if (newSignatureType == SignatureType.plainText) {
|
if (newSignatureType == SignatureType.plainText && !BuildUtils.isWeb) {
|
||||||
final signatureText = await _getSignatureHtmlText();
|
final signatureText = await _getSignatureHtmlText();
|
||||||
log('IdentityCreatorController::selectSignatureType(): signatureText: $signatureText');
|
log('IdentityCreatorController::selectSignatureType(): signatureText: $signatureText');
|
||||||
updateContentHtmlEditor(signatureText);
|
updateContentHtmlEditor(signatureText);
|
||||||
@@ -243,9 +237,9 @@ class IdentityCreatorController extends BaseController {
|
|||||||
|
|
||||||
Future<String?> _getSignatureHtmlText() async {
|
Future<String?> _getSignatureHtmlText() async {
|
||||||
if (BuildUtils.isWeb) {
|
if (BuildUtils.isWeb) {
|
||||||
return await signatureHtmlEditorController.getText();
|
return signatureHtmlEditorController.getText();
|
||||||
} else {
|
} else {
|
||||||
return await signatureHtmlEditorMobileController?.getText();
|
return signatureHtmlEditorMobileController?.getText();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -266,20 +260,28 @@ class IdentityCreatorController extends BaseController {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final signatureHtmlText = await _getSignatureHtmlText();
|
final signaturePlainText = signaturePlainEditorController.text;
|
||||||
|
final signatureHtmlText = BuildUtils.isWeb
|
||||||
|
? contentHtmlEditor
|
||||||
|
: await _getSignatureHtmlText();
|
||||||
|
final bccAddress = bccOfIdentity.value != null && bccOfIdentity.value != noneEmailAddress
|
||||||
|
? {bccOfIdentity.value!}
|
||||||
|
: <EmailAddress>{};
|
||||||
|
final replyToAddress = replyToOfIdentity.value != null && replyToOfIdentity.value != noneEmailAddress
|
||||||
|
? {replyToOfIdentity.value!}
|
||||||
|
: <EmailAddress>{};
|
||||||
|
|
||||||
|
log('IdentityCreatorController::createNewIdentity(): bccAddress: $bccAddress');
|
||||||
|
log('IdentityCreatorController::createNewIdentity(): replyToAddress: $replyToAddress');
|
||||||
|
log('IdentityCreatorController::createNewIdentity(): signaturePlainText: $signaturePlainText');
|
||||||
log('IdentityCreatorController::createNewIdentity(): signatureHtmlText: $signatureHtmlText');
|
log('IdentityCreatorController::createNewIdentity(): signatureHtmlText: $signatureHtmlText');
|
||||||
|
|
||||||
final newIdentity = Identity(
|
final newIdentity = Identity(
|
||||||
name: _nameIdentity,
|
name: _nameIdentity,
|
||||||
email: emailOfIdentity.value?.email,
|
email: emailOfIdentity.value?.email,
|
||||||
replyTo: replyToOfIdentity.value != null && replyToOfIdentity.value != noneEmailAddress
|
replyTo: replyToAddress,
|
||||||
? {replyToOfIdentity.value!}
|
bcc: bccAddress,
|
||||||
: null,
|
textSignature: Signature(signaturePlainText),
|
||||||
bcc: bccOfIdentity.value != null && bccOfIdentity.value != noneEmailAddress
|
|
||||||
? {bccOfIdentity.value!}
|
|
||||||
: null,
|
|
||||||
textSignature: Signature(signaturePlainEditorController.text),
|
|
||||||
htmlSignature: Signature(signatureHtmlText ?? ''));
|
htmlSignature: Signature(signatureHtmlText ?? ''));
|
||||||
|
|
||||||
log('IdentityCreatorController::createNewIdentity(): $newIdentity');
|
log('IdentityCreatorController::createNewIdentity(): $newIdentity');
|
||||||
|
|||||||
@@ -187,7 +187,11 @@ class IdentityCreatorView extends GetWidget<IdentityCreatorController> {
|
|||||||
})
|
})
|
||||||
..addOnChangeInputSuggestionAction((pattern) {
|
..addOnChangeInputSuggestionAction((pattern) {
|
||||||
controller.validateInputBccAddress(context, pattern);
|
controller.validateInputBccAddress(context, pattern);
|
||||||
controller.updateBccOfIdentity(EmailAddress(null, pattern));
|
if (pattern == null || pattern.trim().isEmpty) {
|
||||||
|
controller.updateBccOfIdentity(null);
|
||||||
|
} else {
|
||||||
|
controller.updateBccOfIdentity(EmailAddress(null, pattern));
|
||||||
|
}
|
||||||
})
|
})
|
||||||
..addOnSuggestionCallbackAction((pattern) =>
|
..addOnSuggestionCallbackAction((pattern) =>
|
||||||
controller.getSuggestionEmailAddress(pattern)))
|
controller.getSuggestionEmailAddress(pattern)))
|
||||||
@@ -328,7 +332,11 @@ class IdentityCreatorView extends GetWidget<IdentityCreatorController> {
|
|||||||
})
|
})
|
||||||
..addOnChangeInputSuggestionAction((pattern) {
|
..addOnChangeInputSuggestionAction((pattern) {
|
||||||
controller.validateInputBccAddress(context, pattern);
|
controller.validateInputBccAddress(context, pattern);
|
||||||
controller.updateBccOfIdentity(EmailAddress(null, pattern));
|
if (pattern == null || pattern.trim().isEmpty) {
|
||||||
|
controller.updateBccOfIdentity(null);
|
||||||
|
} else {
|
||||||
|
controller.updateBccOfIdentity(EmailAddress(null, pattern));
|
||||||
|
}
|
||||||
})
|
})
|
||||||
..addOnSuggestionCallbackAction((pattern) =>
|
..addOnSuggestionCallbackAction((pattern) =>
|
||||||
controller.getSuggestionEmailAddress(pattern)))
|
controller.getSuggestionEmailAddress(pattern)))
|
||||||
|
|||||||
@@ -13,19 +13,10 @@ part 'identity_request_dto.g.dart';
|
|||||||
@JsonSerializable()
|
@JsonSerializable()
|
||||||
class IdentityRequestDto with EquatableMixin {
|
class IdentityRequestDto with EquatableMixin {
|
||||||
|
|
||||||
@JsonKey(includeIfNull: false)
|
|
||||||
final String? name;
|
final String? name;
|
||||||
|
|
||||||
@JsonKey(includeIfNull: false)
|
|
||||||
final Set<EmailAddress>? bcc;
|
final Set<EmailAddress>? bcc;
|
||||||
|
|
||||||
@JsonKey(includeIfNull: false)
|
|
||||||
final Set<EmailAddress>? replyTo;
|
final Set<EmailAddress>? replyTo;
|
||||||
|
|
||||||
@JsonKey(includeIfNull: false)
|
|
||||||
final Signature? textSignature;
|
final Signature? textSignature;
|
||||||
|
|
||||||
@JsonKey(includeIfNull: false)
|
|
||||||
final Signature? htmlSignature;
|
final Signature? htmlSignature;
|
||||||
|
|
||||||
IdentityRequestDto({
|
IdentityRequestDto({
|
||||||
|
|||||||
Reference in New Issue
Block a user