Add errors to browse + latest

This commit is contained in:
Jobobby04 2021-02-26 20:10:36 -05:00
parent 1827fe0ce1
commit fa2cde79ba
2 changed files with 19 additions and 0 deletions

View File

@ -326,6 +326,18 @@ open class IndexController :
browseAdapter?.updateDataSet(browseResults)
}
fun onLatestError(e: Exception) {
e.message?.let {
binding.latestNoResultsFound.text = it
}
}
fun onBrowseError(e: Exception) {
e.message?.let {
binding.browseNoResultsFound.text = it
}
}
private fun showLatestResultsHolder() {
binding.latestNoResultsFound.isVisible = false
}

View File

@ -15,6 +15,7 @@ import eu.kanade.tachiyomi.ui.base.presenter.BasePresenter
import eu.kanade.tachiyomi.ui.browse.source.browse.BrowseSourcePresenter.Companion.toItems
import eu.kanade.tachiyomi.util.lang.awaitSingle
import eu.kanade.tachiyomi.util.lang.runAsObservable
import eu.kanade.tachiyomi.util.lang.withUIContext
import exh.savedsearches.EXHSavedSearch
import exh.savedsearches.JsonSavedSearch
import kotlinx.coroutines.Dispatchers
@ -110,6 +111,9 @@ open class IndexPresenter(
.mangas
.map { networkToLocalManga(it, source.id) }
} catch (e: Exception) {
withUIContext {
view?.onLatestError(e)
}
emptyList()
}
} else emptyList()
@ -127,6 +131,9 @@ open class IndexPresenter(
.mangas
.map { networkToLocalManga(it, source.id) }
} catch (e: Exception) {
withUIContext {
view?.onBrowseError(e)
}
emptyList()
}