-
Notifications
You must be signed in to change notification settings - Fork 9.8k
[webview_flutter] Migrate main package to fully federated architecture. #4366
[webview_flutter] Migrate main package to fully federated architecture. #4366
Conversation
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.
Code changes LG, but the iOS test failure looks real since it's across both channels. Any idea what's going on there?
Removed the native Android code as first step to migrate to the fully federated plugin architecture.
Removed all Android specific Dart code that will be replaced by the webview_flutter_android package.
Removed the native iOS implementation as this will be replaced by the implementation in the webview_flutter_wkwebview package.
Removed all iOS specific Dart code as it will be replaced by the webview_flutter_wkwebview package.
Removed the `lib/src/webview_method_channel.dart` and `lib/platform_interface.dart` files as they will be replaced by the implementations from the webview_flutter_platform_interface package.
Update pubspec.yaml with configuration to depend on the webview_flutter_platform_interface, webview_flutter_android and webview_flutter_wkwebview packages.
Added the platform_interface.dart file which re-exports the public classes from the webview_flutter_platform_interface package so we don't break existing non-endorsed implementations of the old platform_interface.
Direct copy of the existing implementation from lib/webview_flutter.dart to a new implementation file at location lib/src/webview.dart. This will open the way to add a bundle file which will export all important parts over all of the federated pakcages.
Update the implementation of the lib/src/webview.dart file so it correctly depends on the webview_flutter_platform_interface package (imported via the platform_interface.dart file).
Fixes all tests to import the correct dependencies.
Removed unused variable from the _WebViewState.
fc432b6
to
dfd4d35
Compare
That was indeed a mistake from my side. The |
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
* master: (51 commits) [webview_flutter] Update version number app_facing package (flutter#4375) [webview_flutter] Adjust integration test domains (flutter#4383) Remove some trivial custom analysis options files (flutter#4379) [google_maps_flutter_platfomr_interface] Add Marker drag events (flutter#2653) [flutter_plugin_tools] Improve version check error handling (flutter#4376) [flutter_plugin_tools] Allow overriding breaking change check (flutter#4369) [url_launcher] Error handling when URL cannot be parsed with Uri.parse (flutter#4365) [webview_flutter] Migrate main package to fully federated architecture. (flutter#4366) [google_sign_in] Bump minimum Flutter version and iOS deployment target (flutter#4334) Add false secret lists, and enforce ordering (flutter#4372) [camera_web] Update usage documentation (flutter#4371) [video_player] VTT Support (flutter#2878) Require authors file (flutter#4367) [flutter_plugin_tools] Fix federated safety check (flutter#4368) [webview_flutter] Extract WKWebView implementation into a separate package (flutter#4345) [webview_flutter] Extract Android implementation into a separate package (flutter#4343) [in_app_purchase] Ensure the `introductoryPriceMicros` field is populated correctly. (flutter#4364) [flutter_plugin_tools] Add a federated PR safety check (flutter#4329) [camera] Add web support (flutter#4240) [webview_flutter] Bump minimum Flutter version and iOS deployment target (flutter#4361) ... # Conflicts: # packages/webview_flutter/webview_flutter/lib/platform_interface.dart # packages/webview_flutter/webview_flutter/lib/src/webview_method_channel.dart # packages/webview_flutter/webview_flutter/lib/webview_flutter.dart
JavascriptMessage, | ||
JavascriptMode, | ||
JavascriptMessageHandler, | ||
WebViewPlatform, |
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.
For posterity: we accidentally shipped a breaking change to external implementors here without noticing. There's nothing we can reasonably do about it at this point, and AFAIK it only affected one client (now fixed), but what happened was:
- https://github.com/flutter/plugins/pull/4302/files#diff-bbee1da5da193a072dca86d16467e75802852826099a7b0db2e6c497c71a3f31R54 changed
WebViewPlatform
. In isolation that change seemed reasonable because it was a new package, so wasn't a breaking change. - This switched from the old local
WebViewPlatform
to the new one, which has a new argument tobuild
, which is breaking for any implementations ofWebViewPlatform
. The fact that it wasn't a direct copy isn't apparent here, so we forgot to consider that.
Because in this repository we previously had only the one combined package, and we were thus not eating our own dogfood in an important way with respect to the platform interface, nothing in CI alerted us to the mistake. The good news is that being fully federated gives us much more protection against making that mistake in the future (which is validation of the need for us to follow the intended policy of having all of our federated plugins be fully federated precisely so that we are eating our own dogfood).
So ironically the change that will save us from this bug in the future caused exactly the bug it's meant to avoid. But the bug was one-time, and the protection is persistent for all future changes, so it's definitely a net win despite that.
This PR migrates the main "app facing" webview_flutter package to depend on the new
webview_flutter_platform_interface
,webview_flutter_android
andwebview_flutter_wkwebview
packages. This finalises the migration to the fully federated architecture as described in issue flutter/flutter#86286.Relevant issue:
Pre-launch Checklist
dart format
.)[shared_preferences]
///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.