Repository navigation
[url_launcher] Update for UIScene compatibility - #10549
Conversation
Replaces the code that attempted to find the topmost presented view controller as the context for presenting a Safari view controller with a call to the new registrar API to get the Flutter view's controller. Since it's now possible for there not to be a view controller, adds an exception for that case. This should only be possible in an add-to-app scenario where someone tries to show an in-app URL from a Flutter view that is not being displayed, which is an unlikely enough scenario that I'm not going to consider this a breaking change. Fixes flutter/flutter#174415
There was a problem hiding this comment.
This is copied directly from the recent file_selector_ios PR to adopt UIScene, since we have the same DI needs here.
| /// a stub implementation of FlutterPluginRegistrar for tests would break any time something was | ||
| /// added to that protocol. | ||
| protocol ViewPresenterProvider { | ||
| /// Returns the view controller associated with the Flutter content. |
There was a problem hiding this comment.
nit: Returns the view presenter [...]
| private var currentSession: URLLaunchSession? | ||
| private let launcher: Launcher | ||
| /// The view controller provider, for showing a Safari view controller. | ||
| private let viewPresenterProvider: ViewPresenterProvider |
There was a problem hiding this comment.
The view controller provider
Should we call this a ViewControllerPresenterProvider then?
There was a problem hiding this comment.
Changed to "The view presenter provider". Because it's just a testability abstraction around a view controller it was hard not to default to calling it a view controller.
| } | ||
| } | ||
|
|
||
| final class StubViewPresenterProvider: ViewPresenterProvider { |
There was a problem hiding this comment.
Shall we use the same prefix "Test-" above and "Stub-" here?
There was a problem hiding this comment.
They don't do the same things; StubViewPresenterProvider is a stub, in that it just returns a fixed value, while TestViewPresenter tracks calls and updates its state (more like a mock).
| @@ -1,3 +1,8 @@ | |||
| ## 6.4.0 | |||
|
|
|||
| * Improves compatibility with `UIScene`. | |||
There was a problem hiding this comment.
This refers to the removal of UIApplication.shared.keyWindow?.rootViewController?.topViewController right?
There was a problem hiding this comment.
Correct, that's the substantive change here; the rest is testability.
flutter/packages@8cb4903...d39e481 2025-12-04 [email protected] [pigeon] Fixes crash that occurs when an object that is removed from the instance manager calls to Dart (flutter/packages#10552) 2025-12-04 [email protected] [pigeon] Fixes error from constructor parameter sharing name with attached field for a ProxyApi (flutter/packages#10541) 2025-12-04 [email protected] fix[image_picker_ios]: Prevent transcoding on video selection (flutter/packages#10559) 2025-12-04 [email protected] [webview_flutter_wkwebview] Fixes crash when running `WKNavigationResponse` tests on Xcode 26 (flutter/packages#10316) 2025-12-03 [email protected] Redistribute iOS CODEOWNERS (flutter/packages#10520) 2025-12-03 [email protected] [url_launcher] Update for UIScene compatibility (flutter/packages#10549) 2025-12-03 [email protected] Roll Flutter from e274574 to 69d8710 (5 revisions) (flutter/packages#10558) 2025-12-03 [email protected] Roll Flutter from 5545bb3 to e274574 (17 revisions) (flutter/packages#10554) 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
…r#179451) flutter/packages@8cb4903...d39e481 2025-12-04 [email protected] [pigeon] Fixes crash that occurs when an object that is removed from the instance manager calls to Dart (flutter/packages#10552) 2025-12-04 [email protected] [pigeon] Fixes error from constructor parameter sharing name with attached field for a ProxyApi (flutter/packages#10541) 2025-12-04 [email protected] fix[image_picker_ios]: Prevent transcoding on video selection (flutter/packages#10559) 2025-12-04 [email protected] [webview_flutter_wkwebview] Fixes crash when running `WKNavigationResponse` tests on Xcode 26 (flutter/packages#10316) 2025-12-03 [email protected] Redistribute iOS CODEOWNERS (flutter/packages#10520) 2025-12-03 [email protected] [url_launcher] Update for UIScene compatibility (flutter/packages#10549) 2025-12-03 [email protected] Roll Flutter from e274574 to 69d8710 (5 revisions) (flutter/packages#10558) 2025-12-03 [email protected] Roll Flutter from 5545bb3 to e274574 (17 revisions) (flutter/packages#10554) 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
Replaces the code that attempted to find the topmost presented view controller as the context for presenting a Safari view controller with a call to the new registrar API to get the Flutter view's controller. Since it's now possible for there not to be a view controller, adds an exception for that case. This should only be possible in an add-to-app scenario where someone tries to show an in-app URL from a Flutter view that is not being displayed, which is an unlikely enough scenario that I'm not going to consider this a breaking change. Fixes flutter/flutter#174415 ## Pre-Review Checklist [^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.
|
Version |
|
The autopublish step failed, and we didn't catch it. Thanks for flagging that; I've now published it manually. |
Replaces the code that attempted to find the topmost presented view controller as the context for presenting a Safari view controller with a call to the new registrar API to get the Flutter view's controller. Since it's now possible for there not to be a view controller, adds an exception for that case. This should only be possible in an add-to-app scenario where someone tries to show an in-app URL from a Flutter view that is not being displayed, which is an unlikely enough scenario that I'm not going to consider this a breaking change. Fixes flutter/flutter#174415 ## Pre-Review Checklist [^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.
flutter/packages@8cb4903...d39e481 2025-12-04 [email protected] [pigeon] Fixes crash that occurs when an object that is removed from the instance manager calls to Dart (flutter/packages#10552) 2025-12-04 [email protected] [pigeon] Fixes error from constructor parameter sharing name with attached field for a ProxyApi (flutter/packages#10541) 2025-12-04 [email protected] fix[image_picker_ios]: Prevent transcoding on video selection (flutter/packages#10559) 2025-12-04 [email protected] [webview_flutter_wkwebview] Fixes crash when running `WKNavigationResponse` tests on Xcode 26 (flutter/packages#10316) 2025-12-03 [email protected] Redistribute iOS CODEOWNERS (flutter/packages#10520) 2025-12-03 [email protected] [url_launcher] Update for UIScene compatibility (flutter/packages#10549) 2025-12-03 [email protected] Roll Flutter from e36d6dc to 8f08887 (5 revisions) (flutter/packages#10558) 2025-12-03 [email protected] Roll Flutter from efa3b67 to e36d6dc (17 revisions) (flutter/packages#10554) 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
Replaces the code that attempted to find the topmost presented view controller as the context for presenting a Safari view controller with a call to the new registrar API to get the Flutter view's controller.
Since it's now possible for there not to be a view controller, adds an exception for that case. This should only be possible in an add-to-app scenario where someone tries to show an in-app URL from a Flutter view that is not being displayed, which is an unlikely enough scenario that I'm not going to consider this a breaking change.
Fixes flutter/flutter#174415
Pre-Review Checklist
[shared_preferences]pubspec.yamlwith an appropriate new version according to the pub versioning philosophy, or I have commented below to indicate which version change exemption this PR falls under1.CHANGELOG.mdto add a description of the change, following repository CHANGELOG style, or I have commented below to indicate which CHANGELOG exemption this PR falls under1.///).Footnotes
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