Add ability to access plugins from other plugins#182753
Conversation
|
It looks like this pull request may not have tests. Please make sure to add tests or get an explicit test exemption before merging. If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix? Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. If you believe this PR qualifies for a test exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group. |
There was a problem hiding this comment.
Code Review
The pull request introduces valuePublishedByPlugin to FlutterPluginRegistrar, allowing plugins to access values published by other plugins. This change is implemented in FlutterPlugin.h and FlutterEngine.mm. The changes are straightforward, adding the method declaration and its implementation, and seem to align with the stated objective of fixing issue #121527.
4f1371a to
d6447a6
Compare
hellohuanlin
left a comment
There was a problem hiding this comment.
You added android tests, but not iOS tests
|
👍 I'll go back and add an iOS test. There was an obvious place to add it on Android. I didn't see one on iOS, but I'll add it. |
|
Added tests for |
hellohuanlin
left a comment
There was a problem hiding this comment.
ios part looks good.
| } | ||
|
|
||
| @Nullable | ||
| public FlutterPlugin getPlugin(@NonNull Class<? extends FlutterPlugin> pluginClass) { |
| } | ||
|
|
||
| @Nullable | ||
| public FlutterPlugin getPlugin(@NonNull Class<? extends FlutterPlugin> pluginClass) { |
|
The failing code in google 3 is real but most look like Fakes where we need to add an implementation. |
|
From triage: @hellohuanlin Can you make a g3fix? |
|
Doc comment added. Thanks everyone! |
|
G3 fix is in. Running test again. |
|
G3 fix is approved. re-running. |
Plugins occasionally need to communicate with other native plugins. On iOS, plugins are able to publish values that should be accessible to other plugins. The easiest way to allow to these published value is to add an accessor in FlutterPluginRegistrar, similar to the one that exists in FlutterPluginRegistry (valuePublishedByPlugin). On Android, we can ask for the plugin class directly by added and accessor to `FlutterPluginBinding` called `getPlugin`, which delegates to the engine's `FlutterPlugins`. Fixes flutter#121527 ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. --------- Co-authored-by: Gray Mackall <34871572+gmackall@users.noreply.github.com>
Plugins occasionally need to communicate with other native plugins. On iOS, plugins are able to publish values that should be accessible to other plugins. The easiest way to allow to these published value is to add an accessor in FlutterPluginRegistrar, similar to the one that exists in FlutterPluginRegistry (valuePublishedByPlugin). On Android, we can ask for the plugin class directly by added and accessor to `FlutterPluginBinding` called `getPlugin`, which delegates to the engine's `FlutterPlugins`. Fixes flutter#121527 ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. --------- Co-authored-by: Gray Mackall <34871572+gmackall@users.noreply.github.com>
A new way of supporting cross plugin communication is coming in Flutter 3.44 which allows for access to plugin published values through the `FlutterPluginBinding` on Android and the `FlutterPluginRegistry` on iOS. Update native WebView access to support these new methods and deprecate the old methods. refs: flutter/flutter#121527 flutter/flutter#182753 # Conflicts: # packages/webview_flutter/webview_flutter_wkwebview/pubspec.yaml
A new way of supporting cross plugin communication is coming in Flutter 3.44 which allows for access to plugin published values through the `FlutterPluginBinding` on Android and the `FlutterPluginRegistry` on iOS. Update native WebView access to support these new methods and deprecate the old methods. refs: flutter/flutter#121527 flutter/flutter#182753 # Conflicts: # packages/webview_flutter/webview_flutter_wkwebview/pubspec.yaml
A new way of supporting cross plugin communication is coming in Flutter 3.44 which allows for access to plugin published values through the `FlutterPluginBinding` on Android and the `FlutterPluginRegistry` on iOS. Update native WebView access to support these new methods and deprecate the old methods. refs: flutter/flutter#121527 flutter/flutter#182753 # Conflicts: # packages/webview_flutter/webview_flutter_wkwebview/pubspec.yaml
A new way of supporting cross plugin communication is coming in Flutter 3.44 which allows for access to plugin published values through the `FlutterPluginBinding` on Android and the `FlutterPluginRegistry` on iOS. Update native WebView access to support these new methods and deprecate the old methods. refs: flutter/flutter#121527 flutter/flutter#182753 ## Pre-Review Checklist
A new way of supporting cross plugin communication is coming in Flutter 3.44 which allows for access to plugin published values through the `FlutterPluginBinding` on Android and the `FlutterPluginRegistry` on iOS. Update native WebView access to support these new methods and deprecate the old methods. refs: flutter/flutter#121527 flutter/flutter#182753 ## Pre-Review Checklist
Plugins occasionally need to communicate with other native plugins.
On iOS, plugins are able to publish values that should be accessible to other plugins. The easiest way to allow to these published value is to add an accessor in FlutterPluginRegistrar, similar to the one that exists in FlutterPluginRegistry (valuePublishedByPlugin).
On Android, we can ask for the plugin class directly by added and accessor to
FlutterPluginBindingcalledgetPlugin, which delegates to the engine'sFlutterPlugins.Fixes #121527
Pre-launch Checklist
///).