mirror of
https://github.com/Suwayomi/TachideskJUI.git
synced 2026-01-06 03:42:33 +01:00
Fix crash in about menu when server info fails
This commit is contained in:
@@ -18,6 +18,7 @@ import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.flow.SharingStarted
|
||||
import kotlinx.coroutines.flow.asSharedFlow
|
||||
import kotlinx.coroutines.flow.asStateFlow
|
||||
import kotlinx.coroutines.flow.catch
|
||||
import kotlinx.coroutines.flow.filterIsInstance
|
||||
import kotlinx.coroutines.flow.launchIn
|
||||
import kotlinx.coroutines.flow.map
|
||||
@@ -25,6 +26,7 @@ import kotlinx.coroutines.flow.onEach
|
||||
import kotlinx.coroutines.flow.stateIn
|
||||
import kotlinx.datetime.Instant
|
||||
import me.tatarka.inject.annotations.Inject
|
||||
import org.lighthousegames.logging.logging
|
||||
|
||||
class AboutViewModel @Inject constructor(
|
||||
private val dateHandler: DateHandler,
|
||||
@@ -53,6 +55,9 @@ class AboutViewModel @Inject constructor(
|
||||
.onEach {
|
||||
_about.value = it
|
||||
}
|
||||
.catch {
|
||||
log.warn(it) { "Error getting server info" }
|
||||
}
|
||||
.launchIn(scope)
|
||||
}
|
||||
|
||||
@@ -68,4 +73,8 @@ class AboutViewModel @Inject constructor(
|
||||
private fun getFormattedDate(time: Instant): String {
|
||||
return dateHandler.dateTimeFormat(time)
|
||||
}
|
||||
|
||||
companion object {
|
||||
private val log = logging()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user