Files
han-app/VM4_Expo-mobile/README.md
T

96 lines
3.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# HAN Chat Mobile
Мобильный Android-клиент HAN Chat на Expo SDK 57.
## Подготовка
1. Установить Node.js и npm.
2. Скопировать `.env.example` в `.env` и указать адреса API и Keycloak.
3. Установить зависимости:
```bash
npm install
```
4. Зарегистрировать `han-chat://auth/callback` как допустимый redirect URI клиента Keycloak.
## Локальные проверки
```bash
npm run typecheck
npm test
```
Запуск приложения выполняется отдельно командой `npm run android`. Проект использует managed Expo workflow и не хранит каталоги `android/` и `ios/`.
## Сборка (EAS)
Профили заданы в `eas.json`. Env для билда берётся из профиля (`eas.json` → `env`), а не из локального `.env`.
| Профиль | Артефакт | API | `EXPO_PUBLIC_APP_ENV` |
|---|---|---|---|
| `preview` | APK (внутренняя установка) | `dev-chat.han0107.ru` | `production-like` (есть «Диагностика») |
| `production` | AAB (Google Play) | `chat.han0107.ru` | `production` (без диагностики) |
| `development` | Dev Client | из окружения/локально | для разработки с `expo-dev-client` |
### Один раз: вход в Expo
```powershell
cd C:\Users\MI\Documents\Assistent\HAN_chat_specification\VM4_Expo-mobile
npx eas-cli login
npx eas-cli whoami
```
Проект уже привязан (`owner: anzh`, `projectId` в `app.config.ts`). Android keystore хранится remote на Expo.
### Перед сборкой (рекомендуется)
```powershell
npm run typecheck
npm test
```
### Preview — APK на телефон
```powershell
npx eas-cli build --profile preview --platform android
```
После успеха откройте ссылку из вывода CLI (или `https://expo.dev/accounts/anzh/projects/han-chat/builds`) и скачайте APK.
### Production — AAB для Play Store
```powershell
npx eas-cli build --profile production --platform android
```
`versionCode` поднимается автоматически (`appVersionSource: remote` + `autoIncrement`).
### Полезные команды
```powershell
# только отправить билд и сразу вернуть ссылку (не ждать окончания)
npx eas-cli build --profile production --platform android --no-wait
# статус конкретной сборки
npx eas-cli build:view <BUILD_ID>
# список последних сборок
npx eas-cli build:list --platform android --limit 5
# скачать артефакт готовой сборки
npx eas-cli build:download --id <BUILD_ID>
# синхронизировать versionCode с Play Console (если нужно вручную)
npx eas-cli build:version:set
```
### Keycloak redirect URI
Для боевого хоста в клиенте `han-chat-frontend` должны быть exact URI:
- `https://chat.han0107.ru/mobile/oidc/callback`
- `han-chat://auth/callback`
Для preview — те же пути на `https://dev-chat.han0107.ru`.