Skip to content

Commit 42356d3

Browse files
stuartmorgan-gdanferreira
authored andcommitted
[url_launcher] Temporarily restore Android 21 support (#9986)
The change to drop API 21-23 support was intended to set the minimum Flutter version to 3.35, but didn't actually do so. This reverts the changes to drop 21-23, so that anyone who got the broken version can update to a working version, and then I'll follow up with a new PR that re-lands the change but with the missed SDK constraint change. ## Pre-Review Checklist [^1]: Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling.
1 parent 850be24 commit 42356d3

File tree

4 files changed

+21
-2
lines changed

4 files changed

+21
-2
lines changed

packages/url_launcher/url_launcher_android/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 6.3.20
2+
3+
* Restore SDK 21-23 support, as the previous change was intended
4+
to require Flutter 3.35, but didn't.
5+
16
## 6.3.19
27

38
* Updates minimum supported SDK version to Flutter 3.35.

packages/url_launcher/url_launcher_android/android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ android {
2929
compileSdk = flutter.compileSdkVersion
3030

3131
defaultConfig {
32-
minSdkVersion 24
32+
minSdkVersion 21
3333
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
3434
}
3535

packages/url_launcher/url_launcher_android/android/src/main/java/io/flutter/plugins/urllauncher/WebViewActivity.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import android.content.Context;
1010
import android.content.Intent;
1111
import android.content.IntentFilter;
12+
import android.os.Build;
1213
import android.os.Bundle;
1314
import android.os.Message;
1415
import android.provider.Browser;
@@ -19,6 +20,7 @@
1920
import android.webkit.WebViewClient;
2021
import androidx.annotation.NonNull;
2122
import androidx.annotation.Nullable;
23+
import androidx.annotation.RequiresApi;
2224
import androidx.annotation.VisibleForTesting;
2325
import androidx.core.content.ContextCompat;
2426
import java.util.Collections;
@@ -47,6 +49,7 @@ public void onReceive(Context context, Intent intent) {
4749

4850
private final WebViewClient webViewClient =
4951
new WebViewClient() {
52+
@RequiresApi(Build.VERSION_CODES.N)
5053
@Override
5154
public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) {
5255
view.loadUrl(request.getUrl().toString());
@@ -72,6 +75,17 @@ public boolean shouldOverrideUrlLoading(
7275
webview.loadUrl(request.getUrl().toString());
7376
return true;
7477
}
78+
79+
/*
80+
* This method is deprecated in API 24. Still overridden to support
81+
* earlier Android versions.
82+
*/
83+
@SuppressWarnings("deprecation")
84+
@Override
85+
public boolean shouldOverrideUrlLoading(WebView view, String url) {
86+
webview.loadUrl(url);
87+
return true;
88+
}
7589
};
7690

7791
final WebView newWebView = new WebView(webview.getContext());

packages/url_launcher/url_launcher_android/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: url_launcher_android
22
description: Android implementation of the url_launcher plugin.
33
repository: https://github.com/flutter/packages/tree/main/packages/url_launcher/url_launcher_android
44
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+url_launcher%22
5-
version: 6.3.19
5+
version: 6.3.20
66

77
environment:
88
sdk: ^3.7.0

0 commit comments

Comments
 (0)