-
Notifications
You must be signed in to change notification settings - Fork 9.8k
[webview_flutter] Update webview packages for Android and iOS to implement runJavascript
and runJavascriptReturningResult
.
#4402
[webview_flutter] Update webview packages for Android and iOS to implement runJavascript
and runJavascriptReturningResult
.
#4402
Conversation
…e with new methods for running JavaScript
…sult` in iOS and Android packages.
runJavaScript
and runJavaScriptForResult
.runJavascript
and runJavascriptReturningResult
.
I think I've fixed every case now where "JavaScript" could be used, while still using "Javascript" where it was needed to either stay consistent or prevent a breaking change. If you still find any cases I missed, let me know! |
@stuartmorgan Would you be able to take another look at this please? |
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.
Small things, otherwise LG
...webview_flutter/webview_flutter_wkwebview/example/integration_test/webview_flutter_test.dart
Outdated
Show resolved
Hide resolved
packages/webview_flutter/webview_flutter_wkwebview/example/ios/Podfile
Outdated
Show resolved
Hide resolved
packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FlutterWebView.m
Outdated
Show resolved
Hide resolved
packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FlutterWebView.m
Outdated
Show resolved
Hide resolved
packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FlutterWebView.m
Outdated
Show resolved
Hide resolved
packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FlutterWebView.m
Outdated
Show resolved
Hide resolved
packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FlutterWebView.m
Outdated
Show resolved
Hide resolved
@stuartmorgan All PR feedback has been implemented. I however came across one issue with either the formatter or the format check: they seem to disagree. When formatting the webview plugin with the included script ( I've fixed it now based on the output from cirrus so that this PR passes the check, but it does not fix the problem with the formatter. |
The script and the format check are exactly the same thing; what disagrees is the version of clang-format on the bots and the version you have locally. |
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 with one nit. Thanks!
@@ -110,11 +110,11 @@ void main() { | |||
await pageLoads.stream.firstWhere((String url) => url == currentUrl); | |||
|
|||
final String content = await controller | |||
.evaluateJavascript('document.documentElement.innerText'); |
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.
I just realized that in both implementation packages you've replaced all instances of evaluateJavascript
with one of the new methods, which means we no longer have any test coverage that the legacy method still works.
Please add a new test to both the Android and iOS packages that does a simple test of evaluateJavascript
(including its return result) just to make sure we have sanity coverage that it's not broken. (It doesn't need to cover edge cases, it's mostly to make sure that, e.g., we'd notice if the case
statement for mapping "evaluateJavascript"
to the right helper method were dropped.)
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.
New tests LGTM, thanks
… to implement `runJavascript` and `runJavascriptReturningResult`. (flutter/plugins#4402)
… to implement `runJavascript` and `runJavascriptReturningResult`. (flutter/plugins#4402)
* master: [webview_flutter] Deprecate evaluateJavascript in favour of runJavaScript and runJavaScriptForResult. (flutter#4403) [webview_flutter] Add interface methods to load local files and HTML strings. (flutter#4446) [ci] add pedantic dep to new in_app_purchase pkgs (flutter#4471) [ci] Remove unused dep from file_selector. (flutter#4468) [ci] update build_runner dep in android_intent and file_selector example (flutter#4467) [webview_flutter] Add platform interface method `loadRequest`. (flutter#4450) Remove -Werror from deprecated plugin Android builds (flutter#4466) [webview_flutter] Update webview packages for Android and iOS to implement `runJavascript` and `runJavascriptReturningResult`. (flutter#4402) [camera] Fix CamcorderProfile Usages (flutter#4423) [google_sign_in] Use a transparent image as a placeholder for the `GoogleUserCircleAvatar` (flutter#4391) [in_app_purchase]IAP/platform interface add cancel status (flutter#4093) [image_picker] doc:readme image picker misprints (flutter#4421) Support Hybrid Composition through the GoogleMaps Widget (flutter#4082) [path_provider] started supporting background platform channels (flutter#4443) [device_info] started using Background Platform Channels (flutter#4456) # Conflicts: # packages/webview_flutter/webview_flutter/CHANGELOG.md # packages/webview_flutter/webview_flutter/pubspec.yaml
…ement `runJavascript` and `runJavascriptReturningResult`. (flutter#4402) * [webview_flutter_platform_interface] Update webview platform interface with new methods for running JavaScript * Fix tests * [webview_flutter] Implemented `runJavaScript` and `runJavaScriptForResult` in iOS and Android packages. * Remove accidental development team inclusion from project.pbxproj * Implemented PR feedback * Updated runJavaScriptForResult behaviour * Implemented PR feedback partially * Implement PR feedback * Update changelog * Implement PR feedback from interface PR * Update changelog * Revert inclusion of development team * Implement PR feedback * Implemented platform interface PR feedback * Update pubspec dependency * Fixed capitalisation * Fixed capitalisation * Fix warning * Partially implement PR feedback * Partially implement PR feedback * Format * Update podfile * Update podfile * Update podfiles * Update iOS project files * Update podspec * Remove unnecessary podfile configuration * Implemented PR feedback * Format * Revert podfile changes * Implemented PR feedback * Fix formatting * Fix formatting * Fixed test. * Re-add integration tests for deprecated evaluateJavascript method. * Fix merge conflicts
…ement `runJavascript` and `runJavascriptReturningResult`. (flutter#4402) * [webview_flutter_platform_interface] Update webview platform interface with new methods for running JavaScript * Fix tests * [webview_flutter] Implemented `runJavaScript` and `runJavaScriptForResult` in iOS and Android packages. * Remove accidental development team inclusion from project.pbxproj * Implemented PR feedback * Updated runJavaScriptForResult behaviour * Implemented PR feedback partially * Implement PR feedback * Update changelog * Implement PR feedback from interface PR * Update changelog * Revert inclusion of development team * Implement PR feedback * Implemented platform interface PR feedback * Update pubspec dependency * Fixed capitalisation * Fixed capitalisation * Fix warning * Partially implement PR feedback * Partially implement PR feedback * Format * Update podfile * Update podfile * Update podfiles * Update iOS project files * Update podspec * Remove unnecessary podfile configuration * Implemented PR feedback * Format * Revert podfile changes * Implemented PR feedback * Fix formatting * Fix formatting * Fixed test. * Re-add integration tests for deprecated evaluateJavascript method. * Fix merge conflicts
This PR implements the newly added
runJavaScript
andrunJavaScriptForResult
methods added to the platform interface in #4401.This is meant as a solution to the issue mentioned in flutter/flutter#66318, and was discussed offline with @mvanbeusekom and @stuartmorgan.
As this PR also depends on and includes the changes from #4401, this PR will remain in draft state until that PR is merged and published.
Relevant issue:
Pre-launch Checklist
dart format
.)[shared_preferences]
///
).