Messenger/packages/mobile/README.md
Заид Омар Медхат | Zaid Omar Medhat f653b083aa f
2026-07-13 12:32:00 +05:00

67 lines
2.7 KiB
Markdown

# Zovi Mobile (Expo)
React Native + Expo (SDK 54) client for Altricade, consuming the shared
`@altricade/core` package as source. FSD layout: `app/` holds thin expo-router
route files only; all logic and UI live under `src/`.
## Prerequisites
- The backend + infra stack running (Postgres, Redis, MinIO, Centrifugo) — see
`infra/docker-compose.yml`. Start the Fastify backend so the API is on
`http://localhost:8080`.
- On a physical device the API/WS host must be reachable from the phone, so
point the client at your machine's LAN IP (see env below), not `localhost`.
## Run
```bash
pnpm install # from the repo root
# From packages/mobile:
pnpm start # Metro + dev menu
pnpm ios # build & run iOS (needs a dev build)
pnpm android # build & run Android (needs a dev build)
```
This app uses native modules (reanimated, gesture-handler, camera, audio,
video, secure-store, notifications), so it requires a **development build**
(`expo-dev-client`) — it will not run in Expo Go. Build one with EAS or
`expo run:ios` / `expo run:android`.
### Environment
Public config is read from `app.config.ts` `extra`, driven by `EXPO_PUBLIC_*`:
| Variable | Default | Purpose |
| ------------------------- | -------------------------------------------------- | -------------------------------- |
| `EXPO_PUBLIC_API_URL` | `http://localhost:8080/api` | REST base URL |
| `EXPO_PUBLIC_WS_URL` | `ws://localhost:8080/connection/websocket` | Centrifugo websocket |
| `EXPO_PUBLIC_PUSH_ENABLED`| unset (off) | Enable native push registration |
Example for a device on your LAN:
```bash
EXPO_PUBLIC_API_URL=http://192.168.1.20:8080/api \
EXPO_PUBLIC_WS_URL=ws://192.168.1.20:8080/connection/websocket \
pnpm start
```
## Quality gates
```bash
pnpm typecheck # tsc --noEmit (strict, no any/assertions/!)
pnpm lint # eslint
```
## Auth transport
Native uses token-mode auth: the refresh token is stored in `expo-secure-store`
(Keychain/Keystore) and sent in the request body with an `X-Auth-Mode: token`
header, instead of the web's httpOnly cookie. The access token stays in memory.
## Push notifications
Native push (FCM/APNs) needs a build with push credentials and cannot run in
Expo Go, so registration is gated behind `EXPO_PUBLIC_PUSH_ENABLED`. Tap-to-open
deep-linking (`src/services/usePush.ts`) is always wired, so once credentials
are configured, flip the flag and notifications route into the right chat.