Skip to content

Commit

Permalink
[url_launcher] Remove incorrect SMS instructions (#7807)
Browse files Browse the repository at this point in the history
Removes incorrect instructions for SMS that were added in flutter/plugins#6042. These instructions would double-encode the body, causing issues.

This removes, rather than fixes, the instructions because the `sms:` scheme isn't particularly well defined, and has inconsistent handling across platforms (see flutter/flutter#18823 and flutter/flutter#156281 for some examples), so no simple instructions will work everywhere. Handling that kind of platform difference is out of scope for this package and its instructions.

Fixes flutter/flutter#156281
  • Loading branch information
stuartmorgan authored Oct 8, 2024
1 parent 5cda4c6 commit 0097256
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 33 deletions.
3 changes: 2 additions & 1 deletion packages/url_launcher/url_launcher/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## NEXT
## 6.3.1

* Removes incorrect SMS instructions from README.
* Updates minimum supported SDK version to Flutter 3.19/Dart 3.3.

## 6.3.0
Expand Down
13 changes: 0 additions & 13 deletions packages/url_launcher/url_launcher/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,19 +170,6 @@ String? encodeQueryParameters(Map<String, String> params) {
launchUrl(emailLaunchUri);
```

Encoding for `sms` is slightly different:

<?code-excerpt "lib/encoding.dart (sms)"?>
```dart
final Uri smsLaunchUri = Uri(
scheme: 'sms',
path: '0118 999 881 999 119 7253',
queryParameters: <String, String>{
'body': Uri.encodeComponent('Example Subject & Symbols are allowed!'),
},
);
```

### URLs not handled by `Uri`

In rare cases, you may need to launch a URL that the host system considers
Expand Down
18 changes: 0 additions & 18 deletions packages/url_launcher/url_launcher/example/lib/encoding.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@ void main() => runApp(
onPressed: _composeMail,
child: Text('Compose an email'),
),
ElevatedButton(
onPressed: _composeSms,
child: Text('Compose a SMS'),
),
],
),
),
Expand All @@ -54,17 +50,3 @@ void _composeMail() {
launchUrl(emailLaunchUri);
// #enddocregion encode-query-parameters
}

void _composeSms() {
// #docregion sms
final Uri smsLaunchUri = Uri(
scheme: 'sms',
path: '0118 999 881 999 119 7253',
queryParameters: <String, String>{
'body': Uri.encodeComponent('Example Subject & Symbols are allowed!'),
},
);
// #enddocregion sms

launchUrl(smsLaunchUri);
}
2 changes: 1 addition & 1 deletion packages/url_launcher/url_launcher/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: Flutter plugin for launching a URL. Supports
web, phone, SMS, and email schemes.
repository: https://github.com/flutter/packages/tree/main/packages/url_launcher/url_launcher
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+url_launcher%22
version: 6.3.0
version: 6.3.1

environment:
sdk: ^3.3.0
Expand Down

0 comments on commit 0097256

Please sign in to comment.