Allow user to retry loading the page list in the reader

This commit is contained in:
Syer10
2021-06-07 13:56:53 -04:00
parent 5975a9eae8
commit 8db803892d
2 changed files with 7 additions and 2 deletions

View File

@@ -200,7 +200,8 @@ fun ReaderMenu(chapterIndex: Int, mangaId: Long, setHotkeys: (List<KeyboardShort
} else {
LoadingScreen(
state is ReaderChapter.State.Wait || state is ReaderChapter.State.Loading,
errorMessage = (state as? ReaderChapter.State.Error)?.error?.message
errorMessage = (state as? ReaderChapter.State.Error)?.error?.message,
retry = vm::init
)
}
}

View File

@@ -30,7 +30,7 @@ import kotlinx.coroutines.launch
import javax.inject.Inject
class ReaderMenuViewModel @Inject constructor(
params: Params,
private val params: Params,
private val readerPreferences: ReaderPreferences,
private val chapterHandler: ChapterInteractionHandler
) : ViewModel() {
@@ -60,6 +60,10 @@ class ReaderMenuViewModel @Inject constructor(
private val loader = ChapterLoader(scope.coroutineContext, readerPreferences, chapterHandler)
init {
init()
}
fun init() {
scope.launch(Dispatchers.Default) {
init(params.mangaId, params.chapterIndex)
}