From bec6dafda7f36cbe9d02c35c72d1ef390166dbe5 Mon Sep 17 00:00:00 2001 From: Stuart Morgan Date: Wed, 27 Apr 2022 16:36:37 -0400 Subject: [PATCH 1/4] [url_launcher] Update README discussion of permissions Improves the README section about query permissions: - Removes http/https from the examples; we don't actually expect people to query for http(s) support in general (since generally a browser can assumed to be available), so it's an odd thing to show. - Updates the comments in the Android example to clarify that it's about querying for support, not launching. - Makes the iOS and Android sections have parallel structure so they are easier to read. Fixes https://github.com/flutter/flutter/issues/102630 --- .../url_launcher/url_launcher/CHANGELOG.md | 5 +++ packages/url_launcher/url_launcher/README.md | 35 +++++++++---------- .../android/app/src/main/AndroidManifest.xml | 4 --- .../url_launcher/url_launcher/pubspec.yaml | 2 +- 4 files changed, 22 insertions(+), 24 deletions(-) diff --git a/packages/url_launcher/url_launcher/CHANGELOG.md b/packages/url_launcher/url_launcher/CHANGELOG.md index b1ebc4b35a8e..2c3c9c0dadbd 100644 --- a/packages/url_launcher/url_launcher/CHANGELOG.md +++ b/packages/url_launcher/url_launcher/CHANGELOG.md @@ -1,3 +1,8 @@ +## 6.1.1 + +* Updates README section about query permissions to better reflect changes to + `canLaunchUrl` recommendations. + ## 6.1.0 * Introduces new `launchUrl` and `canLaunchUrl` APIs; `launch` and `canLaunch` diff --git a/packages/url_launcher/url_launcher/README.md b/packages/url_launcher/url_launcher/README.md index 0cdbe1b9859e..cc2c88c89fc3 100644 --- a/packages/url_launcher/url_launcher/README.md +++ b/packages/url_launcher/url_launcher/README.md @@ -43,14 +43,15 @@ See the example app for more complex examples. ## Configuration ### iOS -Add any URL schemes passed to `canLaunchUrl` as `LSApplicationQueriesSchemes` entries in your Info.plist file. +Add any URL schemes passed to `canLaunchUrl` as `LSApplicationQueriesSchemes` +entries in your Info.plist file, otherwise it will return false. Example: -``` +```xml LSApplicationQueriesSchemes - https - http + sms + tel ``` @@ -58,33 +59,25 @@ See [`-[UIApplication canOpenURL:]`](https://developer.apple.com/documentation/u ### Android -Starting from API 30 Android requires package visibility configuration in your -`AndroidManifest.xml` otherwise `canLaunchUrl` will return `false`. A `` +Add any URL schemes passed to `canLaunchUrl` as `` entries in your +`AndroidManifest.xml`, otherwise it will return false in most cases starting +on Android 11 (API 30) or higher. A `` element must be added to your manifest as a child of the root element. -The snippet below shows an example for an application that uses `https`, `tel`, -and `mailto` URLs with `url_launcher`. See -[the Android documentation](https://developer.android.com/training/package-visibility/use-cases) -for examples of other queries. - +Example: ``` xml - - - - - - + - + - + @@ -92,6 +85,10 @@ for examples of other queries. ``` +See +[the Android documentation](https://developer.android.com/training/package-visibility/use-cases) +for examples of other queries. + ## Supported URL schemes The provided URL is passed directly to the host platform for handling. The diff --git a/packages/url_launcher/url_launcher/example/android/app/src/main/AndroidManifest.xml b/packages/url_launcher/url_launcher/example/android/app/src/main/AndroidManifest.xml index fa149f94adf0..31b012599f4c 100644 --- a/packages/url_launcher/url_launcher/example/android/app/src/main/AndroidManifest.xml +++ b/packages/url_launcher/url_launcher/example/android/app/src/main/AndroidManifest.xml @@ -9,10 +9,6 @@ - - - - diff --git a/packages/url_launcher/url_launcher/pubspec.yaml b/packages/url_launcher/url_launcher/pubspec.yaml index 6803d71032cb..c14b62a1e70a 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/plugins/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.1.0 +version: 6.1.1 environment: sdk: ">=2.14.0 <3.0.0" From fe9f2c86a96e94bfe24d6d58c41d444a56860c19 Mon Sep 17 00:00:00 2001 From: stuartmorgan Date: Thu, 19 May 2022 11:48:40 -0400 Subject: [PATCH 2/4] Update Android queries --- packages/url_launcher/url_launcher/README.md | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/packages/url_launcher/url_launcher/README.md b/packages/url_launcher/url_launcher/README.md index cc2c88c89fc3..9ef6b5aac5c7 100644 --- a/packages/url_launcher/url_launcher/README.md +++ b/packages/url_launcher/url_launcher/README.md @@ -67,20 +67,15 @@ element must be added to your manifest as a child of the root element. Example: ``` xml - - - - - - - + + - + - - + + ``` From a6f716771ffa6c1cc4774e097d0f9f25bbca796d Mon Sep 17 00:00:00 2001 From: stuartmorgan Date: Thu, 19 May 2022 11:50:27 -0400 Subject: [PATCH 3/4] Update manifest to match --- .../example/android/app/src/main/AndroidManifest.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/url_launcher/url_launcher/example/android/app/src/main/AndroidManifest.xml b/packages/url_launcher/url_launcher/example/android/app/src/main/AndroidManifest.xml index 31b012599f4c..2813fb49c08a 100644 --- a/packages/url_launcher/url_launcher/example/android/app/src/main/AndroidManifest.xml +++ b/packages/url_launcher/url_launcher/example/android/app/src/main/AndroidManifest.xml @@ -10,12 +10,12 @@ - + - - + + From f0fbf7c2dec569b33ce388da70da093fc64b8a8f Mon Sep 17 00:00:00 2001 From: stuartmorgan Date: Tue, 7 Jun 2022 11:38:15 -0400 Subject: [PATCH 4/4] Re-add https query permission for tests --- .../example/android/app/src/main/AndroidManifest.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/url_launcher/url_launcher/example/android/app/src/main/AndroidManifest.xml b/packages/url_launcher/url_launcher/example/android/app/src/main/AndroidManifest.xml index 2813fb49c08a..5c0d0afa0fe4 100644 --- a/packages/url_launcher/url_launcher/example/android/app/src/main/AndroidManifest.xml +++ b/packages/url_launcher/url_launcher/example/android/app/src/main/AndroidManifest.xml @@ -9,6 +9,10 @@ + + + +