Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix that when you launch Mail with a template, the space character is a '+'. #1778

Merged
merged 1 commit into from
Oct 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions lib/url_launcher_extended/lib/src/url_launcher_extended.dart
Original file line number Diff line number Diff line change
Expand Up @@ -107,21 +107,22 @@ class UrlLauncherExtended {
String? subject,
String? body,
}) async {
final emailLaunchString = Uri(
scheme: 'mailto',
path: address,
queryParameters: {
if (subject != null) 'subject': subject,
if (body != null) 'body': body,
},
);
String url = 'mailto:$address';
if (subject != null) {
url += '?subject=$subject';
}
if (body != null) {
url += subject == null ? '?' : '&';
url += 'body=$body';
}

final canLaunch = await canLaunchUrl(emailLaunchString);
final uri = Uri.parse(url);
final canLaunch = await canLaunchUrl(uri);
if (!canLaunch) {
throw CouldNotLaunchMailException(address, subject: subject, body: body);
}

return launchUrl(emailLaunchString);
return launchUrl(uri);
}
}

Expand Down
Loading