From 12810ce82d6324a79e3280742a7ab6568b5454ee Mon Sep 17 00:00:00 2001 From: Stefan Mogeritsch Date: Mon, 19 Jan 2026 16:12:13 +0100 Subject: [PATCH] refactor(ping-feature): clean up imports, simplify UI state handling, and remove redundant variables Simplified imports for better readability, addressed unnecessary null check for `uiState.errorMessage`, and removed an unused `CoroutineScope` variable in `MainApp`. Improved code clarity and maintainability. --- .../mocode/ping/feature/presentation/PingScreen.kt | 2 +- .../feature/integration/PingSyncIntegrationTest.kt | 14 +++++--------- .../src/commonMain/kotlin/MainApp.kt | 2 +- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/frontend/features/ping-feature/src/commonMain/kotlin/at/mocode/ping/feature/presentation/PingScreen.kt b/frontend/features/ping-feature/src/commonMain/kotlin/at/mocode/ping/feature/presentation/PingScreen.kt index 7e817581..78eb20dd 100644 --- a/frontend/features/ping-feature/src/commonMain/kotlin/at/mocode/ping/feature/presentation/PingScreen.kt +++ b/frontend/features/ping-feature/src/commonMain/kotlin/at/mocode/ping/feature/presentation/PingScreen.kt @@ -48,7 +48,7 @@ fun PingScreen(viewModel: PingViewModel) { style = MaterialTheme.typography.titleMedium, color = MaterialTheme.colorScheme.error ) - Text(text = uiState.errorMessage ?: "") + Text(text = uiState.errorMessage) Button(onClick = { viewModel.clearError() }) { Text("Clear") } diff --git a/frontend/features/ping-feature/src/commonTest/kotlin/at/mocode/ping/feature/integration/PingSyncIntegrationTest.kt b/frontend/features/ping-feature/src/commonTest/kotlin/at/mocode/ping/feature/integration/PingSyncIntegrationTest.kt index c3bcea38..fd9a7026 100644 --- a/frontend/features/ping-feature/src/commonTest/kotlin/at/mocode/ping/feature/integration/PingSyncIntegrationTest.kt +++ b/frontend/features/ping-feature/src/commonTest/kotlin/at/mocode/ping/feature/integration/PingSyncIntegrationTest.kt @@ -1,17 +1,13 @@ package at.mocode.ping.feature.integration import at.mocode.frontend.core.sync.SyncManager -import at.mocode.ping.api.PingEvent import at.mocode.ping.feature.domain.PingSyncServiceImpl import at.mocode.ping.feature.test.FakePingEventRepository -import io.ktor.client.HttpClient -import io.ktor.client.engine.mock.MockEngine -import io.ktor.client.engine.mock.respond -import io.ktor.client.plugins.contentnegotiation.ContentNegotiation -import io.ktor.http.HttpHeaders -import io.ktor.http.HttpStatusCode -import io.ktor.http.headersOf -import io.ktor.serialization.kotlinx.json.json +import io.ktor.client.* +import io.ktor.client.engine.mock.* +import io.ktor.client.plugins.contentnegotiation.* +import io.ktor.http.* +import io.ktor.serialization.kotlinx.json.* import kotlinx.coroutines.test.runTest import kotlinx.serialization.json.Json import kotlin.test.Test diff --git a/frontend/shells/meldestelle-portal/src/commonMain/kotlin/MainApp.kt b/frontend/shells/meldestelle-portal/src/commonMain/kotlin/MainApp.kt index 26ae636c..fc25a4ed 100644 --- a/frontend/shells/meldestelle-portal/src/commonMain/kotlin/MainApp.kt +++ b/frontend/shells/meldestelle-portal/src/commonMain/kotlin/MainApp.kt @@ -36,7 +36,7 @@ fun MainApp() { val authApiClient = koinInject() // Delta-Sync blueprint: resolve the Ping feature view model via Koin. val pingViewModel: PingViewModel = koinViewModel() - val scope = rememberCoroutineScope() + rememberCoroutineScope() // Handle PKCE callback on an app load (web) LaunchedEffect(Unit) {