carp-dk / carp-dk/carp_study_app

[EPIC] Automatically install app on QR code scan

Open
#509 1 comment 0 reactions 1 assignee Claimed by @Zeroupper View on GitHub
DevOpsAppStore
Dominant language
Dart
Stars
10
Forks
5
Avg merge
1d 3h
Merged PRs (30d)
14

Description

Firebase no longer supports dynamic links ([migration FAQ](https://firebase.google.com/support/dynamic-links-faq?authuser=0)). This issue tracks restoring the "scan a QR code → install the app → open straight into the right study" flow that Dynamic Links previously provided.

## Scope

This is larger than a single fix — it's a feature spanning a web redirect, native deep-link config, and **deferred deep linking**. Should likely be broken into sub-tasks (epic).

## Desired flow

```
QR (one URL: https://link.carp.dk/join?study=ABC123)
→ landing page detects platform
→ App Store (iOS) / Play Store (Android)
→ user installs & opens app
→ app opens directly on the correct study/invitation
```

## The core problem: data is lost at the store

The store install is a clean break. The store only knows *which app* to install — it does **not** carry `?study=ABC123` into a fresh install. Recovering that context post-install is "deferred deep linking".

Two cases behave differently:

- **App already installed** → Universal Link / App Link (`applinks:carp.computerome.dk`, already partly configured) opens the app with the full URL. ✅ Easy, data survives.
- **App not installed** → must bridge the gap. **Android:** Play Install Referrer API carries a `referrer` param reliably (official). **iOS:** no official equivalent — needs fingerprint matching / clipboard / 3rd-party service. ⚠️ This is the hard part Firebase used to handle.

## Current state in the app

- QR scanner already exists (`qr_code_scanner_plus`, `lib/ui/pages/qr_scanner.dart`) → reads a magic-link URI → `authenticateWithMagicLink()`. Only works if app is already installed.
- Deep linking enabled on both platforms but configured mainly for OAuth callbacks; associated domain `applinks:carp.computerome.dk` present.
- No Firebase Dynamic Links in the repo.

## Alternatives

1. **Build it ourselves** — web redirect (platform detection) + Play Install Referrer (Android) + custom fingerprint/clipboard matching backend (iOS). Free; iOS reliability mediocre; ongoing maintenance.
2. **Third-party deep-link service** (Branch / Adjust / AppsFlyer) — maintains the iOS deferred-matching infra Firebase abandoned. Least work; external dependency + cost. Most common Dynamic Links migration path.
3. **Degraded UX, no deferral** — QR → store → install → in-app "scan to join" prompt → user scans the same QR again (in-app scanner already works). Zero new infra; user scans twice.

## Suggested sub-tasks

- [ ] Web landing page with platform detection + store redirect
- [ ] Universal Links / App Links for study-join paths (already-installed case)
- [ ] Deferred deep linking — pick approach (DIY vs service)
- [ ] iOS deferred matching (the bottleneck)
- [ ] Android Play Install Referrer integration
- [ ] App-side: route fresh launch to study/invitation from recovered context

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.