Skip to content
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

Implement the publish APIs for macOS plugins #124721

Closed
stuartmorgan opened this issue Apr 12, 2023 · 1 comment · Fixed by flutter/engine#45502
Closed

Implement the publish APIs for macOS plugins #124721

stuartmorgan opened this issue Apr 12, 2023 · 1 comment · Fixed by flutter/engine#45502
Assignees
Labels
a: desktop Running on desktop a: plugins Support for writing, building, and running plugin packages engine flutter/engine repository. See also e: labels. P2 Important issues not at the top of the work list platform-mac Building on or for macOS specifically team-macos Owned by the macOS platform team

Comments

@stuartmorgan
Copy link
Contributor

Currently we don't have any of the APIs related to plugins being able to publish a value implemented for macOS:

https://github.com/flutter/engine/blob/2360950aead7b35767cc54e9682e58e7dcaab54d/shell/platform/darwin/ios/framework/Headers/FlutterPlugin.h#L328-L339

https://github.com/flutter/engine/blob/2360950aead7b35767cc54e9682e58e7dcaab54d/shell/platform/darwin/ios/framework/Headers/FlutterPlugin.h#L414-L422

These APIs are used in webview_flutter, so not having them will require otherwise-unnecessary ifdefing (and as we continue to consolidate iOS and macOS engine headers, extra ifdefs there as well). I believe they should be easy to wire up.

@stuartmorgan stuartmorgan added engine flutter/engine repository. See also e: labels. platform-mac Building on or for macOS specifically P2 Important issues not at the top of the work list a: plugins Support for writing, building, and running plugin packages a: desktop Running on desktop labels Apr 12, 2023
@stuartmorgan stuartmorgan self-assigned this Sep 6, 2023
auto-submit bot pushed a commit to flutter/engine that referenced this issue Sep 6, 2023
These directly copy the iOS APIs, to minimize the branching needed in plugins with shared implementation code, and to facilitate the long-term goal of merging the iOS and macOS plugin headers. This does mean replicating the unfortunately non-idiomatic behavior of having `valuePublishedByPlugin:` sometimes return `nil` and sometimes return `NSNull`, instead of distinguishing between `nil` cases (if that's actually even necessary here) via a more specific API. In isolation I would definitely not design the API with this behavior, but consistency with iOS is the more important factor.

(Eventually I think we'll need a sort of "v2" of iOS plugin APIs since there are a number of strange behaviors that we're currently stuck with, but migrating iOS and macOS together to a new set of APIs won't be any harder than doing just iOS, and in the short to medium term consistency will help the ecosystem more that trying to pre-create better APIs as macOS-only.)

Also fixes `FlutterEngineRegistrar` to have a weak pointer to the engine. This should really already have been the case since plugins can retain the registrar, creating a likely cycle; it's now a guaranteed cycle (and failed unit tests designed to find cycles) without that since the engine itself is now keeping references to them.

Fixes flutter/flutter#124721

[C  , Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 20, 2023
@cbracken cbracken added team-macos Owned by the macOS platform team and removed team-desktop labels Jun 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a: desktop Running on desktop a: plugins Support for writing, building, and running plugin packages engine flutter/engine repository. See also e: labels. P2 Important issues not at the top of the work list platform-mac Building on or for macOS specifically team-macos Owned by the macOS platform team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants