Skip to content

[webview_flutter_android] Adds internal wrapper methods for native WebViewClient. #8964

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Apr 14, 2025

Conversation

bparrishMines
Copy link
Contributor

@bparrishMines bparrishMines commented Mar 31, 2025

This adds the SSL classes for #7893 and a few extra WebViewClient methods.

Pre-Review Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene page, which explains my responsibilities.
  • I read and followed the relevant style guides and ran the auto-formatter. (Unlike the flutter/flutter repo, the flutter/packages repo does use dart format.)
  • I signed the CLA.
  • The title of the PR starts with the name of the package surrounded by square brackets, e.g. [shared_preferences]
  • I linked to at least one issue that this PR fixes in the description above.
  • I updated pubspec.yaml with an appropriate new version according to the pub versioning philosophy, or I have commented below to indicate which version change exemption this PR falls under1.
  • I updated CHANGELOG.md to add a description of the change, following repository CHANGELOG style, or I have commented below to indicate which CHANGELOG exemption this PR falls under1.
  • I updated/added any relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or I have commented below to indicate which test exemption this PR falls under1.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

Footnotes

  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. 2 3

@@ -52,6 +52,7 @@ android {
implementation 'androidx.annotation:annotation:1.9.1'
implementation 'androidx.webkit:webkit:1.12.1'
testImplementation 'junit:junit:4.13.2'
testImplementation 'org.mockito:mockito-core:5.16.1'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was required for me to run tests locally. I'm not sure if this is just me or not.

@@ -25,7 +25,7 @@ if (flutterVersionName == null) {
android {
namespace 'io.flutter.plugins.webviewflutterexample'
compileSdk = flutter.compileSdkVersion

ndkVersion = flutter.ndkVersion
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was also required for met to run tests locally.

@bparrishMines bparrishMines changed the title Webviewclient methods [webview_flutter_android] Adds internal wrapper methods for native WebViewClient. Apr 6, 2025
@bparrishMines bparrishMines marked this pull request as ready for review April 6, 2025 20:49
@stuartmorgan-g
Copy link
Contributor

Fixes flutter/flutter#164132 by passing a TestInstanceManager when needed.

Wrong issue link? That one is about camera.

Copy link
Contributor

@stuartmorgan-g stuartmorgan-g left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with a few minor comments

@@ -513,7 +582,7 @@ abstract class WebChromeClient {
late List<String> Function(
WebView webView,
FileChooserParams params,
)? onShowFileChooser;
) onShowFileChooser;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the change to non-nullable on these callbacks?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was caused by #8567. They are already implemented in the AndroidWebViewController: https://github.com/flutter/packages/blob/main/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_controller.dart#L187. The method just wasn't required on the Dart side.

@bparrishMines bparrishMines added the autosubmit Merge PR when tree becomes green via auto submit App label Apr 14, 2025
@auto-submit auto-submit bot merged commit 4389067 into flutter:main Apr 14, 2025
82 checks passed
@bparrishMines bparrishMines deleted the webviewclient_methods branch April 14, 2025 18:15
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Apr 15, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Apr 15, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Apr 15, 2025
github-merge-queue bot pushed a commit to flutter/flutter that referenced this pull request Apr 15, 2025
flutter/packages@f26b681...2fcc403

2025-04-15 [email protected]
[camera_android_camerax] Updates internal API wrapper to use ProxyApis
(flutter/packages#8618)
2025-04-14 [email protected] [tool] Run a config-only build before
Xcode analyze (flutter/packages#9075)
2025-04-14 [email protected]
[webview_flutter_android] Adds internal wrapper methods for native
`WebViewClient`. (flutter/packages#8964)
2025-04-14 [email protected]
[webview_flutter_wkwebview] Fixes `loadFlutterAsset` exception and
updates native wrapper for `SecTrust` and `SecCertificate`
(flutter/packages#9016)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC [email protected] on the revert to ensure that a
human
is aware of the problem.

To file a bug in Flutter:
https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
github-merge-queue bot pushed a commit to flutter/flutter that referenced this pull request Apr 15, 2025
flutter/packages@f26b681...2fcc403

2025-04-15 [email protected]
[camera_android_camerax] Updates internal API wrapper to use ProxyApis
(flutter/packages#8618)
2025-04-14 [email protected] [tool] Run a config-only build before
Xcode analyze (flutter/packages#9075)
2025-04-14 [email protected]
[webview_flutter_android] Adds internal wrapper methods for native
`WebViewClient`. (flutter/packages#8964)
2025-04-14 [email protected]
[webview_flutter_wkwebview] Fixes `loadFlutterAsset` exception and
updates native wrapper for `SecTrust` and `SecCertificate`
(flutter/packages#9016)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC [email protected] on the revert to ensure that a
human
is aware of the problem.

To file a bug in Flutter:
https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
mboetger pushed a commit to mboetger/flutter that referenced this pull request Apr 16, 2025
…r#167218)

flutter/packages@f26b681...2fcc403

2025-04-15 [email protected]
[camera_android_camerax] Updates internal API wrapper to use ProxyApis
(flutter/packages#8618)
2025-04-14 [email protected] [tool] Run a config-only build before
Xcode analyze (flutter/packages#9075)
2025-04-14 [email protected]
[webview_flutter_android] Adds internal wrapper methods for native
`WebViewClient`. (flutter/packages#8964)
2025-04-14 [email protected]
[webview_flutter_wkwebview] Fixes `loadFlutterAsset` exception and
updates native wrapper for `SecTrust` and `SecCertificate`
(flutter/packages#9016)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC [email protected] on the revert to ensure that a
human
is aware of the problem.

To file a bug in Flutter:
https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
ash2moon pushed a commit to ash2moon/flutter that referenced this pull request Apr 21, 2025
…r#167218)

flutter/packages@f26b681...2fcc403

2025-04-15 [email protected]
[camera_android_camerax] Updates internal API wrapper to use ProxyApis
(flutter/packages#8618)
2025-04-14 [email protected] [tool] Run a config-only build before
Xcode analyze (flutter/packages#9075)
2025-04-14 [email protected]
[webview_flutter_android] Adds internal wrapper methods for native
`WebViewClient`. (flutter/packages#8964)
2025-04-14 [email protected]
[webview_flutter_wkwebview] Fixes `loadFlutterAsset` exception and
updates native wrapper for `SecTrust` and `SecCertificate`
(flutter/packages#9016)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC [email protected] on the revert to ensure that a
human
is aware of the problem.

To file a bug in Flutter:
https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
nick-llewellyn pushed a commit to labrystechnology/flutter_packages that referenced this pull request Apr 23, 2025
…ebViewClient`. (flutter#8964)

This adds the SSL classes for flutter#7893 and a few extra `WebViewClient` methods.

## 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autosubmit Merge PR when tree becomes green via auto submit App p: webview_flutter platform-android
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants