Skip to content
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

Feature/14 add support for simctl openurl #16

Merged
merged 8 commits into from
Oct 28, 2021
Merged

Feature/14 add support for simctl openurl #16

merged 8 commits into from
Oct 28, 2021

Conversation

limey
Copy link
Contributor

@limey limey commented Oct 21, 2021

Description

The changes in this PR enable the Simctl client to open URLs directly in the simulator. This allows testing internal deep links by opening URLs which applications can register using custom URL shemes.

The underlying simctl command invoked by the server is simctl openurl <device> <URL>.

This PR aims to resolve Issue 14.

Detailed Design

The implementation follows the overall pattern used by other SimctlCLI commands.

  • SimctlClient receives func openUrl(_ url: URL, completion: @escaping DataTaskCallback). This function wraps the URL in a URLContainer Codable type.
  • SimctlServer has an accompanying func onOpenUrl(_ closure: @escaping (UUID, String?, URL) -> ...
  • A new SimctlClient.Route : case openURL(SimctlClientEnvironment, URLContainer).
  • Note - the URL is POST-ed in a json payload instead of being passed in a header field. This is to avoid potential url escaping & encoding challenges with header fields.

Documentation

  • The README.md now mentions the feature.
  • The swift language docs have been updated.
  • I have been working on an accompanying test in SwiftSimctlExample project to illustrate usage via code.

Testing

Tested in SwiftSimctlExample project.

Performance

The feature adopts the same architecture as other commands and subjectively performs without issue in tests.

Source Impact

This will extend the public API so should result in a minor version increase.

Checklist

  • I've read the Contribution Guidelines
  • I've followed the coding style of the rest of the project.
  • I've added tests covering all new code paths my change adds to the project (to the extent possible).
  • I've added benchmarks covering new functionality (if appropriate).
  • I've verified that my change does not break any existing tests or introduce unexpected benchmark regressions.
  • I've updated the documentation (if appropriate).

@limey limey requested a review from ctreffs as a code owner October 21, 2021 21:49
Copy link
Contributor Author

@limey limey left a comment

Choose a reason for hiding this comment

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

I compiled & pushed the binary using make buildSimctlCLI in order to help my testing against this branch. Happy to revert if you prefer compiling the binary which goes to master.

@ctreffs
Copy link
Owner

ctreffs commented Oct 22, 2021

Hey @limey thanks for your contribution 🥳
I am on vacation this and next week so only on mobile. Will have a closer look when I'm back at home. Great work! 🙏

Copy link
Owner

@ctreffs ctreffs left a comment

Choose a reason for hiding this comment

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

Will generate the binary again myself just to verify when I'm back. Otherwise LGTM 🚀

Sources/SimctlShared/SimctlShared.swift Show resolved Hide resolved
@ctreffs ctreffs enabled auto-merge (squash) October 28, 2021 06:20
@ctreffs ctreffs added enhancement New feature or request good first issue Good for newcomers labels Oct 28, 2021
@ctreffs ctreffs merged commit 479bf86 into ctreffs:master Oct 28, 2021
@limey limey deleted the feature/14-add-support-for-simctl-openurl branch October 28, 2021 09:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for simctl openurl
2 participants