# Mobile App Update Module (Build + OTA)

Platform-admin API to update existing white-label apps without re-scaffolding.

## Endpoints (`/api/mobile-app-update`)

| Method | Path | Description |
|--------|------|-------------|
| GET | `/companies` | Companies with linked `COMPANY_CUSTOM` apps + OTA flags |
| GET | `/companies/{id}` | Panel: EAS project id, versions, recent jobs |
| PATCH | `/companies/{id}/ota-eligibility` | `{ "otaEnabled": true\|false }` |
| POST | `/companies/{id}/sync-eas-project` | Read `easProjectId` from Bitbucket `app.json` |
| POST | `/config` | Multipart assets/colors/UI → Bitbucket PR (no pipeline) |
| POST | `/build` | `{ "companyId", "platform": "android\|ios\|all" }` — **one build at a time** |
| POST | `/ota` | `{ "companyIds": [...] }` or `{ "allEligible": true }` — batch background |
| GET | `/jobs` | List jobs (`type`, `status`, `companyId`, `batchId`) |
| GET | `/jobs/{id}` | Job detail + Bitbucket pipeline refresh |
| GET | `/batches/{batchId}` | OTA batch summary |

Requires `PLATFORM_ADMIN`.

## Pipelines (mobile-tp-v2)

| Custom pipeline | Variables |
|-----------------|-----------|
| `update-eas-build` | `APP_NAME`, `PLATFORM` (default `all`), `EAS_PROFILE` (default `production`) |
| `update-eas-ota` | `APP_NAME`, `UPDATE_BRANCH` (default `production`), `UPDATE_MESSAGE` |

Scripts: `scripts/ci/eas-build.sh`, `scripts/ci/eas-ota.sh`.

## Workers

```bash
php bin/console messenger:consume mobile_updates --time-limit=3600 --memory-limit=256M
```

## Version catalog

After a successful BUILD or OTA, register the new version with existing `/api/mobile-app/{appId}/versions` (`releaseType: BUILD` or `UPDATE`). This module does not auto-bump the catalog.
