[url_launcher] Modernize url_launcher_ios example#11002
[url_launcher] Modernize url_launcher_ios example#11002auto-submit[bot] merged 9 commits intoflutter:mainfrom
url_launcher_ios example#11002Conversation
| didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { | ||
| [GeneratedPluginRegistrant registerWithRegistry:self]; | ||
| [super application:application didFinishLaunchingWithOptions:launchOptions]; | ||
| return YES; |
There was a problem hiding this comment.
Unlike the quick_actions case I could not find any good reason for this behavior. Unlike quick_actions it wasn't added later, but was just part of the very first url_launcher checkin, and I think of any reason this would be relevant for url_launcher testing, so I didn't replicate this into the Swift version, and just stuck with the standard template code.
| let app = self.app! | ||
|
|
||
| let buttonNames: [String] = [ | ||
| "Launch in app", "Launch in app(JavaScript ON)", "Launch in app(DOM storage ON)", |
There was a problem hiding this comment.
Removed because they are no longer in the example app, because these options do nothing on iOS.
There was a problem hiding this comment.
Code Review
This pull request modernizes the url_launcher_ios example application, migrating the native iOS part from Objective-C to Swift and updating the Dart code to use the latest url_launcher APIs, such as launchUrl with LaunchOptions, while also demonstrating capability checks. A medium-severity vulnerability was identified where unsanitized user input is used to construct a tel: URI, which could lead to unintended behavior.
| import UIKit | ||
|
|
||
| @main | ||
| @objc class AppDelegate: FlutterAppDelegate, FlutterImplicitEngineDelegate { |
There was a problem hiding this comment.
nit: is the @objc attribute needed? FlutterAppDelegate is already an objc class I think? Also the didFinishLaunchingWithOptions method doesn't seem to be overriding anything?
There was a problem hiding this comment.
The goal here is to only deviate from the template when there's a plugin-specific reason to. I don't know why the template is this way (the second may well just be leftover from when plugin registration was in that method), but that would be something to change in the template itself rather than here.
| } else { | ||
| throw Exception('Could not launch $url'); | ||
| } | ||
| launcher.canLaunch('tel://123').then((bool result) { |
There was a problem hiding this comment.
This needs a mounted check in case the future resolves after the widget is disposed.
There was a problem hiding this comment.
Oops, done!
flutter/packages@af1d610...09104b0 2026-02-12 8490712+ruicraveiro@users.noreply.github.com [camera_avfoundation] Adds support for video stabilization (flutter/packages#10367) 2026-02-12 stuartmorgan@google.com [google_maps_flutter] Add README section about SDK versions (flutter/packages#11005) 2026-02-12 stuartmorgan@google.com [url_launcher] Modernize `url_launcher_ios` example (flutter/packages#11002) 2026-02-12 107683152+OlehSv@users.noreply.github.com [google_maps_flutter] Improved perfomance of clusterization (flutter/packages#10562) 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 flutter-ecosystem@google.com 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#182383) flutter/packages@af1d610...09104b0 2026-02-12 8490712+ruicraveiro@users.noreply.github.com [camera_avfoundation] Adds support for video stabilization (flutter/packages#10367) 2026-02-12 stuartmorgan@google.com [google_maps_flutter] Add README section about SDK versions (flutter/packages#11005) 2026-02-12 stuartmorgan@google.com [url_launcher] Modernize `url_launcher_ios` example (flutter/packages#11002) 2026-02-12 107683152+OlehSv@users.noreply.github.com [google_maps_flutter] Improved perfomance of clusterization (flutter/packages#10562) 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 flutter-ecosystem@google.com 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 Obj-C example app with Swift. Rather than attempt to modify the example in place, I started clean from the Swift template:
flutter create --platforms=ios .using currentstable(3.41.0).In addition, I did some cleanup on the Dart part of this example, which had never been updated post-federation (since implementation package example apps are mostly not things we expect users to look at, so it's never been a priority):
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