refactor(core, veranstaltung): Exception-Handling vereinfacht und Delay-Angabe optimiert
Signed-off-by: Stefan Mogeritsch <stefan.mo.co@gmail.com>
This commit is contained in:
+3
-2
@@ -9,6 +9,7 @@ import kotlinx.coroutines.flow.asStateFlow
|
||||
import org.koin.core.component.KoinComponent
|
||||
import org.koin.core.component.inject
|
||||
import org.koin.core.qualifier.named
|
||||
import kotlin.time.Duration.Companion.milliseconds
|
||||
|
||||
/**
|
||||
* Überwacht die Konnektivität zum API-Gateway.
|
||||
@@ -28,7 +29,7 @@ class ConnectivityTracker : KoinComponent {
|
||||
scope.launch {
|
||||
while (isActive) {
|
||||
_isOnline.value = checkConnection()
|
||||
delay(10_000) // Alle 10 Sekunden prüfen
|
||||
delay(10_000.milliseconds) // Alle 10 Sekunden prüfen
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -37,7 +38,7 @@ class ConnectivityTracker : KoinComponent {
|
||||
return try {
|
||||
val response = client.get(NetworkConfig.baseUrl.trimEnd('/') + "/api/ping/health")
|
||||
response.status.value in 200..299
|
||||
} catch (e: Exception) {
|
||||
} catch (_: Exception) {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
+10
-9
@@ -29,6 +29,7 @@ import java.time.ZoneId
|
||||
import java.time.format.DateTimeFormatter
|
||||
import javax.swing.JFileChooser
|
||||
import javax.swing.filechooser.FileNameExtensionFilter
|
||||
import kotlin.time.Duration.Companion.milliseconds
|
||||
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
@@ -541,12 +542,12 @@ fun VeranstaltungKonfigV2(
|
||||
|
||||
val dateVon = try {
|
||||
LocalDate.parse(von, dateFormatter)
|
||||
} catch (e: Exception) {
|
||||
} catch (_: Exception) {
|
||||
null
|
||||
}
|
||||
val dateBis = try {
|
||||
LocalDate.parse(bis, dateFormatter)
|
||||
} catch (e: Exception) {
|
||||
} catch (_: Exception) {
|
||||
null
|
||||
}
|
||||
val today = LocalDate.now()
|
||||
@@ -728,12 +729,12 @@ fun VeranstaltungKonfigV2(
|
||||
2 -> {
|
||||
val dVon = try {
|
||||
LocalDate.parse(von, dateFormatter)
|
||||
} catch (e: Exception) {
|
||||
} catch (_: Exception) {
|
||||
null
|
||||
}
|
||||
val dBis = try {
|
||||
LocalDate.parse(bis, dateFormatter)
|
||||
} catch (e: Exception) {
|
||||
} catch (_: Exception) {
|
||||
null
|
||||
}
|
||||
val today2 = LocalDate.now()
|
||||
@@ -1086,12 +1087,12 @@ fun TurnierWizardV2(
|
||||
val vBis = veranstaltung?.datumBis?.let { LocalDate.parse(it) }
|
||||
val tVon = try {
|
||||
LocalDate.parse(von)
|
||||
} catch (e: Exception) {
|
||||
} catch (_: Exception) {
|
||||
null
|
||||
}
|
||||
val tBis = if (bis.isBlank()) tVon else try {
|
||||
LocalDate.parse(bis)
|
||||
} catch (e: Exception) {
|
||||
} catch (_: Exception) {
|
||||
null
|
||||
}
|
||||
|
||||
@@ -1267,7 +1268,7 @@ private fun Step1Basics(
|
||||
CircularProgressIndicator()
|
||||
|
||||
LaunchedEffect(Unit) {
|
||||
kotlinx.coroutines.delay(2000)
|
||||
kotlinx.coroutines.delay(2000.milliseconds)
|
||||
onZnsDataLoadedChange(true)
|
||||
showImportProgress = false
|
||||
}
|
||||
@@ -1295,12 +1296,12 @@ private fun Step2Sparten(
|
||||
val vBis = veranstaltung?.datumBis?.let { LocalDate.parse(it) }
|
||||
val tVon = try {
|
||||
LocalDate.parse(von)
|
||||
} catch (e: Exception) {
|
||||
} catch (_: Exception) {
|
||||
null
|
||||
}
|
||||
val tBis = if (bis.isBlank()) tVon else try {
|
||||
LocalDate.parse(bis)
|
||||
} catch (e: Exception) {
|
||||
} catch (_: Exception) {
|
||||
null
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user