-
Notifications
You must be signed in to change notification settings - Fork 3.6k
[url_launcher] Modernize url_launcher_ios example
#11002
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
base: main
Are you sure you want to change the base?
[url_launcher] Modernize url_launcher_ios example
#11002
Conversation
| didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { | ||
| [GeneratedPluginRegistrant registerWithRegistry:self]; | ||
| [super application:application didFinishLaunchingWithOptions:launchOptions]; | ||
| return YES; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed because they are no longer in the example app, because these options do nothing on iOS.
There was a problem hiding this 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 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.
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