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