Files
livrets/docs/superpowers/specs/2026-08-28-livrets-desktop-design.md

44 lines
2.3 KiB
Markdown
Raw Permalink 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.
# Design : cible desktop macOS — Livrets
Date : 2026-08-28
Statut : Validé par le produit
## 1. Objectif
Ajouter une cible desktop macOS (Compose Multiplatform desktop) à l'app Livrets existante (Android + iOS), lançable via `./gradlew :desktopApp:run`. Zéro modification du code métier/UI existant.
## 2. Décisions clés
| Décision | Choix |
|---|---|
| Usage | Run Gradle uniquement (pas de packaging .app/.dmg en v1) |
| Structure | Nouveau module hôte `desktopApp/` (miroir d'`androidApp`), dépend de `:sharedUI` |
| Fenêtre | "Livrets", 480×800 dp, fermeture = exit |
| Stockage | `~/.livrets/history.json` (créé à la première sauvegarde par HistoryRepository) |
| JVM | compat source/target Java 17 + jvmTarget Kotlin 17 (alignement des deux tâches) |
Rejeté : cible desktop dans `sharedUI` (mélange bibliothèque/hôte) ; UI desktop native (UI Compose déjà partagée).
## 3. Architecture
- `settings.gradle.kts` : + `include(":desktopApp")`
- `desktopApp/build.gradle.kts` : plugins kotlin-jvm + compose-compiler + compose-multiplatform (aliases existants) ; `java { source/targetCompatibility 17 }` + `kotlin { jvmTarget 17 }` (sinon conflit compileJava 18 vs compileKotlin 17) ; dépendances `implementation(project(":sharedUI"))` + `implementation(compose.desktop.currentOs)` ; bloc `compose.desktop { application { mainClass = "com.livrets.desktop.MainKt" } }`
- `desktopApp/src/main/kotlin/com/livrets/desktop/Main.kt` : `fun main() = application { Window(onCloseRequest = ::exitApplication, title = "Livrets", state = rememberWindowState(480.dp, 800.dp)) { App(filesDirPath = storageDir()) } }` ; `storageDir() = System.getProperty("user.home") + "/.livrets"`
- `README.MD` : section "macOS desktop" (lancement)
## 4. Faisabilité (validée en sandbox)
`:desktopApp:jar` compile ; `:desktopApp:run` ouvre la fenêtre et le processus JVM reste vivant (testé sur cette machine, JDK 18, JVM x86_64 sous Rosetta — sans conséquence pour desktop).
## 5. Tests & vérifications
- `:desktopApp:jar` → compile
- `:desktopApp:run` → fenêtre visible (vérification manuelle de l'utilisateur)
- Régression : `:sharedUI:jvmTest` (20/20) + `:androidApp:assembleDebug` inchangés
## 6. Hors périmètre
- Packaging .app/.dmg, signature/notarisation
- Redimensionnement adaptatif de l'UI desktop, raccourcis clavier
- Distribution (DMG, Homebrew)