Krisenvorrat Inventar-App – Android-App (Kotlin) zur Verwaltung eines Krisenvorrats-Inventars
Find a file
Jens Reinemann 215790d68e feat(app): add Ktor HTTP client and SyncService for inventory sync
domain/model/SyncError.kt:
- Sealed class with ConnectionError, Timeout, AuthError, ServerError,
  NotConfigured, Unknown subtypes for typed error handling

domain/repository/SyncService.kt:
- Interface with downloadInventory() and uploadInventory() returning
  Result<InventoryDto> for clean error propagation

data/sync/SyncServiceImpl.kt:
- Ktor Client implementation using OkHttp engine
- GET /api/inventory and PUT /api/inventory endpoints
- X-API-Key header authentication matching server contract
- Server URL and API key read from SettingsRepository
- withContext(Dispatchers.IO) for network calls
- Catches SocketTimeoutException, ConnectException specifically

di/NetworkModule.kt:
- Hilt module providing singleton HttpClient with OkHttp engine
- ContentNegotiation with kotlinx.serialization JSON
- Configurable connect/read/write timeouts (10s/30s/30s)
- Binds SyncServiceImpl to SyncService interface

Dependencies:
- ktor-client-core, ktor-client-okhttp,
  ktor-client-content-negotiation, ktor-client-mock (test)
- ktor-serialization-kotlinx-json (shared with server)
- INTERNET permission added to AndroidManifest.xml

Tests: 9 tests with Ktor MockEngine covering success, 401, 500,
missing config, trailing slash URL normalization

Closes #44
2026-05-14 21:14:40 +02:00
.github feat(ui): add category and location management screens 2026-05-14 00:56:36 +02:00
.vscode chore: initial project setup with Copilot config, skills, and workspace structure 2026-05-13 13:40:41 +02:00
Anforderungen docs(server-tech): ADR für Server-Technologie – Ktor gewählt 2026-05-14 19:22:27 +02:00
app feat(app): add Ktor HTTP client and SyncService for inventory sync 2026-05-14 21:14:40 +02:00
gradle feat(app): add Ktor HTTP client and SyncService for inventory sync 2026-05-14 21:14:40 +02:00
memories/repo chore: initial project setup with Copilot config, skills, and workspace structure 2026-05-13 13:40:41 +02:00
server feat(server): add API-Key authentication for REST endpoints 2026-05-14 20:50:16 +02:00
shared feat(shared): add shared module with common DTO models 2026-05-14 19:50:23 +02:00
.gitignore feat(server): add Exposed ORM database layer with H2 2026-05-14 20:15:07 +02:00
build.gradle.kts feat(server): add Ktor server module with health endpoint 2026-05-14 20:06:40 +02:00
gradle.properties fix: Build-Fehler beheben (gradle.properties, Theme, Icon) (#13) 2026-05-13 16:18:22 +02:00
gradlew feat: Android-Projekt-Gerüst anlegen (#13) 2026-05-13 15:24:39 +02:00
gradlew.bat feat: Android-Projekt-Gerüst anlegen (#13) 2026-05-13 15:24:39 +02:00
settings.gradle.kts feat(server): add Ktor server module with health endpoint 2026-05-14 20:06:40 +02:00