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.
This commit is contained in:
2026-01-19 16:12:13 +01:00
parent 181a34c3eb
commit 12810ce82d
3 changed files with 7 additions and 11 deletions
@@ -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")
}
@@ -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
@@ -36,7 +36,7 @@ fun MainApp() {
val authApiClient = koinInject<AuthApiClient>()
// 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) {