refactor(ping-feature): integrate DI refactor, enhance web build, and update feature workflow

Refactored the `ping-feature` module to adopt centralized `HttpClient` through Koin DI, replacing legacy implementations. Added secure API calls with improved error handling and updated Webpack build scripts to resolve worker path issues. Enhanced `PingScreen` with extended functionality, UI updates, and aligned test cases for the new architecture. Consolidated feature workflows and finalized documentation with a comprehensive feature implementation guide.
This commit is contained in:
2026-01-17 12:05:34 +01:00
parent cc4eade957
commit 59568a42d8
14 changed files with 305 additions and 82 deletions
@@ -146,7 +146,9 @@ val copySqliteWorkerJs by tasks.registering(Copy::class) {
// Root build directory where Kotlin JS packages are assembled.
// Use a concrete path (instead of a Provider) so the Copy task always materializes the directory.
into(rootProject.layout.buildDirectory.asFile.get().resolve("js/packages/${rootProject.name}-frontend-shells-meldestelle-portal/kotlin"))
// The package name is constructed from the project path: Meldestelle-frontend-shells-meldestelle-portal
// Note: We use rootProject.layout.buildDirectory because Kotlin JS plugin puts packages in root build dir.
into(rootProject.layout.buildDirectory.dir("js/packages/${rootProject.name}-frontend-shells-meldestelle-portal/kotlin"))
}
// Ensure the worker is present for the production bundle.
@@ -154,6 +156,11 @@ tasks.named("jsBrowserProductionWebpack") {
dependsOn(copySqliteWorkerJs)
}
// Ensure the worker is present for the development bundle.
tasks.named("jsBrowserDevelopmentWebpack") {
dependsOn(copySqliteWorkerJs)
}
// KMP Compile-Optionen
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
compilerOptions {
@@ -8,7 +8,7 @@ import androidx.compose.runtime.collectAsState
import at.mocode.clients.shared.navigation.AppScreen
import at.mocode.clients.authfeature.AuthTokenManager
import at.mocode.clients.pingfeature.PingScreen
import at.mocode.ping.feature.presentation.PingViewModel
import at.mocode.clients.pingfeature.PingViewModel
import at.mocode.shared.core.AppConstants
import androidx.compose.material3.OutlinedTextField
import androidx.compose.ui.text.input.PasswordVisualTransformation
@@ -9,7 +9,8 @@ import at.mocode.frontend.core.localdb.localDbModule
import at.mocode.frontend.core.localdb.DatabaseProvider
import at.mocode.frontend.core.localdb.AppDatabase
import at.mocode.frontend.core.sync.di.syncModule
import at.mocode.ping.feature.di.pingFeatureModule
import at.mocode.clients.pingfeature.di.pingFeatureModule
import at.mocode.ping.feature.di.pingSyncFeatureModule
import navigation.navigationModule
import kotlinx.coroutines.MainScope
import kotlinx.coroutines.launch
@@ -30,7 +31,7 @@ fun main() {
console.log("[WebApp] main() entered")
// Initialize DI (Koin) with shared modules + network + local DB modules
try {
initKoin { modules(networkModule, localDbModule, syncModule, pingFeatureModule, authFeatureModule, navigationModule) }
initKoin { modules(networkModule, localDbModule, syncModule, pingFeatureModule, pingSyncFeatureModule, authFeatureModule, navigationModule) }
console.log("[WebApp] Koin initialized with networkModule + localDbModule + authFeatureModule + navigationModule")
} catch (e: dynamic) {
console.warn("[WebApp] Koin initialization warning:", e)
@@ -6,7 +6,8 @@ import at.mocode.shared.di.initKoin
import at.mocode.frontend.core.network.networkModule
import at.mocode.clients.authfeature.di.authFeatureModule
import at.mocode.frontend.core.sync.di.syncModule
import at.mocode.ping.feature.di.pingFeatureModule
import at.mocode.clients.pingfeature.di.pingFeatureModule
import at.mocode.ping.feature.di.pingSyncFeatureModule
import at.mocode.frontend.core.localdb.AppDatabase
import at.mocode.frontend.core.localdb.DatabaseProvider
import navigation.navigationModule
@@ -17,7 +18,7 @@ import org.koin.dsl.module
fun main() = application {
// Initialize DI (Koin) with shared modules + network module
try {
initKoin { modules(networkModule, syncModule, pingFeatureModule, authFeatureModule, navigationModule) }
initKoin { modules(networkModule, syncModule, pingFeatureModule, pingSyncFeatureModule, authFeatureModule, navigationModule) }
println("[DesktopApp] Koin initialized with networkModule + authFeatureModule + navigationModule")
} catch (e: Exception) {
println("[DesktopApp] Koin initialization warning: ${e.message}")