TF-1718 Handle unsubscribe mail by https links
Signed-off-by: dab246 <tdvu@linagora.com> (cherry picked from commit 7f8843fae854a2ed8ba7ea43b80de84044923d28)
This commit is contained in:
@@ -1404,7 +1404,11 @@ class SingleEmailController extends BaseController with AppLoaderMixin {
|
|||||||
context,
|
context,
|
||||||
'',
|
'',
|
||||||
AppLocalizations.of(context).unsubscribe,
|
AppLocalizations.of(context).unsubscribe,
|
||||||
onConfirmAction: () => {},
|
onConfirmAction: () {
|
||||||
|
if (emailUnsubscribe.value?.httpLinks.isNotEmpty == true) {
|
||||||
|
_handleUnsubscribeMailByHttpsLink(context, emailUnsubscribe.value!.httpLinks);
|
||||||
|
}
|
||||||
|
},
|
||||||
showAsBottomSheet: true,
|
showAsBottomSheet: true,
|
||||||
title: AppLocalizations.of(context).unsubscribeMail,
|
title: AppLocalizations.of(context).unsubscribeMail,
|
||||||
icon: SvgPicture.asset(imagePaths.icEmpty),
|
icon: SvgPicture.asset(imagePaths.icEmpty),
|
||||||
@@ -1427,4 +1431,14 @@ class SingleEmailController extends BaseController with AppLoaderMixin {
|
|||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _handleUnsubscribeMailByHttpsLink(BuildContext context, List<String> httpLinks) async {
|
||||||
|
log('SingleEmailController::_handleUnsubscribeMailByHttpsLink:httpLinks: $httpLinks');
|
||||||
|
final result = await AppUtils.launchLink(httpLinks.first);
|
||||||
|
if (result && context.mounted) {
|
||||||
|
_appToast.showToastSuccessMessage(
|
||||||
|
context,
|
||||||
|
AppLocalizations.of(context).unsubscribedFromThisMailingList);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"@@last_modified": "2023-11-16T00:13:28.374001",
|
"@@last_modified": "2023-11-16T00:29:04.650547",
|
||||||
"initializing_data": "Initializing data...",
|
"initializing_data": "Initializing data...",
|
||||||
"@initializing_data": {
|
"@initializing_data": {
|
||||||
"type": "text",
|
"type": "text",
|
||||||
@@ -3511,5 +3511,11 @@
|
|||||||
"type": "text",
|
"type": "text",
|
||||||
"placeholders_order": [],
|
"placeholders_order": [],
|
||||||
"placeholders": {}
|
"placeholders": {}
|
||||||
|
},
|
||||||
|
"unsubscribedFromThisMailingList": "Unsubscribed from this mailing list",
|
||||||
|
"@unsubscribedFromThisMailingList": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders_order": [],
|
||||||
|
"placeholders": {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3645,4 +3645,11 @@ class AppLocalizations {
|
|||||||
name: 'unsubscribeMailDialogMessage',
|
name: 'unsubscribeMailDialogMessage',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String get unsubscribedFromThisMailingList {
|
||||||
|
return Intl.message(
|
||||||
|
'Unsubscribed from this mailing list',
|
||||||
|
name: 'unsubscribedFromThisMailingList',
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -25,8 +25,8 @@ class AppUtils {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Future<void> launchLink(String url, {bool isNewTab = true}) async {
|
static Future<bool> launchLink(String url, {bool isNewTab = true}) async {
|
||||||
await launchUrl(
|
return await launchUrl(
|
||||||
Uri.parse(url),
|
Uri.parse(url),
|
||||||
webOnlyWindowName: isNewTab ? '_blank' : '_self',
|
webOnlyWindowName: isNewTab ? '_blank' : '_self',
|
||||||
mode: LaunchMode.externalApplication
|
mode: LaunchMode.externalApplication
|
||||||
|
|||||||
Reference in New Issue
Block a user