TF-186 [BUG] Fix should not duplicate RE, FWD
This commit is contained in:
@@ -122,13 +122,11 @@ class ComposerController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void _initSubjectEmail() {
|
void _initSubjectEmail() {
|
||||||
if (composerArguments.value != null
|
if (Get.context != null) {
|
||||||
&& composerArguments.value?.presentationEmail != null
|
final subjectEmail = composerArguments.value?.presentationEmail?.getEmailTitle().trim() ?? '';
|
||||||
&& Get.context != null) {
|
final newSubject = composerArguments.value?.emailActionType.getSubjectComposer(Get.context!, subjectEmail) ?? '';
|
||||||
final subject = '${composerArguments.value!.emailActionType.prefixSubjectComposer(Get.context!)} '
|
setSubjectEmail(newSubject);
|
||||||
'${composerArguments.value!.presentationEmail?.getEmailTitle()}';
|
subjectEmailInputController.text = newSubject;
|
||||||
setSubjectEmail(subject);
|
|
||||||
subjectEmailInputController.text = subject;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,13 +4,21 @@ import 'package:model/email/email_action_type.dart';
|
|||||||
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
||||||
|
|
||||||
extension EmailActionTypeExtension on EmailActionType {
|
extension EmailActionTypeExtension on EmailActionType {
|
||||||
String prefixSubjectComposer(BuildContext context) {
|
String getSubjectComposer(BuildContext context, String subject) {
|
||||||
switch(this) {
|
switch(this) {
|
||||||
case EmailActionType.reply:
|
case EmailActionType.reply:
|
||||||
case EmailActionType.replyAll:
|
case EmailActionType.replyAll:
|
||||||
return AppLocalizations.of(context).prefix_reply_email;
|
if (subject.toLowerCase().startsWith('re:')) {
|
||||||
|
return subject;
|
||||||
|
} else {
|
||||||
|
return '${AppLocalizations.of(context).prefix_reply_email} $subject';
|
||||||
|
}
|
||||||
case EmailActionType.forward:
|
case EmailActionType.forward:
|
||||||
return AppLocalizations.of(context).prefix_forward_email;
|
if (subject.toLowerCase().startsWith('fwd:')) {
|
||||||
|
return subject;
|
||||||
|
} else {
|
||||||
|
return '${AppLocalizations.of(context).prefix_forward_email} $subject';
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user