new: replace in-memory record repository with JSON-backed implementation

This commit is contained in:
2026-07-07 22:45:41 +02:00
parent 7fc9011d78
commit c0d73f86c0
12 changed files with 324 additions and 125 deletions
+49
View File
@@ -0,0 +1,49 @@
# `:data:resources`
Owns the app's Compose Multiplatform resources (`Res`) and exposes them to other modules through the
`ResourceReader` interface, so consumer modules stay free of any platform/resource dependency.
## Un-versioned content
Some content is **not** checked into git (it is large and/or licensed course material). It must be
present locally under `src/commonMain/composeResources/files/` for the app to work, but is excluded
via `.gitignore`:
| Content | Files | Git-ignored by |
|------------------|-----------------------|-------------------------------|
| Audio recordings | `Chom_bev_*.m4a` | `*.m4a` |
| Subtitles | `Chom_bev_*_st_*.lrc` | `*.lrc` |
| Record catalogue | `records.json` | explicit path in `.gitignore` |
A fresh checkout will not contain these files; obtain them from another team member / the asset store
and drop them into `src/commonMain/composeResources/files/`.
## Records data (`records.json`)
The list of lessons shown in the app is loaded at runtime from
`src/commonMain/composeResources/files/records.json` (read via `ResourceReader`, then parsed with
`kotlinx.serialization` in `:data:records`). It is a JSON array of objects:
| Field | Type | Notes |
|-----------------------|----------|----------------------------------------------|
| `emoji` | string | Shown next to the record to illustrate it. |
| `transcription` | string | Breton title. |
| `translation` | string? | French translation (optional). |
| `audio` | string | Resource path, e.g. `files/Chom_bev_01.m4a`. |
| `subtitle` | string | Breton subtitle path (`.lrc`). |
| `translationSubtitle` | string? | Translation subtitle path (optional). |
The record `id`/`index` are assigned from each entry's 1-based position in the array.
**Getting started on a fresh checkout:** copy the versioned template and fill it in (or replace it
with the real catalogue):
```bash
cp data/resources/src/commonMain/composeResources/files/records.example.json \
data/resources/src/commonMain/composeResources/files/records.json
```
`records.example.json` is versioned and documents the schema. `records.json` is git-ignored.
Adding/reordering a record is a pure data edit in `records.json` — no code change needed. Make sure
the referenced `.m4a`/`.lrc` files exist in the same `files/` directory.
@@ -0,0 +1,18 @@
[
{
"emoji": "🙏",
"transcription": "An onestiz",
"translation": "La politesse",
"audio": "files/Chom_bev_01.m4a",
"subtitle": "files/Chom_bev_01_st_bzh.lrc",
"translationSubtitle": "files/Chom_bev_01_st_fr.lrc"
},
{
"emoji": "👋",
"transcription": "En em brezantiñ",
"translation": "Se présenter",
"audio": "files/Chom_bev_02.m4a",
"subtitle": "files/Chom_bev_02_st_bzh.lrc",
"translationSubtitle": "files/Chom_bev_02_st_fr.lrc"
}
]