diff --git a/packages/url_launcher/url_launcher_android/CHANGELOG.md b/packages/url_launcher/url_launcher_android/CHANGELOG.md index b8f685f30f8..fd8418f004d 100644 --- a/packages/url_launcher/url_launcher_android/CHANGELOG.md +++ b/packages/url_launcher/url_launcher_android/CHANGELOG.md @@ -1,3 +1,8 @@ +## 6.3.21 + +* Updates minimum supported SDK version to Flutter 3.35. +* Removes obsolete code related to supporting SDK <24. + ## 6.3.20 * Restore SDK 21-23 support, as the previous change was intended @@ -5,6 +10,7 @@ ## 6.3.19 +* **Retracted** due to not including the Flutter min SDK change. * Updates minimum supported SDK version to Flutter 3.35. * Removes obsolete code related to supporting SDK <24. diff --git a/packages/url_launcher/url_launcher_android/android/build.gradle b/packages/url_launcher/url_launcher_android/android/build.gradle index 390519a37a8..825ddeabad5 100644 --- a/packages/url_launcher/url_launcher_android/android/build.gradle +++ b/packages/url_launcher/url_launcher_android/android/build.gradle @@ -29,7 +29,7 @@ android { compileSdk = flutter.compileSdkVersion defaultConfig { - minSdkVersion 21 + minSdkVersion 24 testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } diff --git a/packages/url_launcher/url_launcher_android/android/src/main/java/io/flutter/plugins/urllauncher/WebViewActivity.java b/packages/url_launcher/url_launcher_android/android/src/main/java/io/flutter/plugins/urllauncher/WebViewActivity.java index 3ae49cece79..026e86a4fc1 100644 --- a/packages/url_launcher/url_launcher_android/android/src/main/java/io/flutter/plugins/urllauncher/WebViewActivity.java +++ b/packages/url_launcher/url_launcher_android/android/src/main/java/io/flutter/plugins/urllauncher/WebViewActivity.java @@ -9,7 +9,6 @@ import android.content.Context; import android.content.Intent; import android.content.IntentFilter; -import android.os.Build; import android.os.Bundle; import android.os.Message; import android.provider.Browser; @@ -20,7 +19,6 @@ import android.webkit.WebViewClient; import androidx.annotation.NonNull; import androidx.annotation.Nullable; -import androidx.annotation.RequiresApi; import androidx.annotation.VisibleForTesting; import androidx.core.content.ContextCompat; import java.util.Collections; @@ -49,7 +47,6 @@ public void onReceive(Context context, Intent intent) { private final WebViewClient webViewClient = new WebViewClient() { - @RequiresApi(Build.VERSION_CODES.N) @Override public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) { view.loadUrl(request.getUrl().toString()); @@ -75,17 +72,6 @@ public boolean shouldOverrideUrlLoading( webview.loadUrl(request.getUrl().toString()); return true; } - - /* - * This method is deprecated in API 24. Still overridden to support - * earlier Android versions. - */ - @SuppressWarnings("deprecation") - @Override - public boolean shouldOverrideUrlLoading(WebView view, String url) { - webview.loadUrl(url); - return true; - } }; final WebView newWebView = new WebView(webview.getContext()); diff --git a/packages/url_launcher/url_launcher_android/example/lib/main.dart b/packages/url_launcher/url_launcher_android/example/lib/main.dart index 5fca7946a83..30bc2ae2893 100644 --- a/packages/url_launcher/url_launcher_android/example/lib/main.dart +++ b/packages/url_launcher/url_launcher_android/example/lib/main.dart @@ -166,76 +166,67 @@ class _MyHomePageState extends State { ), ), ElevatedButton( - onPressed: - _hasCallSupport - ? () => setState(() { - _launched = _makePhoneCall(_phone); - }) - : null, - child: - _hasCallSupport - ? const Text('Make phone call') - : const Text('Calling not supported'), + onPressed: _hasCallSupport + ? () => setState(() { + _launched = _makePhoneCall(_phone); + }) + : null, + child: _hasCallSupport + ? const Text('Make phone call') + : const Text('Calling not supported'), ), const Padding( padding: EdgeInsets.all(16.0), child: Text(toLaunch), ), ElevatedButton( - onPressed: - _hasCustomTabSupport - ? () => setState(() { - _launched = _launchInBrowser(toLaunch); - }) - : null, + onPressed: _hasCustomTabSupport + ? () => setState(() { + _launched = _launchInBrowser(toLaunch); + }) + : null, child: const Text('Launch in browser'), ), const Padding(padding: EdgeInsets.all(16.0)), ElevatedButton( - onPressed: - () => setState(() { - _launched = _launchInCustomTab(toLaunch); - }), + onPressed: () => setState(() { + _launched = _launchInCustomTab(toLaunch); + }), child: const Text('Launch in Android Custom Tab'), ), const Padding(padding: EdgeInsets.all(16.0)), ElevatedButton( - onPressed: - () => setState(() { - _launched = _launchInWebView(toLaunch); - }), + onPressed: () => setState(() { + _launched = _launchInWebView(toLaunch); + }), child: const Text('Launch in web view'), ), ElevatedButton( - onPressed: - () => setState(() { - _launched = _launchInWebViewWithCustomHeaders(toLaunch); - }), + onPressed: () => setState(() { + _launched = _launchInWebViewWithCustomHeaders(toLaunch); + }), child: const Text('Launch in web view (Custom headers)'), ), ElevatedButton( - onPressed: - () => setState(() { - _launched = _launchInWebViewWithoutJavaScript(toLaunch); - }), + onPressed: () => setState(() { + _launched = _launchInWebViewWithoutJavaScript(toLaunch); + }), child: const Text('Launch in web view (JavaScript OFF)'), ), ElevatedButton( - onPressed: - () => setState(() { - _launched = _launchInWebViewWithoutDomStorage(toLaunch); - }), + onPressed: () => setState(() { + _launched = _launchInWebViewWithoutDomStorage(toLaunch); + }), child: const Text('Launch in web view (DOM storage OFF)'), ), const Padding(padding: EdgeInsets.all(16.0)), ElevatedButton( - onPressed: - () => setState(() { - _launched = _launchInWebView(toLaunch); - Timer(const Duration(seconds: 5), () { - launcher.closeWebView(); - }); - }), + onPressed: () => setState(() { + _launched = _launchInWebView(toLaunch); + Timer(const Duration(seconds: 5), () { + launcher.closeWebView(); + }); + }), child: const Text('Launch in web view + close after 5 seconds'), ), const Padding(padding: EdgeInsets.all(16.0)), diff --git a/packages/url_launcher/url_launcher_android/example/pubspec.yaml b/packages/url_launcher/url_launcher_android/example/pubspec.yaml index 4649b5f34a0..fbb30490788 100644 --- a/packages/url_launcher/url_launcher_android/example/pubspec.yaml +++ b/packages/url_launcher/url_launcher_android/example/pubspec.yaml @@ -3,8 +3,8 @@ description: Demonstrates how to use the url_launcher plugin. publish_to: none environment: - sdk: ^3.7.0 - flutter: ">=3.29.0" + sdk: ^3.9.0 + flutter: ">=3.35.0" dependencies: flutter: diff --git a/packages/url_launcher/url_launcher_android/lib/src/messages.g.dart b/packages/url_launcher/url_launcher_android/lib/src/messages.g.dart index b213ddd84a4..8de240486ce 100644 --- a/packages/url_launcher/url_launcher_android/lib/src/messages.g.dart +++ b/packages/url_launcher/url_launcher_android/lib/src/messages.g.dart @@ -102,8 +102,9 @@ class UrlLauncherApi { BinaryMessenger? binaryMessenger, String messageChannelSuffix = '', }) : pigeonVar_binaryMessenger = binaryMessenger, - pigeonVar_messageChannelSuffix = - messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; + pigeonVar_messageChannelSuffix = messageChannelSuffix.isNotEmpty + ? '.$messageChannelSuffix' + : ''; final BinaryMessenger? pigeonVar_binaryMessenger; static const MessageCodec pigeonChannelCodec = _PigeonCodec(); diff --git a/packages/url_launcher/url_launcher_android/lib/url_launcher_android.dart b/packages/url_launcher/url_launcher_android/lib/url_launcher_android.dart index d2dc3ca0068..8e874c0bcc8 100644 --- a/packages/url_launcher/url_launcher_android/lib/url_launcher_android.dart +++ b/packages/url_launcher/url_launcher_android/lib/url_launcher_android.dart @@ -62,10 +62,9 @@ class UrlLauncherAndroid extends UrlLauncherPlatform { return launchUrl( url, LaunchOptions( - mode: - useWebView - ? PreferredLaunchMode.inAppWebView - : PreferredLaunchMode.externalApplication, + mode: useWebView + ? PreferredLaunchMode.inAppWebView + : PreferredLaunchMode.externalApplication, webViewConfiguration: InAppWebViewConfiguration( enableDomStorage: enableDomStorage, enableJavaScript: enableJavaScript, diff --git a/packages/url_launcher/url_launcher_android/pubspec.yaml b/packages/url_launcher/url_launcher_android/pubspec.yaml index 5e024ca8910..7d254bc723d 100644 --- a/packages/url_launcher/url_launcher_android/pubspec.yaml +++ b/packages/url_launcher/url_launcher_android/pubspec.yaml @@ -2,11 +2,11 @@ name: url_launcher_android description: Android implementation of the url_launcher plugin. repository: https://github.com/flutter/packages/tree/main/packages/url_launcher/url_launcher_android issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+url_launcher%22 -version: 6.3.20 +version: 6.3.21 environment: - sdk: ^3.7.0 - flutter: ">=3.29.0" + sdk: ^3.9.0 + flutter: ">=3.35.0" flutter: plugin: