Skip to content

chore: sync upstream PR #5706 - feat: Add referrerUrl#2

Closed
riderx wants to merge 4 commits intoplusfrom
sync/upstream-pr-5706
Closed

chore: sync upstream PR #5706 - feat: Add referrerUrl#2
riderx wants to merge 4 commits intoplusfrom
sync/upstream-pr-5706

Conversation

@riderx
Copy link
Copy Markdown
Member

@riderx riderx commented Nov 28, 2025

Upstream PR Sync

This PR syncs changes from an external contributor's PR on the official Capacitor repository.

Original PR

Automation

  • CI will run automatically
  • Claude Code will review for security/breaking changes
  • If approved, this PR will be auto-merged

Synced from upstream by Capacitor+ Bot

Summary by CodeRabbit

  • New Features
    • Added referrer URL retrieval capability for incoming links
    • Enhanced link notification payloads to include referrer URL data

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

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Nov 28, 2025

Warning

Rate limit exceeded

@riderx has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 23 minutes and 54 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between e088ca9 and 35f0d8d.

📒 Files selected for processing (2)
  • ios/Capacitor/Capacitor/CAPApplicationDelegateProxy.swift (2 hunks)
  • ios/Capacitor/Capacitor/CAPBridge.swift (1 hunks)

Walkthrough

These changes add referrer URL tracking for universal links in the iOS Capacitor framework. A new public referrerUrl property is introduced to ApplicationDelegateProxy to capture the referrer URL from user activities, and a corresponding getter method is exposed via CAPBridge.

Changes

Cohort / File(s) Summary
Referrer URL property addition
ios/Capacitor/Capacitor/CAPApplicationDelegateProxy.swift
Added public read-only property referrerUrl: URL? with private setter. Captures userActivity.referrerURL during universal link continuation and includes it in the universal link notification payload.
Referrer URL API exposure
ios/Capacitor/Capacitor/CAPBridge.swift
Added public static method getReferrerUrl() -> URL? that returns the shared ApplicationDelegateProxy's referrerUrl property.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Straightforward property addition with minimal logic
  • Simple getter method delegating to existing shared instance
  • No complex control flow or behavioral changes
  • Limited surface area affecting only two files

Poem

🐰 A referrer URL hops in the light,
Tracking universal links through the night,
Properties now capture the path, so right,
The bridge exposes it, clean and tight! 🔗

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main change: syncing upstream PR ionic-team#5706 which adds referrerUrl functionality to Capacitor. The summary shows new properties and methods were added to handle referrer URLs in universal link handling.

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.

Copy link
Copy Markdown

@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: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4c7c126 and e088ca9.

📒 Files selected for processing (2)
  • ios/Capacitor/Capacitor/CAPApplicationDelegateProxy.swift (2 hunks)
  • ios/Capacitor/Capacitor/CAPBridge.swift (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
ios/Capacitor/Capacitor/CAPApplicationDelegateProxy.swift (1)
ios/Capacitor/Capacitor/CAPNotifications.swift (1)
  • name (52-67)
⏰ 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). (2)
  • GitHub Check: test-android
  • GitHub Check: test-core
🔇 Additional comments (3)
ios/Capacitor/Capacitor/CAPApplicationDelegateProxy.swift (2)

28-28: I'll help you verify and rewrite this review comment. Let me start by examining the file and checking the iOS deployment target configuration.
<function_calls>

#!/bin/bash

First, let's examine the file and context around line 28

cat -n ios/Capacitor/Capacitor/CAPApplicationDelegateProxy.swift | head -40


</function_calls>

#!/bin/bash

Check the iOS deployment target in pbxproj files

fd -e pbxproj | head -5 | xargs -I {} grep -n "IPHONEOS_DEPLOYMENT_TARGET" {} | head -20


</function_calls>

NSUserActivity referrerURL iOS API availability minimum version

</function_calls>


29-32: Notification payload correctly handles optional referrerUrl; external consumers must verify proper nil handling on their end.

The implementation properly handles the optional referrerUrl:

  • referrerUrl property is correctly typed as optional (URL?)
  • It's assigned from userActivity.referrerURL, which is already optional
  • The notification payload includes it as-is, allowing nil values
  • CAPBridge.getReferrerUrl() exposes it as optional to callers

External plugins and the JavaScript layer consuming .capacitorOpenUniversalLink notifications must handle the nil case when accessing the referrerUrl field from the notification payload.

ios/Capacitor/Capacitor/CAPBridge.swift (1)

14-16: NSUserActivity.referrerURL has been available since iOS 9, not iOS 11. The project targets iOS 15.0, which is well above the minimum requirement.

Based on Apple's official documentation, the NSUserActivity.referrerURL property was introduced in iOS 9 as part of the App Search and NSUserActivity APIs, not iOS 11 as stated in the review comment. Since this Capacitor project has a deployment target of iOS 15.0 (confirmed in ios/Capacitor/Capacitor.xcodeproj/project.pbxproj), there are no compatibility concerns. The implementation is safe to use.

public static let shared = ApplicationDelegateProxy()

public private(set) var lastURL: URL?
public private(set) var referrerUrl: URL?
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Consider when referrerUrl should be cleared.

The referrerUrl property is set during universal link handling but is never cleared. Unlike lastURL (which is updated on every URL open), referrerUrl may persist across multiple app launches or URL opens, potentially leading to stale data.

Consider whether referrerUrl should be:

  1. Cleared when handling regular URL opens (in application(_:open:options:) on line 10)
  2. Cleared when handling universal links that have no referrer
  3. Left as-is if the intent is to preserve the most recent referrer

Please clarify the intended lifecycle behavior.

🤖 Prompt for AI Agents
In ios/Capacitor/Capacitor/CAPApplicationDelegateProxy.swift around line 8,
referrerUrl is set during universal link handling but never cleared, which can
leave stale data across launches; modify handling so referrerUrl is cleared when
a non-universal URL is opened (application(_:open:options:)), and also
explicitly clear it when a universal link is processed that contains no referrer
(or when processing fails); implement these clears alongside the existing
updates to lastURL and add a short comment documenting the intended lifecycle
(referrer only valid immediately after a universal link is handled).

@riderx riderx force-pushed the sync/upstream-pr-5706 branch from e088ca9 to 35f0d8d Compare November 28, 2025 15:06
@riderx
Copy link
Copy Markdown
Member Author

riderx commented Mar 23, 2026

Thanks for your PR. Security-related changes should be coordinated through a private advisory before opening a public PR.\n\nPlease open a private advisory here:\n- https://capgo.app/fr/security/\n- https://github.com/Cap-go/capgo/security/advisories/new\n\nI am closing this PR for now.

@riderx riderx closed this Mar 23, 2026
@riderx
Copy link
Copy Markdown
Member Author

riderx commented Mar 23, 2026

Thanks for the submission.
This PR has no file changes and is older than 1 day, so it is being closed.
Please reopen with concrete code changes when ready.

@riderx
Copy link
Copy Markdown
Member Author

riderx commented Mar 23, 2026

This PR appears to describe a security-related issue publicly. For security changes, please use a private advisory before opening a public PR. See https://capgo.app/fr/security/ and https://github.com/Cap-go/capgo/security/advisories/new.

@riderx
Copy link
Copy Markdown
Member Author

riderx commented Mar 23, 2026

Thanks for your submission. Security-sensitive public PRs should be disclosed via private advisory first.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants