TF-1100: Support display answered and forwarded
(cherry picked from commit cb67c81998264efbb75ae4543621a20522f3dbc4)
This commit is contained in:
@@ -4,6 +4,7 @@ import 'package:jmap_dart_client/jmap/core/id.dart';
|
||||
import 'package:jmap_dart_client/jmap/identities/identity.dart';
|
||||
import 'package:jmap_dart_client/jmap/mail/email/email.dart';
|
||||
import 'package:jmap_dart_client/jmap/mail/mailbox/mailbox.dart';
|
||||
import 'package:model/email/email_action_type.dart';
|
||||
|
||||
class EmailRequest with EquatableMixin {
|
||||
|
||||
@@ -12,11 +13,13 @@ class EmailRequest with EquatableMixin {
|
||||
final MailboxId? sentMailboxId;
|
||||
final EmailId? emailIdDestroyed;
|
||||
final Identity? identity;
|
||||
final EmailActionType? emailActionType;
|
||||
|
||||
EmailRequest(this.email, this.submissionCreateId, {
|
||||
this.sentMailboxId,
|
||||
this.identity,
|
||||
this.emailIdDestroyed
|
||||
this.emailIdDestroyed,
|
||||
this.emailActionType
|
||||
});
|
||||
|
||||
@override
|
||||
@@ -25,6 +28,11 @@ class EmailRequest with EquatableMixin {
|
||||
submissionCreateId,
|
||||
sentMailboxId,
|
||||
identity,
|
||||
emailIdDestroyed
|
||||
emailIdDestroyed,
|
||||
emailActionType
|
||||
];
|
||||
|
||||
bool get isEmailAnswered => emailActionType == EmailActionType.reply;
|
||||
|
||||
bool get isEmailForwarded => emailActionType == EmailActionType.forward;
|
||||
}
|
||||
@@ -806,7 +806,8 @@ class ComposerController extends BaseController {
|
||||
identity: identitySelected.value,
|
||||
emailIdDestroyed: arguments.emailActionType == EmailActionType.edit
|
||||
? arguments.presentationEmail?.id
|
||||
: null
|
||||
: null,
|
||||
emailActionType: arguments.emailActionType
|
||||
);
|
||||
final mailboxRequest = outboxMailboxId == null
|
||||
? CreateNewMailboxRequest(Id(_uuid.v1()), PresentationMailbox.outboxMailboxName)
|
||||
|
||||
@@ -159,7 +159,9 @@ class EmailAPI with HandleSetErrorMixin {
|
||||
emailRequest.sentMailboxId!.generatePath() : true,
|
||||
outboxMailboxId!.generatePath() : null,
|
||||
KeyWordIdentifier.emailSeen.generatePath(): true,
|
||||
KeyWordIdentifier.emailDraft.generatePath(): null
|
||||
KeyWordIdentifier.emailDraft.generatePath(): null,
|
||||
KeyWordIdentifier.emailAnswered.generatePath(): emailRequest.isEmailAnswered ? true : null,
|
||||
KeyWordIdentifier.emailForwarded.generatePath(): emailRequest.isEmailForwarded ? true : null
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ import 'package:model/extensions/presentation_email_extension.dart';
|
||||
import 'package:model/mailbox/presentation_mailbox.dart';
|
||||
import 'package:model/mailbox/select_mode.dart';
|
||||
import 'package:tmail_ui_user/features/thread/domain/model/search_query.dart';
|
||||
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
||||
|
||||
typedef OnPressEmailActionClick = void Function(EmailActionType, PresentationEmail);
|
||||
typedef OnMoreActionClick = void Function(PresentationEmail, RelativeRect?);
|
||||
@@ -274,4 +275,57 @@ mixin BaseEmailItemTile {
|
||||
width: 24, height: 24));
|
||||
}
|
||||
}
|
||||
|
||||
Widget buildIconAnsweredOrForwarded({
|
||||
required PresentationEmail presentationEmail,
|
||||
double? width,
|
||||
double? height
|
||||
}) {
|
||||
if (presentationEmail.isAnsweredAndForwarded) {
|
||||
return _iconAnsweredOrForwardedWidget(
|
||||
iconPath: imagePaths.icReplyAndForward,
|
||||
width: width,
|
||||
height: height
|
||||
);
|
||||
} else if (presentationEmail.isAnswered) {
|
||||
return _iconAnsweredOrForwardedWidget(
|
||||
iconPath: imagePaths.icReply,
|
||||
width: width,
|
||||
height: height
|
||||
);
|
||||
} else if (presentationEmail.isForwarded) {
|
||||
return _iconAnsweredOrForwardedWidget(
|
||||
iconPath: imagePaths.icForwarded,
|
||||
width: width,
|
||||
height: height
|
||||
);
|
||||
} else {
|
||||
return const SizedBox(width: 16, height: 16);
|
||||
}
|
||||
}
|
||||
|
||||
Widget _iconAnsweredOrForwardedWidget({
|
||||
required String iconPath,
|
||||
double? width,
|
||||
double? height
|
||||
}) {
|
||||
return SvgPicture.asset(
|
||||
iconPath,
|
||||
width: width ?? 20,
|
||||
height: height ?? 20,
|
||||
colorFilter: AppColor.colorAttachmentIcon.asFilter(),
|
||||
fit: BoxFit.fill);
|
||||
}
|
||||
|
||||
String? messageToolTipForAnsweredOrForwarded(BuildContext context, PresentationEmail presentationEmail) {
|
||||
if (presentationEmail.isAnsweredAndForwarded) {
|
||||
return AppLocalizations.of(context).repliedAndForwardedMessage;
|
||||
} else if (presentationEmail.isAnswered) {
|
||||
return AppLocalizations.of(context).repliedMessage;
|
||||
} else if (presentationEmail.isForwarded){
|
||||
return AppLocalizations.of(context).forwardedMessage;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -86,6 +86,7 @@ class EmailTileBuilder with BaseEmailItemTile {
|
||||
mailboxContain,
|
||||
isSearchEmailRunning,
|
||||
_searchQuery)),
|
||||
buildIconAnsweredOrForwarded(width: 16, height: 16, presentationEmail: _presentationEmail),
|
||||
if (_presentationEmail.hasAttachment == true)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 8),
|
||||
|
||||
@@ -153,6 +153,7 @@ class EmailTileBuilder with BaseEmailItemTile {
|
||||
isSearchEmailRunning,
|
||||
_searchQuery
|
||||
)),
|
||||
buildIconAnsweredOrForwarded(width: 16, height: 16, presentationEmail: _presentationEmail),
|
||||
if (_presentationEmail.hasAttachment == true)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 8),
|
||||
@@ -345,6 +346,11 @@ class EmailTileBuilder with BaseEmailItemTile {
|
||||
? EmailActionType.unMarkAsStarred
|
||||
: EmailActionType.markAsStarred,
|
||||
_presentationEmail)),
|
||||
buildIconWeb(
|
||||
icon: buildIconAnsweredOrForwarded(presentationEmail: _presentationEmail),
|
||||
tooltip: messageToolTipForAnsweredOrForwarded(context, _presentationEmail),
|
||||
iconPadding: const EdgeInsets.only(right: 12),
|
||||
splashRadius: 1),
|
||||
InkWell(
|
||||
onTap: () {
|
||||
if (isHoverIcon) {
|
||||
@@ -382,7 +388,7 @@ class EmailTileBuilder with BaseEmailItemTile {
|
||||
Transform(
|
||||
transform: Matrix4.translationValues(0.0, 10, 0.0),
|
||||
child: const Padding(
|
||||
padding: EdgeInsets.only(left: 80),
|
||||
padding: EdgeInsets.only(left: 120),
|
||||
child: Divider(
|
||||
color: AppColor.lineItemListColor,
|
||||
height: 1,
|
||||
@@ -497,6 +503,7 @@ class EmailTileBuilder with BaseEmailItemTile {
|
||||
|
||||
Widget _buildDateTimeForMobileTabletScreen() {
|
||||
return Row(children: [
|
||||
buildIconAnsweredOrForwarded(width: 16, height: 16, presentationEmail: _presentationEmail),
|
||||
if (_presentationEmail.hasAttachment == true)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 8),
|
||||
|
||||
@@ -2833,4 +2833,22 @@ class AppLocalizations {
|
||||
'Please input at least one recipient',
|
||||
name: 'emptyListEmailForward');
|
||||
}
|
||||
|
||||
String get forwardedMessage {
|
||||
return Intl.message(
|
||||
'Forwarded message',
|
||||
name: 'forwardedMessage');
|
||||
}
|
||||
|
||||
String get repliedMessage {
|
||||
return Intl.message(
|
||||
'Replied message',
|
||||
name: 'repliedMessage');
|
||||
}
|
||||
|
||||
String get repliedAndForwardedMessage {
|
||||
return Intl.message(
|
||||
'Replied and Forwarded message',
|
||||
name: 'repliedAndForwardedMessage');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user