Remove hard-coded domains; default to localhost and env config
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
1ed5e9729e
commit
d7afad349f
27
README.md
27
README.md
|
|
@ -29,8 +29,6 @@ The QR scanner needs a real device camera (the web build and simulators fall bac
|
||||||
code under the QR).
|
code under the QR).
|
||||||
|
|
||||||
- **Expo Go**: `pnpm start`, scan the terminal QR with Expo Go (Android) or the Camera app (iOS).
|
- **Expo Go**: `pnpm start`, scan the terminal QR with Expo Go (Android) or the Camera app (iOS).
|
||||||
Everything works except universal/app links (`https://grv.ethiopiatrustfund.org/q/...`);
|
|
||||||
test those with the dev client.
|
|
||||||
- **Dev client**: `eas build --profile development --platform ios|android`, install it, then
|
- **Dev client**: `eas build --profile development --platform ios|android`, install it, then
|
||||||
`pnpm start` and open the project from the dev client.
|
`pnpm start` and open the project from the dev client.
|
||||||
|
|
||||||
|
|
@ -53,26 +51,13 @@ Bundle id / package: `org.ethiopiatrustfund.grvsummit`. Scheme: `grvsummit`.
|
||||||
|
|
||||||
## Deep links
|
## Deep links
|
||||||
|
|
||||||
Printed checkpoint QRs encode `https://grv.ethiopiatrustfund.org/q/<token>`. With the app
|
Printed checkpoint QRs encode `<SITE_URL>/q/<token>` (backend `SITE_URL`). That site page opens
|
||||||
installed, the phone's camera opens the app on `src/app/q/[token].tsx`, which calls
|
`grvsummit://q/<token>`, which lands on `src/app/q/[token].tsx`: it calls `POST /scan` once and shows
|
||||||
`POST /scan` once and shows the result (signed-out users go through login first and come back).
|
the result (signed-out users go through login first and come back). Inside the app, the Scan tab
|
||||||
`grvsummit://q/<token>` works too (handy for testing: `npx uri-scheme open grvsummit://q/abc --ios`).
|
reads the same codes directly. Test: `npx uri-scheme open grvsummit://q/abc --ios`.
|
||||||
|
|
||||||
Configured in `app.json`:
|
Universal/app links (camera opens the app without the site page) need a domain; add iOS
|
||||||
|
`associatedDomains`, Android `intentFilters` and the site's `.well-known` files once there is one.
|
||||||
- iOS `associatedDomains: ["applinks:grv.ethiopiatrustfund.org"]`
|
|
||||||
- Android `intentFilters` for `https://grv.ethiopiatrustfund.org/q/*` with `autoVerify`
|
|
||||||
|
|
||||||
The site must serve the verification files (not done here; belongs in the GRVSummit site):
|
|
||||||
|
|
||||||
- `https://grv.ethiopiatrustfund.org/.well-known/apple-app-site-association`
|
|
||||||
```json
|
|
||||||
{ "applinks": { "details": [{ "appIDs": ["<TEAMID>.org.ethiopiatrustfund.grvsummit"], "components": [{ "/": "/q/*" }] }] } }
|
|
||||||
```
|
|
||||||
- `https://grv.ethiopiatrustfund.org/.well-known/assetlinks.json` with the package name and the
|
|
||||||
release signing SHA-256 (`eas credentials` shows it).
|
|
||||||
|
|
||||||
Without the app, the same URL opens the website's `/q/<token>` page.
|
|
||||||
|
|
||||||
## Layout
|
## Layout
|
||||||
|
|
||||||
|
|
|
||||||
11
app.json
11
app.json
|
|
@ -10,7 +10,6 @@
|
||||||
"ios": {
|
"ios": {
|
||||||
"supportsTablet": false,
|
"supportsTablet": false,
|
||||||
"bundleIdentifier": "org.ethiopiatrustfund.grvsummit",
|
"bundleIdentifier": "org.ethiopiatrustfund.grvsummit",
|
||||||
"associatedDomains": ["applinks:grv.ethiopiatrustfund.org"],
|
|
||||||
"infoPlist": {
|
"infoPlist": {
|
||||||
"ITSAppUsesNonExemptEncryption": false
|
"ITSAppUsesNonExemptEncryption": false
|
||||||
}
|
}
|
||||||
|
|
@ -20,15 +19,7 @@
|
||||||
"adaptiveIcon": {
|
"adaptiveIcon": {
|
||||||
"foregroundImage": "./assets/adaptive-icon.png",
|
"foregroundImage": "./assets/adaptive-icon.png",
|
||||||
"backgroundColor": "#30614c"
|
"backgroundColor": "#30614c"
|
||||||
},
|
}
|
||||||
"intentFilters": [
|
|
||||||
{
|
|
||||||
"action": "VIEW",
|
|
||||||
"autoVerify": true,
|
|
||||||
"data": [{ "scheme": "https", "host": "grv.ethiopiatrustfund.org", "pathPrefix": "/q/" }],
|
|
||||||
"category": ["BROWSABLE", "DEFAULT"]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"web": {
|
"web": {
|
||||||
"bundler": "metro",
|
"bundler": "metro",
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ const who = (c: Checkpoint) =>
|
||||||
.join(' · ')
|
.join(' · ')
|
||||||
: [c.personName, c.label, c.organisation].filter(Boolean).join(' · ');
|
: [c.personName, c.label, c.organisation].filter(Boolean).join(' · ');
|
||||||
|
|
||||||
/** Reached from the Scan tab and from https://grv.ethiopiatrustfund.org/q/<token> deep links. */
|
/** Reached from the Scan tab and from grvsummit://q/<token> deep links (the site's /q page opens these). */
|
||||||
export default function ScanResultScreen() {
|
export default function ScanResultScreen() {
|
||||||
const { token } = useLocalSearchParams<{ token: string }>();
|
const { token } = useLocalSearchParams<{ token: string }>();
|
||||||
const [state, setState] = useState<State>({ kind: 'loading' });
|
const [state, setState] = useState<State>({ kind: 'loading' });
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user