Skip to content

Conversation

@stuartmorgan-g
Copy link
Collaborator

Replaces the Obj-C example app with Swift. Rather than attempt to modify the example in place, I started clean from the Swift template:

  • deleted the ios/ directory.
  • ran flutter create --platforms=ios . using current stable (3.41.0).
  • re-did the RunnerUITest setup process, and swapped in the existing test files for that and RunnerTest.
  • ran native tests and the example app to capture the auto-migration steps for CocoaPods.

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):

  • Removed the canLaunch/launch anti-pattern, which was long since removed from the app-facing package. This copies the code from app-facing example to demonstrate canLaunch controlling enabling a UI element, which is how we recommend using it.
  • Removed all the configuration options that only ever worked on Android, since they are't relevant to an iOS example.

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

didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[GeneratedPluginRegistrant registerWithRegistry:self];
[super application:application didFinishLaunchingWithOptions:launchOptions];
return YES;
Copy link
Collaborator Author

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)",
Copy link
Collaborator Author

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.

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 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant