Skip to content

Commit ea3e2d8

Browse files
stuartmorgan-gdanferreira
authored andcommitted
[url_launcher] Re-remove Android API<24 support (#9987)
This re-lands the `url_launcher_android` portion of #9851, which was reverted in #9986, but with the missing min SDK update this time. Part of flutter/flutter#170807 ## 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 42356d3 commit ea3e2d8

File tree

8 files changed

+52
-69
lines changed

8 files changed

+52
-69
lines changed

packages/url_launcher/url_launcher_android/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
1+
## 6.3.21
2+
3+
* Updates minimum supported SDK version to Flutter 3.35.
4+
* Removes obsolete code related to supporting SDK <24.
5+
16
## 6.3.20
27

38
* Restore SDK 21-23 support, as the previous change was intended
49
to require Flutter 3.35, but didn't.
510

611
## 6.3.19
712

13+
* **Retracted** due to not including the Flutter min SDK change.
814
* Updates minimum supported SDK version to Flutter 3.35.
915
* Removes obsolete code related to supporting SDK <24.
1016

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 21
32+
minSdkVersion 24
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: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import android.content.Context;
1010
import android.content.Intent;
1111
import android.content.IntentFilter;
12-
import android.os.Build;
1312
import android.os.Bundle;
1413
import android.os.Message;
1514
import android.provider.Browser;
@@ -20,7 +19,6 @@
2019
import android.webkit.WebViewClient;
2120
import androidx.annotation.NonNull;
2221
import androidx.annotation.Nullable;
23-
import androidx.annotation.RequiresApi;
2422
import androidx.annotation.VisibleForTesting;
2523
import androidx.core.content.ContextCompat;
2624
import java.util.Collections;
@@ -49,7 +47,6 @@ public void onReceive(Context context, Intent intent) {
4947

5048
private final WebViewClient webViewClient =
5149
new WebViewClient() {
52-
@RequiresApi(Build.VERSION_CODES.N)
5350
@Override
5451
public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) {
5552
view.loadUrl(request.getUrl().toString());
@@ -75,17 +72,6 @@ public boolean shouldOverrideUrlLoading(
7572
webview.loadUrl(request.getUrl().toString());
7673
return true;
7774
}
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-
}
8975
};
9076

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

packages/url_launcher/url_launcher_android/example/lib/main.dart

Lines changed: 34 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -166,76 +166,67 @@ class _MyHomePageState extends State<MyHomePage> {
166166
),
167167
),
168168
ElevatedButton(
169-
onPressed:
170-
_hasCallSupport
171-
? () => setState(() {
172-
_launched = _makePhoneCall(_phone);
173-
})
174-
: null,
175-
child:
176-
_hasCallSupport
177-
? const Text('Make phone call')
178-
: const Text('Calling not supported'),
169+
onPressed: _hasCallSupport
170+
? () => setState(() {
171+
_launched = _makePhoneCall(_phone);
172+
})
173+
: null,
174+
child: _hasCallSupport
175+
? const Text('Make phone call')
176+
: const Text('Calling not supported'),
179177
),
180178
const Padding(
181179
padding: EdgeInsets.all(16.0),
182180
child: Text(toLaunch),
183181
),
184182
ElevatedButton(
185-
onPressed:
186-
_hasCustomTabSupport
187-
? () => setState(() {
188-
_launched = _launchInBrowser(toLaunch);
189-
})
190-
: null,
183+
onPressed: _hasCustomTabSupport
184+
? () => setState(() {
185+
_launched = _launchInBrowser(toLaunch);
186+
})
187+
: null,
191188
child: const Text('Launch in browser'),
192189
),
193190
const Padding(padding: EdgeInsets.all(16.0)),
194191
ElevatedButton(
195-
onPressed:
196-
() => setState(() {
197-
_launched = _launchInCustomTab(toLaunch);
198-
}),
192+
onPressed: () => setState(() {
193+
_launched = _launchInCustomTab(toLaunch);
194+
}),
199195
child: const Text('Launch in Android Custom Tab'),
200196
),
201197
const Padding(padding: EdgeInsets.all(16.0)),
202198
ElevatedButton(
203-
onPressed:
204-
() => setState(() {
205-
_launched = _launchInWebView(toLaunch);
206-
}),
199+
onPressed: () => setState(() {
200+
_launched = _launchInWebView(toLaunch);
201+
}),
207202
child: const Text('Launch in web view'),
208203
),
209204
ElevatedButton(
210-
onPressed:
211-
() => setState(() {
212-
_launched = _launchInWebViewWithCustomHeaders(toLaunch);
213-
}),
205+
onPressed: () => setState(() {
206+
_launched = _launchInWebViewWithCustomHeaders(toLaunch);
207+
}),
214208
child: const Text('Launch in web view (Custom headers)'),
215209
),
216210
ElevatedButton(
217-
onPressed:
218-
() => setState(() {
219-
_launched = _launchInWebViewWithoutJavaScript(toLaunch);
220-
}),
211+
onPressed: () => setState(() {
212+
_launched = _launchInWebViewWithoutJavaScript(toLaunch);
213+
}),
221214
child: const Text('Launch in web view (JavaScript OFF)'),
222215
),
223216
ElevatedButton(
224-
onPressed:
225-
() => setState(() {
226-
_launched = _launchInWebViewWithoutDomStorage(toLaunch);
227-
}),
217+
onPressed: () => setState(() {
218+
_launched = _launchInWebViewWithoutDomStorage(toLaunch);
219+
}),
228220
child: const Text('Launch in web view (DOM storage OFF)'),
229221
),
230222
const Padding(padding: EdgeInsets.all(16.0)),
231223
ElevatedButton(
232-
onPressed:
233-
() => setState(() {
234-
_launched = _launchInWebView(toLaunch);
235-
Timer(const Duration(seconds: 5), () {
236-
launcher.closeWebView();
237-
});
238-
}),
224+
onPressed: () => setState(() {
225+
_launched = _launchInWebView(toLaunch);
226+
Timer(const Duration(seconds: 5), () {
227+
launcher.closeWebView();
228+
});
229+
}),
239230
child: const Text('Launch in web view + close after 5 seconds'),
240231
),
241232
const Padding(padding: EdgeInsets.all(16.0)),

packages/url_launcher/url_launcher_android/example/pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ description: Demonstrates how to use the url_launcher plugin.
33
publish_to: none
44

55
environment:
6-
sdk: ^3.7.0
7-
flutter: ">=3.29.0"
6+
sdk: ^3.9.0
7+
flutter: ">=3.35.0"
88

99
dependencies:
1010
flutter:

packages/url_launcher/url_launcher_android/lib/src/messages.g.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,9 @@ class UrlLauncherApi {
102102
BinaryMessenger? binaryMessenger,
103103
String messageChannelSuffix = '',
104104
}) : pigeonVar_binaryMessenger = binaryMessenger,
105-
pigeonVar_messageChannelSuffix =
106-
messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : '';
105+
pigeonVar_messageChannelSuffix = messageChannelSuffix.isNotEmpty
106+
? '.$messageChannelSuffix'
107+
: '';
107108
final BinaryMessenger? pigeonVar_binaryMessenger;
108109

109110
static const MessageCodec<Object?> pigeonChannelCodec = _PigeonCodec();

packages/url_launcher/url_launcher_android/lib/url_launcher_android.dart

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,9 @@ class UrlLauncherAndroid extends UrlLauncherPlatform {
6262
return launchUrl(
6363
url,
6464
LaunchOptions(
65-
mode:
66-
useWebView
67-
? PreferredLaunchMode.inAppWebView
68-
: PreferredLaunchMode.externalApplication,
65+
mode: useWebView
66+
? PreferredLaunchMode.inAppWebView
67+
: PreferredLaunchMode.externalApplication,
6968
webViewConfiguration: InAppWebViewConfiguration(
7069
enableDomStorage: enableDomStorage,
7170
enableJavaScript: enableJavaScript,

packages/url_launcher/url_launcher_android/pubspec.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ 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.20
5+
version: 6.3.21
66

77
environment:
8-
sdk: ^3.7.0
9-
flutter: ">=3.29.0"
8+
sdk: ^3.9.0
9+
flutter: ">=3.35.0"
1010

1111
flutter:
1212
plugin:

0 commit comments

Comments
 (0)