mirror of
https://github.com/Suwayomi/TachideskJUI.git
synced 2025-12-10 06:42:05 +01:00
Automatic Lint
This commit is contained in:
@@ -31,7 +31,7 @@ import org.lighthousegames.logging.logging
|
||||
class SourcePager @Inject constructor(
|
||||
private val getManga: GetManga,
|
||||
private val serverListeners: ServerListeners,
|
||||
private val fetcher: suspend (page: Int) -> MangaPage?,
|
||||
private val fetcher: suspend (page: Int) -> MangaPage?
|
||||
) : CoroutineScope by CoroutineScope(Dispatchers.Default + SupervisorJob()) {
|
||||
private val sourceMutex = Mutex()
|
||||
|
||||
|
||||
@@ -107,15 +107,19 @@ class ReaderMenuViewModel @Inject constructor(
|
||||
?: flowOf(null)
|
||||
combine(previousChapterPages, chapterPages, nextChapterPages, readerModeSettings.continuous) { prev, cur, next, cont ->
|
||||
if (cont) {
|
||||
(prev.orEmpty() +
|
||||
(
|
||||
prev.orEmpty() +
|
||||
ReaderPageSeparator(it.prevChapter, it.currChapter) +
|
||||
cur.orEmpty() +
|
||||
ReaderPageSeparator(it.currChapter, it.nextChapter) +
|
||||
next.orEmpty()).toImmutableList()
|
||||
next.orEmpty()
|
||||
).toImmutableList()
|
||||
} else {
|
||||
(listOf(ReaderPageSeparator(it.prevChapter, it.currChapter)) +
|
||||
(
|
||||
listOf(ReaderPageSeparator(it.prevChapter, it.currChapter)) +
|
||||
cur.orEmpty() +
|
||||
ReaderPageSeparator(it.currChapter, it.nextChapter)).toImmutableList()
|
||||
ReaderPageSeparator(it.currChapter, it.nextChapter)
|
||||
).toImmutableList()
|
||||
}
|
||||
}
|
||||
}.stateIn(scope, SharingStarted.Eagerly, persistentListOf())
|
||||
@@ -377,7 +381,6 @@ class ReaderMenuViewModel @Inject constructor(
|
||||
}
|
||||
.launchIn(chapter.scope)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private suspend fun getReaderChapter(chapterIndex: Int): ReaderChapter? {
|
||||
|
||||
@@ -89,7 +89,6 @@ class SourceScreenViewModel(
|
||||
val hasNextPage = pager.flatMapLatest { it.hasNextPage }
|
||||
.stateIn(scope, SharingStarted.Eagerly, true)
|
||||
|
||||
|
||||
init {
|
||||
pager.value.loadNextPage()
|
||||
}
|
||||
@@ -123,7 +122,8 @@ class SourceScreenViewModel(
|
||||
getLatestManga.await(
|
||||
source,
|
||||
page,
|
||||
onError = { toast(it.message.orEmpty()) })
|
||||
onError = { toast(it.message.orEmpty()) }
|
||||
)
|
||||
}
|
||||
}
|
||||
else -> {
|
||||
@@ -131,7 +131,8 @@ class SourceScreenViewModel(
|
||||
getPopularManga.await(
|
||||
source.id,
|
||||
page,
|
||||
onError = { toast(it.message.orEmpty()) })
|
||||
onError = { toast(it.message.orEmpty()) }
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user