Skip to content

Conversation

@APshenkin
Copy link
Contributor

@APshenkin APshenkin commented Nov 14, 2025

Description

This PR backports https://github.com/wailsapp/wails/pull/4693/files to V3

Fixes # (issue)

Type of change

Please select the option that is relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration using wails doctor.

  • Windows
  • macOS
  • Linux

If you checked Linux, please specify the distro and version.

Test Configuration

# System

┌──────────────────────────────────────────────────┐
| Name          | MacOS                            |
| Version       | 26.1                             |
| ID            | 25B78                            |
| Branding      | MacOS 26.1                       |
| Platform      | darwin                           |
| Architecture  | arm64                            |
| Apple Silicon | true                             |
| CPU           | Apple M4 Max                     |
| CPU 1         | Apple M4 Max                     |
| CPU 2         | Apple M4 Max                     |
| GPU           | 40 cores, Metal Support: Metal 4 |
| Memory        | 128 GB                           |
└──────────────────────────────────────────────────┘

# Build Environment

┌─────────────────────────────────────────────────────────┐
| Wails CLI    | v3.0.0-dev                               |
| Go Version   | go1.24.0                                 |
| Revision     | 4a445ce218b58db4a16ee8fa84eac0d7c9a69932 |
| Modified     | false                                    |
| -buildmode   | exe                                      |
| -compiler    | gc                                       |
| CGO_CFLAGS   |                                          |
| CGO_CPPFLAGS |                                          |
| CGO_CXXFLAGS |                                          |
| CGO_ENABLED  | 1                                        |
| CGO_LDFLAGS  |                                          |
| GOARCH       | arm64                                    |
| GOARM64      | v8.0                                     |
| GOOS         | darwin                                   |
| vcs          | git                                      |
| vcs.modified | false                                    |
| vcs.revision | 4a445ce218b58db4a16ee8fa84eac0d7c9a69932 |
| vcs.time     | 2025-08-04T22:42:25Z                     |
└─────────────────────────────────────────────────────────┘

# Dependencies

┌────────────────────────────────────────────────────────────────────────┐
| Xcode cli tools | 2416                                                 |
| npm             | 10.9.2                                               |
| *NSIS           | Not Installed. Install with `brew install makensis`. |
|                                                                        |
└─────────────────────── * - Optional Dependency ────────────────────────┘

Please paste the output of wails doctor. If you are unable to run this command, please describe your environment in as much detail as possible.

Checklist:

  • I have updated website/src/pages/changelog.mdx with details of this PR
  • My code follows the general coding style of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Summary by CodeRabbit

  • New Features

    • Added Universal Link / web URL continuation on macOS so apps can open directly from supported web links.
  • Refactor

    • Unified macOS URL handling and Apple Event processing, preserving existing window-reopen behavior.
  • Documentation

    • Added cross-platform guidance for Universal Links and Web-to-App linking with configuration and hosting examples for macOS and Windows.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 14, 2025

Walkthrough

Renames the C-exported URL handler from HandleCustomProtocol to HandleOpenURL, adds macOS Universal Link support via application:continueUserActivity:restorationHandler:, updates Apple Event URL handling to call the new entry, removes an obsolete secure restorable state declaration, and adjusts a reopen method signature.

Changes

Cohort / File(s) Summary
Go export rename
v3/pkg/application/application_darwin.go
Exported C bridge renamed: HandleCustomProtocol(urlCString *C.char)HandleOpenURL(urlCString *C.char) (behavior unchanged).
Objective‑C header updates
v3/pkg/application/application_darwin_delegate.h
Replaced extern void HandleCustomProtocol(char*); with extern void HandleOpenURL(char*);, removed - (BOOL)applicationSupportsSecureRestorableState:(NSApplication *)app;, added + (void)handleGetURLEvent:withReplyEvent:, and updated comment to include Universal Link support.
Delegate implementation changes
v3/pkg/application/application_darwin_delegate.m
Added application:continueUserActivity:restorationHandler: to handle Universal Links (calls HandleOpenURL), updated Apple Event handler to call HandleOpenURL, and changed applicationShouldHandleReopen:hasVisibleWindows: first parameter from NSApplication * to NSNotification *.
Docs & changelog
v3/UNRELEASED_CHANGELOG.md, docs/src/content/docs/guides/custom-protocol-association.mdx
Added changelog entry for macOS Universal Link support and expanded docs with Universal Links / Web-to-App linking guidance for macOS and Windows.

Sequence Diagram(s)

sequenceDiagram
    participant Apple as Apple OS
    participant Delegate as AppDelegate
    participant Go as Go runtime

    rect rgb(248, 249, 255)
    note over Apple,Delegate: Apple Event (Custom URL Scheme)
    Apple->>Delegate: handleGetURLEvent:withReplyEvent:
    Delegate->>Go: HandleOpenURL(urlString)
    Go->>Go: Parse URL & emit ApplicationLaunchedWithUrl
    end

    rect rgb(240, 255, 245)
    note over Apple,Delegate: Universal Link (NSUserActivity)
    Apple->>Delegate: application:continueUserActivity:restorationHandler:
    Delegate->>Delegate: check NSUserActivityTypeBrowsingWeb & webpageURL
    Delegate->>Go: HandleOpenURL(webpageURL)
    Go->>Go: Parse URL & emit ApplicationLaunchedWithUrl
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Verify //export and bridged symbol names match between Go and Objective‑C.
  • Inspect application:continueUserActivity:restorationHandler: for proper nil checks and webpageURL extraction.
  • Confirm any callers for applicationShouldHandleReopen: are compatible with the new NSNotification * parameter.

Suggested labels

Enhancement, size:M, lgtm

Suggested reviewers

  • leaanthony

Poem

🐰 I hopped through Darwin's apple tree,
A tiny URL came bounding to me,
From schemes and web links, one call to say—
HandleOpenURL starts the day! 🥕

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main feature being added: universal link support for macOS in V3.
Description check ✅ Passed The description follows the template structure with most required sections completed: type of change identified, macOS testing confirmed, test configuration provided, and relevant checklist items marked.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0db0c50 and 11b04a1.

📒 Files selected for processing (1)
  • docs/src/content/docs/guides/custom-protocol-association.mdx (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • docs/src/content/docs/guides/custom-protocol-association.mdx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Run Go Tests v3 (macos-latest, 1.24)
  • GitHub Check: Run Go Tests v3 (ubuntu-latest, 1.24)
  • GitHub Check: Run Go Tests v3 (windows-latest, 1.24)
  • GitHub Check: semgrep-cloud-platform/scan

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@leaanthony
Copy link
Member

Thanks 🙏 Please could you add an entry to the changelog located at v3/UNRELEASED_CHANGELOG.md? Thanks!

@APshenkin
Copy link
Contributor Author

@leaanthony added

@github-actions github-actions bot added the Documentation Improvements or additions to documentation label Nov 19, 2025
@leaanthony
Copy link
Member

Would it be possible to have some short documentation on how to use this feature? I'm ok having that in a later PR if we make a ticket for it 👍 Will be updating the docs significantly over the weekend so I'm ok to delay it 👍

@APshenkin
Copy link
Contributor Author

@leaanthony happy to add docs for v3, however can't see v3 site docs in repo. Where should I add it?

@leaanthony
Copy link
Member

@leaanthony happy to add docs for v3, however can't see v3 site docs in repo. Where should I add it?

Amazing! 🎉 They are in docs at the project root. The taskfile here docs/Taskfile.yml has everything you need. Just pick your package manager. Use task setup and you should be good to go 👍

@APshenkin
Copy link
Contributor Author

@leaanthony added

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 681d953 and 0db0c50.

📒 Files selected for processing (1)
  • docs/src/content/docs/guides/custom-protocol-association.mdx (2 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: APshenkin
Repo: wailsapp/wails PR: 4484
File: v2/internal/frontend/utils/urlValidator.go:25-31
Timestamp: 2025-08-08T13:15:20.339Z
Learning: In Wails v2 (PR wailsapp/wails#4484), for BrowserOpenURL URL validation (v2/internal/frontend/utils/urlValidator.go), maintainers (APshenkin) prefer not to restrict schemes to an http/https allowlist because supported schemes may vary. The allowlist suggestion is declined; continue with the existing denylist approach and generic validation.
📚 Learning: 2025-08-08T13:15:20.339Z
Learnt from: APshenkin
Repo: wailsapp/wails PR: 4484
File: v2/internal/frontend/utils/urlValidator.go:25-31
Timestamp: 2025-08-08T13:15:20.339Z
Learning: In Wails v2 (PR wailsapp/wails#4484), for BrowserOpenURL URL validation (v2/internal/frontend/utils/urlValidator.go), maintainers (APshenkin) prefer not to restrict schemes to an http/https allowlist because supported schemes may vary. The allowlist suggestion is declined; continue with the existing denylist approach and generic validation.

Applied to files:

  • docs/src/content/docs/guides/custom-protocol-association.mdx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Run Go Tests v3 (windows-latest, 1.24)
  • GitHub Check: Run Go Tests v3 (ubuntu-latest, 1.24)
  • GitHub Check: Run Go Tests v3 (macos-latest, 1.24)
  • GitHub Check: semgrep-cloud-platform/scan
🔇 Additional comments (2)
docs/src/content/docs/guides/custom-protocol-association.mdx (2)

112-113: Good clarification on macOS LaunchServices behavior.

The added explanation of how macOS delivers custom protocol URLs via LaunchServices and Apple Events is accurate and helpful context for users.


160-177: Verify Windows Web-to-App linking implementation and scope.

The Windows Web-to-App linking section references MSIX packaging. However, based on the PR description, the changes were tested only on macOS (not on Windows). Please verify:

  1. Is Web-to-App linking actually implemented in the Wails runtime for Windows?
  2. Does this feature work only with MSIX packages, or is it also supported when distributed via NSIS (the traditional Wails Windows installer approach)?
  3. Does the Windows implementation emit ApplicationLaunchedWithUrl for Web-to-App links as documented?

If this feature is not yet fully implemented or tested on Windows, consider adding a note clarifying the current support status or deferring this section to a follow-up PR once implementation and testing are complete.

@APshenkin
Copy link
Contributor Author

@leaanthony added. Was blind to not find folder with docs 😀

@sonarqubecloud
Copy link

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

Labels

Documentation Improvements or additions to documentation MacOS v3-alpha

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants