TF-1718 Handle unsubscribe mail by mailto links
Signed-off-by: dab246 <tdvu@linagora.com> (cherry picked from commit f96273c52456ecd758d8bbbafc4d2c7af6ec7921)
This commit is contained in:
@@ -1407,6 +1407,8 @@ class SingleEmailController extends BaseController with AppLoaderMixin {
|
||||
onConfirmAction: () {
|
||||
if (emailUnsubscribe.value?.httpLinks.isNotEmpty == true) {
|
||||
_handleUnsubscribeMailByHttpsLink(context, emailUnsubscribe.value!.httpLinks);
|
||||
} else if (emailUnsubscribe.value?.mailtoLinks.isNotEmpty == true) {
|
||||
_handleUnsubscribeMailByMailtoLink(context, emailUnsubscribe.value!.mailtoLinks);
|
||||
}
|
||||
},
|
||||
showAsBottomSheet: true,
|
||||
@@ -1441,4 +1443,16 @@ class SingleEmailController extends BaseController with AppLoaderMixin {
|
||||
AppLocalizations.of(context).unsubscribedFromThisMailingList);
|
||||
}
|
||||
}
|
||||
|
||||
void _handleUnsubscribeMailByMailtoLink(BuildContext context, List<String> mailtoLinks) {
|
||||
log('SingleEmailController::_handleUnsubscribeMailByMailtoLink:mailtoLinks: $mailtoLinks');
|
||||
final navigationRouter = RouteUtils.generateNavigationRouterFromMailtoLink(mailtoLinks.first);
|
||||
mailboxDashBoardController.goToComposer(
|
||||
ComposerArguments.fromUnsubscribeMailtoLink(
|
||||
emailAddress: navigationRouter.emailAddress,
|
||||
subject: navigationRouter.subject,
|
||||
body: navigationRouter.body
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -18,6 +18,7 @@ class ComposerArguments extends RouterArguments {
|
||||
final Role? mailboxRole;
|
||||
final SendingEmail? sendingEmail;
|
||||
final String? subject;
|
||||
final String? body;
|
||||
final MessageIdsHeaderValue? messageId;
|
||||
final MessageIdsHeaderValue? references;
|
||||
|
||||
@@ -31,6 +32,7 @@ class ComposerArguments extends RouterArguments {
|
||||
this.listSharedMediaFile,
|
||||
this.sendingEmail,
|
||||
this.subject,
|
||||
this.body,
|
||||
this.messageId,
|
||||
this.references,
|
||||
});
|
||||
@@ -59,11 +61,12 @@ class ComposerArguments extends RouterArguments {
|
||||
emailAddress: emailAddress
|
||||
);
|
||||
|
||||
factory ComposerArguments.fromMailtoUri({EmailAddress? emailAddress, String? subject}) =>
|
||||
factory ComposerArguments.fromMailtoUri({EmailAddress? emailAddress, String? subject, String? body}) =>
|
||||
ComposerArguments(
|
||||
emailActionType: EmailActionType.composeFromMailtoUri,
|
||||
emailAddress: emailAddress,
|
||||
subject: subject,
|
||||
body: body,
|
||||
);
|
||||
|
||||
factory ComposerArguments.editDraftEmail(PresentationEmail presentationEmail) =>
|
||||
@@ -136,6 +139,15 @@ class ComposerArguments extends RouterArguments {
|
||||
? SendingEmailActionType.edit
|
||||
: SendingEmailActionType.create;
|
||||
|
||||
factory ComposerArguments.fromUnsubscribeMailtoLink({EmailAddress? emailAddress, String? subject, String? body}) =>
|
||||
ComposerArguments(
|
||||
emailActionType: EmailActionType.composeFromUnsubscribeMailtoLink,
|
||||
emailAddress: emailAddress,
|
||||
subject: subject,
|
||||
body: body,
|
||||
);
|
||||
|
||||
|
||||
@override
|
||||
List<Object?> get props => [
|
||||
emailActionType,
|
||||
@@ -147,6 +159,7 @@ class ComposerArguments extends RouterArguments {
|
||||
listSharedMediaFile,
|
||||
sendingEmail,
|
||||
subject,
|
||||
body,
|
||||
messageId,
|
||||
references,
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user