Self-Update App: Update-Check & APK-Download (Data/Domain-Layer) #84

Closed
opened 2026-05-17 00:22:51 +00:00 by jreinemann-euris · 0 comments
jreinemann-euris commented 2026-05-17 00:22:51 +00:00 (Migrated from github.com)

Feature: App – Update-Check & APK-Download (Data/Domain-Layer)

Part of: #69

Ziel

Die App kann beim Server prüfen, ob eine neuere Version verfügbar ist, und die APK herunterladen. Dieser Schritt implementiert den Data- und Domain-Layer ohne UI.

Scope

  • VersionInfo-Datenmodell: versionCode: Int, versionName: String, apkUrl: String
  • UpdateRepository-Interface + Implementierung:
    • checkForUpdate(serverUrl: String): Result<VersionInfo> – ruft GET /api/version auf
    • downloadApk(apkUrl: String, targetFile: File, onProgress: (Float) -> Unit): Result<File> – lädt APK mit Progress-Callback
  • CheckForUpdateUseCase: Vergleicht VersionInfo.versionCode mit BuildConfig.VERSION_CODE, gibt UpdateAvailable(versionInfo) oder UpToDate zurück
  • Hilt-DI-Modul für UpdateRepository
  • Kein Update-Check wenn keine Server-URL konfiguriert ist (prüft SettingsKeys.SERVER_URL)
  • Download-Ziel: context.cacheDir/update/app-latest.apk

Technische Hinweise

  • Bestehender HttpClient (Ktor/OkHttp) aus NetworkModule wiederverwenden
  • BuildConfig.VERSION_CODE ist im App-Modul verfügbar (versionCode = 3)
  • SettingsRepository existiert bereits für Server-URL-Zugriff
  • /api/version ist ein öffentlicher Endpoint (kein Auth-Token nötig)
  • APK-Download braucht keinen Auth-Token (statische Datei)
  • Download-Progress kann über OkHttp ResponseBody-Streaming berechnet werden

Akzeptanzkriterien

  • UpdateRepository.checkForUpdate() ruft /api/version auf und parst die Antwort
  • UpdateRepository.downloadApk() lädt die APK mit Fortschritts-Callback
  • CheckForUpdateUseCase vergleicht Versionscodes und gibt korrektes Ergebnis zurück
  • Kein Netzwerk-Call wenn Server-URL leer ist
  • Unit-Tests für UseCase und Repository (mit Mock-HTTP-Client)
## Feature: App – Update-Check & APK-Download (Data/Domain-Layer) Part of: #69 ### Ziel Die App kann beim Server prüfen, ob eine neuere Version verfügbar ist, und die APK herunterladen. Dieser Schritt implementiert den Data- und Domain-Layer ohne UI. ### Scope - `VersionInfo`-Datenmodell: `versionCode: Int`, `versionName: String`, `apkUrl: String` - `UpdateRepository`-Interface + Implementierung: - `checkForUpdate(serverUrl: String): Result<VersionInfo>` – ruft `GET /api/version` auf - `downloadApk(apkUrl: String, targetFile: File, onProgress: (Float) -> Unit): Result<File>` – lädt APK mit Progress-Callback - `CheckForUpdateUseCase`: Vergleicht `VersionInfo.versionCode` mit `BuildConfig.VERSION_CODE`, gibt `UpdateAvailable(versionInfo)` oder `UpToDate` zurück - Hilt-DI-Modul für UpdateRepository - Kein Update-Check wenn keine Server-URL konfiguriert ist (prüft `SettingsKeys.SERVER_URL`) - Download-Ziel: `context.cacheDir/update/app-latest.apk` ### Technische Hinweise - Bestehender `HttpClient` (Ktor/OkHttp) aus `NetworkModule` wiederverwenden - `BuildConfig.VERSION_CODE` ist im App-Modul verfügbar (`versionCode = 3`) - `SettingsRepository` existiert bereits für Server-URL-Zugriff - `/api/version` ist ein öffentlicher Endpoint (kein Auth-Token nötig) - APK-Download braucht keinen Auth-Token (statische Datei) - Download-Progress kann über `OkHttp` ResponseBody-Streaming berechnet werden ### Akzeptanzkriterien - [ ] `UpdateRepository.checkForUpdate()` ruft `/api/version` auf und parst die Antwort - [ ] `UpdateRepository.downloadApk()` lädt die APK mit Fortschritts-Callback - [ ] `CheckForUpdateUseCase` vergleicht Versionscodes und gibt korrektes Ergebnis zurück - [ ] Kein Netzwerk-Call wenn Server-URL leer ist - [ ] Unit-Tests für UseCase und Repository (mit Mock-HTTP-Client)
Sign in to join this conversation.
No description provided.