This repository was archived by the owner on Feb 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
[url_launcher] Suppress deprecation warning in WebViewActivity #3008
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
amirh
reviewed
Sep 8, 2020
* This method is deprecated in API 24. Still overridden to support | ||
* earlier Android versions. | ||
*/ | ||
@SuppressWarnings("deprecation") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TBH looking at this snippet now I'm confused at all as to why we override this method in order to directly call loadUrl on older Android versions?
I left a question on the PR that added this though it was a year ago so not sure if the author will still be able to provide info: https://github.com/flutter/plugins/pull/1848/files#r485141991
amirh
approved these changes
Sep 8, 2020
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
12 tasks
danielroek
pushed a commit
to Baseflow/flutter-plugins
that referenced
this pull request
Sep 18, 2020
…er#3008) The url_launcher overrides the deprecated shouldOverrideUrlLoading(WebView view, String url) method to be backwards compatible with versions before Android API 24. This however currently displays the warning "WebViewActivity.java uses or overrides a deprecated API." when building for Android. This is causing some problems for developers who treat these warnings as errors as part of their build configuration. This PR addresses this issue by annotating the shouldOverrideUrlLoading(WebView view, String url) method with the @SuppressWarnings("deprecation") attribute. This PR also adds the @RequiresApi(Build.VERSION_CODES.N) annotation to the shouldOverrideUrlLoading(WebView view, WebResourceRequest request) method, which gives the Android/ Java tooling an indication this method should only by used from API 24 and higher.
jorgefspereira
pushed a commit
to jorgefspereira/plugins_flutter
that referenced
this pull request
Oct 10, 2020
…er#3008) The url_launcher overrides the deprecated shouldOverrideUrlLoading(WebView view, String url) method to be backwards compatible with versions before Android API 24. This however currently displays the warning "WebViewActivity.java uses or overrides a deprecated API." when building for Android. This is causing some problems for developers who treat these warnings as errors as part of their build configuration. This PR addresses this issue by annotating the shouldOverrideUrlLoading(WebView view, String url) method with the @SuppressWarnings("deprecation") attribute. This PR also adds the @RequiresApi(Build.VERSION_CODES.N) annotation to the shouldOverrideUrlLoading(WebView view, WebResourceRequest request) method, which gives the Android/ Java tooling an indication this method should only by used from API 24 and higher.
FlutterSu
pushed a commit
to FlutterSu/flutter-plugins
that referenced
this pull request
Nov 20, 2020
…er#3008) The url_launcher overrides the deprecated shouldOverrideUrlLoading(WebView view, String url) method to be backwards compatible with versions before Android API 24. This however currently displays the warning "WebViewActivity.java uses or overrides a deprecated API." when building for Android. This is causing some problems for developers who treat these warnings as errors as part of their build configuration. This PR addresses this issue by annotating the shouldOverrideUrlLoading(WebView view, String url) method with the @SuppressWarnings("deprecation") attribute. This PR also adds the @RequiresApi(Build.VERSION_CODES.N) annotation to the shouldOverrideUrlLoading(WebView view, WebResourceRequest request) method, which gives the Android/ Java tooling an indication this method should only by used from API 24 and higher.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
The url_launcher overrides the deprecated
shouldOverrideUrlLoading(WebView view, String url)
method to be backwards compatible with versions before Android API 24. This however currently displays the warning "WebViewActivity.java uses or overrides a deprecated API." when building for Android. This is causing some problems for developers who treat these warnings as errors as part of their build configuration.This PR addresses this issue by annotating the
shouldOverrideUrlLoading(WebView view, String url)
method with the@SuppressWarnings("deprecation")
attribute.This PR also adds the
@RequiresApi(Build.VERSION_CODES.N)
annotation to theshouldOverrideUrlLoading(WebView view, WebResourceRequest request)
method, which gives the Android/ Java tooling an indication this method should only by used from API 24 and higher.Related Issues
Checklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]
). This will ensure a smooth and quick review process.///
).flutter analyze
) does not report any problems on my PR.Breaking Change
Does your PR require plugin users to manually update their apps to accommodate your change?