Skip to content

feat: implement Android App Links and initialize core frontend routin…#95

Open
zinodict121 wants to merge 1 commit into
ericmt-98:mainfrom
zinodict121:feature/app-links
Open

feat: implement Android App Links and initialize core frontend routin…#95
zinodict121 wants to merge 1 commit into
ericmt-98:mainfrom
zinodict121:feature/app-links

Conversation

@zinodict121
Copy link
Copy Markdown

@zinodict121 zinodict121 commented May 27, 2026

Closes #77


📱 Feature: Android App Links implementation for claim_url

📝 Description

This PR implements native Android App Links to automatically intercept and route MicoPay claim URLs (e.g., https://app.micopay.xyz/claim/mcr-abc). When an agent sends a claim link via SMS or WhatsApp, tapping it will now open the MicoPay app directly to the ClaimQR screen without prompting a browser disambiguation dialog.

🛠️ Technical Implementation

  1. Android Manifest (AndroidManifest.xml):

    • Added an <intent-filter> with android:autoVerify="true" for the https scheme, host app.micopay.xyz, and path prefix /claim/.
    • Relies on the existing launchMode="singleTask" to ensure backgrounded instances receive new intents gracefully via onNewIntent.
  2. Backend Asset Links (assetlinks.json & index.ts):

    • Created the .well-known/assetlinks.json file pointing to com.micopay.app.
    • Installed @fastify/static (v7 to maintain compatibility with Fastify v4) to serve the public/ directory.
    • Added an explicit GET route in Fastify for /.well-known/assetlinks.json to ensure a direct HTTP 200 OK (Android's verifier will fail if redirects occur) alongside correct Cache-Control and Content-Type headers.
  3. React App Capacitor Routing (App.tsx):

    • Implemented a hidden AppUrlOpenListener component mounted inside <HashRouter>.
    • Safely parses incoming URLs. Since Android delivers the raw URL (e.g., /claim/mcr-abc), the listener pulls the pathname and passes it directly to useNavigate(pathname), which HashRouter natively translates to #/claim/mcr-abc.
    • Wrapped the listener logic in Capacitor.isNativePlatform() to ensure the web builds (npm run dev) remain entirely unaffected.
    • Added a standalone ClaimQRRoute and hid the BottomNav for all /claim/ views.

⚠️ IMPORTANT TO DO BEFORE MERGING

  • The sha256_cert_fingerprints field in micopay/backend/public/.well-known/assetlinks.json currently contains a "TODO" placeholder.
  • You must replace this placeholder with the actual SHA-256 App Signing Certificate Fingerprint. (If deploying to Google Play, get this fingerprint from the Play Console under Setup > App integrity).

🧪 Testing Steps

  1. Checkout this branch and run npm install inside micopay/backend and micopay/frontend.
  2. Sync capacitor changes: cd micopay/frontend && npx cap sync android.
  3. Boot the backend server (npm run dev in backend) to host the assetlinks endpoint.
  4. Launch the Android Emulator using Android Studio and install the APK.
  5. While the app is closed, run the following intent from your terminal:
    adb shell am start -W -a android.intent.action.VIEW -d "https://app.micopay.xyz/claim/mcr-test-123" com.micopay.app
    Expected result: The app cold-boots directly into the ClaimQR screen.
  6. Press the device Home button to background the app and run the command again.
    Expected result: The existing app session is brought to the foreground and reroutes to the new claim URL immediately.

@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented May 27, 2026

@zinodict121 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

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.

Android App Links for claim_url deep linking

2 participants