Fix crash: add error handling for scrobbling info

This commit is contained in:
Koitharu
2025-09-26 08:55:00 +03:00
parent 5a14412b62
commit 5f51041220
2 changed files with 2 additions and 2 deletions

View File

@@ -140,6 +140,7 @@ class DetailsViewModel @Inject constructor(
get() = scrobblers.any { it.isEnabled }
val scrobblingInfo: StateFlow<List<ScrobblingInfo>> = interactor.observeScrobblingInfo(mangaId)
.withErrorHandling()
.stateIn(viewModelScope + Dispatchers.Default, SharingStarted.Eagerly, emptyList())
val relatedManga: StateFlow<List<MangaListModel>> = manga.mapLatest {

View File

@@ -7,7 +7,6 @@ import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.SharingStarted
import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.onEach
@@ -47,7 +46,7 @@ class ScrobblerConfigViewModel @Inject constructor(
val content = scrobbler.observeAllScrobblingInfo()
.onStart { loadingCounter.increment() }
.onFirst { loadingCounter.decrement() }
.catch { errorEvent.call(it) }
.withErrorHandling()
.map { buildContentList(it) }
.stateIn(viewModelScope + Dispatchers.Default, SharingStarted.Eagerly, emptyList())