Dispatch Android deep links via Intent URI#3902
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughThis PR adds Android-specific deep-link navigation support by extracting Android package names from asset links metadata and using them to build intent:// URLs. When users on Android (excluding Firefox) tap action buttons, the app attempts native navigation via intent:// protocol with an HTTPS fallback. ChangesAndroid Intent Deep-Link Navigation
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
apps/web/app/app.dub.co/(deeplink)/deeplink/[domain]/[[...key]]/action-buttons.tsxParsing error: The keyword 'import' is reserved apps/web/app/app.dub.co/(deeplink)/deeplink/[domain]/[[...key]]/page.tsxParsing error: The keyword 'import' is reserved 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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
apps/web/app/app.dub.co/(deeplink)/deeplink/[domain]/[[...key]]/action-buttons.tsx (1)
32-51: 💤 Low valueIntent URL construction looks correct; one minor edge case to consider.
The
intent://URL is built fromurl.host + url.pathname + userQuery, which silently dropsurl.searchandurl.hashiflink.shortLinkever contains them. Similarly, thefallbackconcatenates${link.shortLink}?skip_deeplink_preview=1..., which would produce an invalid??ifshortLinkalready had a query string. In practice, dub short links don't carry query strings or fragments, so this is purely defensive, but usingURLfor both branches would be more robust:♻️ Optional defensive refactor
- const url = new URL(link.shortLink); - const userQuery = searchParamsString ? `?${searchParamsString}` : ""; - const fallback = `${link.shortLink}?skip_deeplink_preview=1${ - searchParamsString ? `&${searchParamsString}` : "" - }`; + const url = new URL(link.shortLink); + const userQuery = searchParamsString ? `?${searchParamsString}` : ""; + + const fallbackUrl = new URL(link.shortLink); + fallbackUrl.searchParams.set("skip_deeplink_preview", "1"); + for (const [k, v] of searchParams.entries()) { + if (k !== "skip_deeplink_preview") fallbackUrl.searchParams.append(k, v); + } + const fallback = fallbackUrl.toString(); const extras = [ `scheme=${url.protocol.replace(":", "")}`, `package=${androidPackageName}`, `S.browser_fallback_url=${encodeURIComponent(fallback)}`, "end", ].join(";"); - window.location.href = `intent://${url.host}${url.pathname}${userQuery}#Intent;${extras}`; + window.location.href = `intent://${url.host}${url.pathname}${url.search}${userQuery}#Intent;${extras}`;Also nit: the
FxiOSpart of/Firefox|FxiOS/iis iOS-specific Firefox and unreachable under theplatform === "android"guard —/Firefox/iwould suffice. Harmless either way.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/web/app/app.dub.co/`(deeplink)/deeplink/[domain]/[[...key]]/action-buttons.tsx around lines 32 - 51, The intent URL building silently drops existing query/hash and the fallback can produce double-question-marks; update the android branch to build both the intent target and the fallback using the parsed URL object (use url.origin/host + pathname + url.search + url.hash when constructing the intent path and use URL/searchParams to append skip_deeplink_preview and any searchParamsString for the fallback) so existing ? and # are preserved and no "??" occurs; also simplify the Firefox detection to /Firefox/i (referencing platform, androidPackageName, link.shortLink, searchParamsString, url, and window.location.href in the android branch).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In
`@apps/web/app/app.dub.co/`(deeplink)/deeplink/[domain]/[[...key]]/action-buttons.tsx:
- Around line 32-51: The intent URL building silently drops existing query/hash
and the fallback can produce double-question-marks; update the android branch to
build both the intent target and the fallback using the parsed URL object (use
url.origin/host + pathname + url.search + url.hash when constructing the intent
path and use URL/searchParams to append skip_deeplink_preview and any
searchParamsString for the fallback) so existing ? and # are preserved and no
"??" occurs; also simplify the Firefox detection to /Firefox/i (referencing
platform, androidPackageName, link.shortLink, searchParamsString, url, and
window.location.href in the android branch).
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 68a92bbf-c7eb-4ee1-a16a-d1fea2be5e19
📒 Files selected for processing (2)
apps/web/app/app.dub.co/(deeplink)/deeplink/[domain]/[[...key]]/action-buttons.tsxapps/web/app/app.dub.co/(deeplink)/deeplink/[domain]/[[...key]]/page.tsx
Summary by CodeRabbit