Automatic Lint

This commit is contained in:
Syer10
2023-01-16 17:56:06 +00:00
parent de99675969
commit ea791a8bf6
3 changed files with 14 additions and 10 deletions

View File

@@ -31,7 +31,7 @@ import org.lighthousegames.logging.logging
class SourcePager @Inject constructor( class SourcePager @Inject constructor(
private val getManga: GetManga, private val getManga: GetManga,
private val serverListeners: ServerListeners, private val serverListeners: ServerListeners,
private val fetcher: suspend (page: Int) -> MangaPage?, private val fetcher: suspend (page: Int) -> MangaPage?
) : CoroutineScope by CoroutineScope(Dispatchers.Default + SupervisorJob()) { ) : CoroutineScope by CoroutineScope(Dispatchers.Default + SupervisorJob()) {
private val sourceMutex = Mutex() private val sourceMutex = Mutex()
@@ -83,4 +83,4 @@ class SourcePager @Inject constructor(
companion object { companion object {
private val log = logging() private val log = logging()
} }
} }

View File

@@ -107,15 +107,19 @@ class ReaderMenuViewModel @Inject constructor(
?: flowOf(null) ?: flowOf(null)
combine(previousChapterPages, chapterPages, nextChapterPages, readerModeSettings.continuous) { prev, cur, next, cont -> combine(previousChapterPages, chapterPages, nextChapterPages, readerModeSettings.continuous) { prev, cur, next, cont ->
if (cont) { if (cont) {
(prev.orEmpty() + (
prev.orEmpty() +
ReaderPageSeparator(it.prevChapter, it.currChapter) + ReaderPageSeparator(it.prevChapter, it.currChapter) +
cur.orEmpty() + cur.orEmpty() +
ReaderPageSeparator(it.currChapter, it.nextChapter) + ReaderPageSeparator(it.currChapter, it.nextChapter) +
next.orEmpty()).toImmutableList() next.orEmpty()
).toImmutableList()
} else { } else {
(listOf(ReaderPageSeparator(it.prevChapter, it.currChapter)) + (
listOf(ReaderPageSeparator(it.prevChapter, it.currChapter)) +
cur.orEmpty() + cur.orEmpty() +
ReaderPageSeparator(it.currChapter, it.nextChapter)).toImmutableList() ReaderPageSeparator(it.currChapter, it.nextChapter)
).toImmutableList()
} }
} }
}.stateIn(scope, SharingStarted.Eagerly, persistentListOf()) }.stateIn(scope, SharingStarted.Eagerly, persistentListOf())
@@ -377,7 +381,6 @@ class ReaderMenuViewModel @Inject constructor(
} }
.launchIn(chapter.scope) .launchIn(chapter.scope)
} }
} }
private suspend fun getReaderChapter(chapterIndex: Int): ReaderChapter? { private suspend fun getReaderChapter(chapterIndex: Int): ReaderChapter? {

View File

@@ -89,7 +89,6 @@ class SourceScreenViewModel(
val hasNextPage = pager.flatMapLatest { it.hasNextPage } val hasNextPage = pager.flatMapLatest { it.hasNextPage }
.stateIn(scope, SharingStarted.Eagerly, true) .stateIn(scope, SharingStarted.Eagerly, true)
init { init {
pager.value.loadNextPage() pager.value.loadNextPage()
} }
@@ -123,7 +122,8 @@ class SourceScreenViewModel(
getLatestManga.await( getLatestManga.await(
source, source,
page, page,
onError = { toast(it.message.orEmpty()) }) onError = { toast(it.message.orEmpty()) }
)
} }
} }
else -> { else -> {
@@ -131,7 +131,8 @@ class SourceScreenViewModel(
getPopularManga.await( getPopularManga.await(
source.id, source.id,
page, page,
onError = { toast(it.message.orEmpty()) }) onError = { toast(it.message.orEmpty()) }
)
} }
} }
} }