From ea791a8bf6915c9acdbb53bcbcd2bd1e5054a632 Mon Sep 17 00:00:00 2001 From: Syer10 Date: Mon, 16 Jan 2023 17:56:06 +0000 Subject: [PATCH] Automatic Lint --- .../jui/domain/source/interactor/SourcePager.kt | 4 ++-- .../ca/gosyer/jui/ui/reader/ReaderMenuViewModel.kt | 13 ++++++++----- .../jui/ui/sources/browse/SourceScreenViewModel.kt | 7 ++++--- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/interactor/SourcePager.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/interactor/SourcePager.kt index 613d0a25..4204ad69 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/interactor/SourcePager.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/interactor/SourcePager.kt @@ -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() @@ -83,4 +83,4 @@ class SourcePager @Inject constructor( companion object { private val log = logging() } -} \ No newline at end of file +} diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/ReaderMenuViewModel.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/ReaderMenuViewModel.kt index 680cd151..649833d2 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/ReaderMenuViewModel.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/ReaderMenuViewModel.kt @@ -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? { diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/browse/SourceScreenViewModel.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/browse/SourceScreenViewModel.kt index 9a5a02ef..7bee5f4a 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/browse/SourceScreenViewModel.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/browse/SourceScreenViewModel.kt @@ -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()) } + ) } } }