Fix feed not outputting errors

This commit is contained in:
Jobobby04 2022-11-30 14:18:26 -05:00
parent 07f0e73d6c
commit 6185c95715

View File

@ -32,6 +32,7 @@ import exh.savedsearches.models.FeedSavedSearch
import exh.savedsearches.models.SavedSearch import exh.savedsearches.models.SavedSearch
import kotlinx.coroutines.asCoroutineDispatcher import kotlinx.coroutines.asCoroutineDispatcher
import kotlinx.coroutines.channels.Channel import kotlinx.coroutines.channels.Channel
import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.flow.collectLatest import kotlinx.coroutines.flow.collectLatest
import kotlinx.coroutines.flow.distinctUntilChanged import kotlinx.coroutines.flow.distinctUntilChanged
import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.launchIn
@ -90,12 +91,14 @@ open class FeedScreenModel(
} }
getFeed(items) getFeed(items)
} }
.catch { _events.send(Event.FailedFetchingSources) }
.launchIn(coroutineScope) .launchIn(coroutineScope)
} }
fun openAddDialog() { fun openAddDialog() {
coroutineScope.launchIO { coroutineScope.launchIO {
if (hasTooManyFeeds()) { if (hasTooManyFeeds()) {
_events.send(Event.TooManyFeeds)
return@launchIO return@launchIO
} }
mutableState.update { state -> mutableState.update { state ->