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

Provide a way for iOS plugins to know what window/view to interact with #104117

Open
stuartmorgan opened this issue May 18, 2022 · 3 comments
Open
Labels
a: plugins Support for writing, building, and running plugin packages c: new feature Nothing broken; request for a new capability engine flutter/engine repository. See also e: labels. P2 Important issues not at the top of the work list platform-ios iOS applications specifically team-ios Owned by iOS platform team triaged-ios Triaged by iOS platform team

Comments

@stuartmorgan
Copy link
Contributor

stuartmorgan commented May 18, 2022

Several of our 1P plugins present view controllers over the Flutter view; GIDSignIn needs this information, for example. Currently, we do this using UIApplication.sharedApplication.keyWindow, but in iOS 13 keyWindow is deprecated because of the introduction of scenes on iPads.

To make Flutter scene-friendly, we should provide an alternate way of getting that information. On the macOS embedding, for instance, I added a way to get the NSView of the Flutter content via the plugin registrar, which allows plugins to get the window they are part of for things like showing sheets. (I keep finding 3P plugins that ignore that and use the key window instead, but 🤷🏻 ). We should consider doing the same for iOS, or providing some alternate solution.

/cc @jmagman

@stuartmorgan stuartmorgan added platform-ios iOS applications specifically engine flutter/engine repository. See also e: labels. plugin labels May 18, 2022
@stuartmorgan
Copy link
Contributor Author

I'm going to temporarily suppress these warnings with a TODO referencing this issue, so once we have a solution we should look for this issue number in flutter/plugins and update the relevant code.

@stuartmorgan stuartmorgan added the P2 Important issues not at the top of the work list label May 19, 2022
@stuartmorgan stuartmorgan added a: plugins Support for writing, building, and running plugin packages and removed plugin labels Mar 6, 2023
@stuartmorgan stuartmorgan changed the title Provide a way for plugins to know what window to interact with Provide a way for iOS plugins to know what window/view to interact with Mar 27, 2023
@stuartmorgan
Copy link
Contributor Author

On the macOS embedding, for instance, I added a way to get the NSView of the Flutter content via the plugin registrar

This API is being adjusted as part of multi-window support; we should take those adjustments into account when designing a corresponding iOS API.

@cyanglaz
Copy link
Contributor

On the macOS embedding, for instance, I added a way to get the NSView of the Flutter content via the plugin registrar, which allows plugins to get the window they are part of for things like showing sheets.

This is the API on macOS: https://github.com/flutter/engine/blame/main/shell/platform/darwin/macos/framework/Headers/FlutterPluginRegistrarMacOS.h#L45

Multi-view version:
https://github.com/flutter/engine/blame/main/shell/platform/darwin/macos/framework/Headers/FlutterPluginRegistrarMacOS.h#L50

@cyanglaz cyanglaz added the c: new feature Nothing broken; request for a new capability label Mar 27, 2023
@flutter-triage-bot flutter-triage-bot bot added multiteam-retriage-candidate team-ios Owned by iOS platform team triaged-ios Triaged by iOS platform team labels Jul 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a: plugins Support for writing, building, and running plugin packages c: new feature Nothing broken; request for a new capability engine flutter/engine repository. See also e: labels. P2 Important issues not at the top of the work list platform-ios iOS applications specifically team-ios Owned by iOS platform team triaged-ios Triaged by iOS platform team
Projects
None yet
Development

No branches or pull requests

3 participants