Skip to content

[url_launcher] Convert macOS to Pigeon #3686

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

Merged
merged 4 commits into from
Apr 12, 2023

Conversation

stuartmorgan-g
Copy link
Contributor

Replaces manual method channels with Pigeon. Adjusts the API to return a structured error for the known-failure case of a URL that can't be parsed, instead of returning a FlutterError, to prepare for a future conversion of that case into an ArgumentError rather than a PlatformException; using a structured error adds a bit of API complexity, but avoids the need to do a catch/throw-or-rethrow using string matching across the language boundary.

Part of flutter/flutter#117915

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the relevant style guides and ran the auto-formatter. (Unlike the flutter/flutter repo, the flutter/packages repo does use dart format.)
  • I signed the CLA.
  • The title of the PR starts with the name of the package surrounded by square brackets, e.g. [shared_preferences]
  • I listed at least one issue that this PR fixes in the description above.
  • I updated pubspec.yaml with an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.
  • I updated CHANGELOG.md to add a description of the change, following repository CHANGELOG style.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

Replaces manual method channels with Pigeon. Adjusts the API to return a
structured error for the known-failure case of a URL that can't be
parsed, instead of returning a `FlutterError`, to prepare for a future
conversion of that case into an `ArgumentError` rather than a
`PlatformException`; using a strucutred error adds a bit of API
complexity, but avoids the need to do a catch/throw-or-rethrow using
string matching across the language boundary.

Part of flutter/flutter#117915
/// Possible error conditions for [UrlLauncherApi] calls.
enum UrlLauncherError {
/// The URL could not be parsed as an NSURL.
invalidUrl,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I did this as an enum even though there's only one value since it was more self-documenting this way, and would easily extend to other error cases if we find more in the future.

@tarrinneal
Copy link
Contributor

this is just a pigeon change right? not a full conversion to swift?

Copy link
Contributor

@tarrinneal tarrinneal left a comment

Choose a reason for hiding this comment

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

lgtm, with version updates

@stuartmorgan-g stuartmorgan-g changed the title [url_launcher] Convert macOS to Swift [url_launcher] Convert macOS to Pigeon Apr 12, 2023
@stuartmorgan-g
Copy link
Contributor Author

this is just a pigeon change right? not a full conversion to swift?

I have no idea why I wrote Swift in the title; it's already a Swift plugin.

@stuartmorgan-g stuartmorgan-g added the autosubmit Merge PR when tree becomes green via auto submit App label Apr 12, 2023
@auto-submit auto-submit bot merged commit aad90e7 into flutter:main Apr 12, 2023
@stuartmorgan-g stuartmorgan-g deleted the url-launcher-macos-swift branch April 12, 2023 03:56
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Apr 12, 2023
nploi pushed a commit to nploi/packages that referenced this pull request Jul 16, 2023
[url_launcher] Convert macOS to Pigeon
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: url_launcher platform-macos
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants