From 552b2a882bc796eab8a2d85096328c7717d28608 Mon Sep 17 00:00:00 2001 From: Stuart Morgan Date: Mon, 7 Oct 2024 11:22:56 -0400 Subject: [PATCH] [url_launcher] Remove incorrect SMS instructions Removes incorrect instructions for SMS that were added in https://github.com/flutter/plugins/pull/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 https://github.com/flutter/flutter/issues/18823 and https://github.com/flutter/flutter/issues/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 https://github.com/flutter/flutter/issues/156281 --- .../url_launcher/url_launcher/CHANGELOG.md | 3 ++- packages/url_launcher/url_launcher/README.md | 13 ------------- .../url_launcher/example/lib/encoding.dart | 18 ------------------ .../url_launcher/url_launcher/pubspec.yaml | 2 +- 4 files changed, 3 insertions(+), 33 deletions(-) diff --git a/packages/url_launcher/url_launcher/CHANGELOG.md b/packages/url_launcher/url_launcher/CHANGELOG.md index a01d7f443ea..859646fbe7b 100644 --- a/packages/url_launcher/url_launcher/CHANGELOG.md +++ b/packages/url_launcher/url_launcher/CHANGELOG.md @@ -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 diff --git a/packages/url_launcher/url_launcher/README.md b/packages/url_launcher/url_launcher/README.md index 5955540491e..301c0a068e1 100644 --- a/packages/url_launcher/url_launcher/README.md +++ b/packages/url_launcher/url_launcher/README.md @@ -170,19 +170,6 @@ String? encodeQueryParameters(Map params) { launchUrl(emailLaunchUri); ``` -Encoding for `sms` is slightly different: - - -```dart -final Uri smsLaunchUri = Uri( - scheme: 'sms', - path: '0118 999 881 999 119 7253', - queryParameters: { - '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 diff --git a/packages/url_launcher/url_launcher/example/lib/encoding.dart b/packages/url_launcher/url_launcher/example/lib/encoding.dart index 0875a858726..f3bcc57cbda 100644 --- a/packages/url_launcher/url_launcher/example/lib/encoding.dart +++ b/packages/url_launcher/url_launcher/example/lib/encoding.dart @@ -31,10 +31,6 @@ void main() => runApp( onPressed: _composeMail, child: Text('Compose an email'), ), - ElevatedButton( - onPressed: _composeSms, - child: Text('Compose a SMS'), - ), ], ), ), @@ -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: { - 'body': Uri.encodeComponent('Example Subject & Symbols are allowed!'), - }, - ); -// #enddocregion sms - - launchUrl(smsLaunchUri); -} diff --git a/packages/url_launcher/url_launcher/pubspec.yaml b/packages/url_launcher/url_launcher/pubspec.yaml index 0986d50d437..3b594e883fb 100644 --- a/packages/url_launcher/url_launcher/pubspec.yaml +++ b/packages/url_launcher/url_launcher/pubspec.yaml @@ -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