Skip to content

Conversation

@stuartmorgan-g
Copy link
Collaborator

Switches from the global window's view controller to the view controller provided by the new FlutterPluginRegistrar viewController method.

Updates minimum Flutter version to 3.38 for the new API used.

Fixes flutter/flutter#174419

Pre-Review Checklist

Footnotes

  1. Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. 2 3

Switches from the global window's view controller to the view controller
provided by the new FlutterPluginRegistrar `viewController` method.

Updates minimum Flutter version to 3.38 for the new API used.

Fixes flutter/flutter#174419
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request successfully migrates the file_selector_ios plugin to be compatible with UIScene by using the viewController from FlutterPluginRegistrar instead of relying on the application's key window. The implementation uses dependency injection by introducing a ViewPresenterProvider protocol, which improves testability and modernizes the codebase. The related tests and SDK version constraints have been updated accordingly. The changes are well-implemented, but I have a few minor suggestions to improve code style and documentation consistency.

documentPicker.delegate = completionBridge

let presenter =
self.viewPresenterOverride ?? UIApplication.shared.delegate?.window??.rootViewController
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could keep this override structure instead of adding ViewPresenterProvider, but I thought it was cleaner to reduce test branching in production code.

}

/// Non-test implementation of ViewControllerProvider that forwards to the plugin registrar.
class DefaultViewPresenterProvider: ViewPresenterProvider {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is necessary because FlutterPluginRegistrar is a protocol rather than a class, and the Swift "One Weird Trick" to add protocol conformance only works on classes, not protocols, so we can't do a no-code passthrough to the real registrar using something like line 21 above.

@stuartmorgan-g
Copy link
Collaborator Author

ViewPresenter.swift:42:15: error: value of type 'any FlutterPluginRegistrar' has no member 'viewController'

Ah right, landing any of these changes is going to require publishing a new Flutter pod. @vashworth Do you have the instructions for that, or do I need to try to dig them out?

@stuartmorgan-g stuartmorgan-g added the triage-ios Should be looked at in iOS triage label Nov 18, 2025
@vashworth
Copy link
Contributor

ViewPresenter.swift:42:15: error: value of type 'any FlutterPluginRegistrar' has no member 'viewController'

Ah right, landing any of these changes is going to require publishing a new Flutter pod. @vashworth Do you have the instructions for that, or do I need to try to dig them out?

I do not know the instructions on how to do that

@stuartmorgan-g
Copy link
Collaborator Author

I do not know the instructions on how to do that

I'll see if I can find them, but I also filed flutter/flutter#178806 for consideration to make it moot.

Copy link
Contributor

@vashworth vashworth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@stuartmorgan-g stuartmorgan-g added the autosubmit Merge PR when tree becomes green via auto submit App label Dec 1, 2025
@auto-submit auto-submit bot merged commit 03299cd into flutter:main Dec 1, 2025
80 checks passed
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Dec 1, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Dec 1, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Dec 1, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Dec 1, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Dec 1, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Dec 2, 2025
github-merge-queue bot pushed a commit to flutter/flutter that referenced this pull request Dec 2, 2025
flutter/packages@c8be05d...148dcd2

2025-12-01 [email protected] [go_router_builder] Require analyzer
8.2 (flutter/packages#10546)
2025-12-01 49699333+dependabot[bot]@users.noreply.github.com
[dependabot]: Bump androidx.core:core from 1.13.1 to 1.17.0 in
/packages/local_auth/local_auth_android/android (flutter/packages#10505)
2025-12-01 49699333+dependabot[bot]@users.noreply.github.com
[dependabot]: Bump the kotlin-gradle-plugin group across 7 directories
with 1 update (flutter/packages#10501)
2025-12-01 [email protected] [google_fonts] Replace deprecated
FontWeight.index (flutter/packages#10544)
2025-12-01 [email protected] [camera_web] Fix camera initialization
failure on Firefox Android (flutter/packages#10341)
2025-12-01 [email protected] Roll Flutter from
2b5fa94 to 05d6005 (3 revisions) (flutter/packages#10543)
2025-12-01 [email protected] [file_selector] Migrate to UIScene
(flutter/packages#10429)
2025-11-30 [email protected] [go_router_builder] Add `analyzer` 9
compatibility (flutter/packages#10526)
2025-11-29 [email protected] Roll Flutter from
022b155 to 2b5fa94 (14 revisions) (flutter/packages#10535)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC [email protected] on the revert to ensure that a
human
is aware of the problem.

To file a bug in Flutter:
https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
mboetger pushed a commit to mboetger/flutter that referenced this pull request Dec 2, 2025
…r#179343)

flutter/packages@c8be05d...148dcd2

2025-12-01 [email protected] [go_router_builder] Require analyzer
8.2 (flutter/packages#10546)
2025-12-01 49699333+dependabot[bot]@users.noreply.github.com
[dependabot]: Bump androidx.core:core from 1.13.1 to 1.17.0 in
/packages/local_auth/local_auth_android/android (flutter/packages#10505)
2025-12-01 49699333+dependabot[bot]@users.noreply.github.com
[dependabot]: Bump the kotlin-gradle-plugin group across 7 directories
with 1 update (flutter/packages#10501)
2025-12-01 [email protected] [google_fonts] Replace deprecated
FontWeight.index (flutter/packages#10544)
2025-12-01 [email protected] [camera_web] Fix camera initialization
failure on Firefox Android (flutter/packages#10341)
2025-12-01 [email protected] Roll Flutter from
2b5fa94 to 05d6005 (3 revisions) (flutter/packages#10543)
2025-12-01 [email protected] [file_selector] Migrate to UIScene
(flutter/packages#10429)
2025-11-30 [email protected] [go_router_builder] Add `analyzer` 9
compatibility (flutter/packages#10526)
2025-11-29 [email protected] Roll Flutter from
022b155 to 2b5fa94 (14 revisions) (flutter/packages#10535)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC [email protected] on the revert to ensure that a
human
is aware of the problem.

To file a bug in Flutter:
https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
reidbaker pushed a commit to AbdeMohlbi/flutter that referenced this pull request Dec 10, 2025
…r#179343)

flutter/packages@c8be05d...148dcd2

2025-12-01 [email protected] [go_router_builder] Require analyzer
8.2 (flutter/packages#10546)
2025-12-01 49699333+dependabot[bot]@users.noreply.github.com
[dependabot]: Bump androidx.core:core from 1.13.1 to 1.17.0 in
/packages/local_auth/local_auth_android/android (flutter/packages#10505)
2025-12-01 49699333+dependabot[bot]@users.noreply.github.com
[dependabot]: Bump the kotlin-gradle-plugin group across 7 directories
with 1 update (flutter/packages#10501)
2025-12-01 [email protected] [google_fonts] Replace deprecated
FontWeight.index (flutter/packages#10544)
2025-12-01 [email protected] [camera_web] Fix camera initialization
failure on Firefox Android (flutter/packages#10341)
2025-12-01 [email protected] Roll Flutter from
2b5fa94 to 05d6005 (3 revisions) (flutter/packages#10543)
2025-12-01 [email protected] [file_selector] Migrate to UIScene
(flutter/packages#10429)
2025-11-30 [email protected] [go_router_builder] Add `analyzer` 9
compatibility (flutter/packages#10526)
2025-11-29 [email protected] Roll Flutter from
022b155 to 2b5fa94 (14 revisions) (flutter/packages#10535)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC [email protected] on the revert to ensure that a
human
is aware of the problem.

To file a bug in Flutter:
https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autosubmit Merge PR when tree becomes green via auto submit App p: file_selector platform-ios triage-ios Should be looked at in iOS triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[file_selector_ios][UIScene] Migrate to scene APIs

2 participants