From 12c4bfdfa41fa88ff17c509fc30400ab6087c3df Mon Sep 17 00:00:00 2001 From: Syer10 Date: Sun, 25 Sep 2022 23:15:07 +0000 Subject: [PATCH] Automatic Lint --- .../kotlin/ca/gosyer/jui/core/lang/String.kt | 3 +-- .../gosyer/jui/data/FlowIORequestConverter.kt | 2 +- .../kotlin/ca/gosyer/jui/domain/Ktorfit.kt | 2 +- .../interactor/UpdateChapterBookmarked.kt | 18 +++++++++--------- .../interactor/UpdateChapterLastPageRead.kt | 18 +++++++++--------- .../UpdateChapterMarkPreviousRead.kt | 10 +++++----- .../chapter/interactor/UpdateChapterRead.kt | 18 +++++++++--------- .../chapter/service/ChapterRepository.kt | 8 ++++---- 8 files changed, 39 insertions(+), 40 deletions(-) diff --git a/core/src/commonMain/kotlin/ca/gosyer/jui/core/lang/String.kt b/core/src/commonMain/kotlin/ca/gosyer/jui/core/lang/String.kt index d23b93bc..4fcd96ef 100644 --- a/core/src/commonMain/kotlin/ca/gosyer/jui/core/lang/String.kt +++ b/core/src/commonMain/kotlin/ca/gosyer/jui/core/lang/String.kt @@ -18,9 +18,8 @@ fun String.chop(count: Int, replacement: String = "…"): String { } } - fun String.addSuffix(char: Char): String { return if (endsWith(char)) { this } else this + char -} \ No newline at end of file +} diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/FlowIORequestConverter.kt b/data/src/commonMain/kotlin/ca/gosyer/jui/data/FlowIORequestConverter.kt index 0bc7f640..3ad94877 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/FlowIORequestConverter.kt +++ b/data/src/commonMain/kotlin/ca/gosyer/jui/data/FlowIORequestConverter.kt @@ -41,4 +41,4 @@ class FlowIORequestConverter : RequestConverter { } }.flowOn(Dispatchers.IO) } -} \ No newline at end of file +} diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/Ktorfit.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/Ktorfit.kt index f029eb49..a0f9bfd8 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/Ktorfit.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/Ktorfit.kt @@ -9,4 +9,4 @@ package ca.gosyer.jui.domain import de.jensklingenberg.ktorfit.Ktorfit import de.jensklingenberg.ktorfit.create -inline fun Ktorfit.createIt(): T = create() \ No newline at end of file +inline fun Ktorfit.createIt(): T = create() diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/interactor/UpdateChapterBookmarked.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/interactor/UpdateChapterBookmarked.kt index 1774e9ee..f3a4c78e 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/interactor/UpdateChapterBookmarked.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/interactor/UpdateChapterBookmarked.kt @@ -19,7 +19,7 @@ class UpdateChapterBookmarked @Inject constructor(private val chapterRepository: suspend fun await( mangaId: Long, index: Int, - bookmarked: Boolean, + bookmarked: Boolean ) = asFlow(mangaId, index, bookmarked) .catch { log.warn(it) { "Failed to update chapter bookmark for chapter $index of $mangaId" } } .collect() @@ -27,14 +27,14 @@ class UpdateChapterBookmarked @Inject constructor(private val chapterRepository: suspend fun await( manga: Manga, index: Int, - bookmarked: Boolean, + bookmarked: Boolean ) = asFlow(manga, index, bookmarked) .catch { log.warn(it) { "Failed to update chapter bookmark for chapter $index of ${manga.title}(${manga.id})" } } .collect() suspend fun await( chapter: Chapter, - bookmarked: Boolean, + bookmarked: Boolean ) = asFlow(chapter, bookmarked) .catch { log.warn(it) { "Failed to update chapter bookmark for chapter ${chapter.index} of ${chapter.mangaId}" } } .collect() @@ -42,30 +42,30 @@ class UpdateChapterBookmarked @Inject constructor(private val chapterRepository: fun asFlow( mangaId: Long, index: Int, - bookmarked: Boolean, + bookmarked: Boolean ) = chapterRepository.updateChapterBookmarked( mangaId = mangaId, chapterIndex = index, - bookmarked = bookmarked, + bookmarked = bookmarked ) fun asFlow( manga: Manga, index: Int, - bookmarked: Boolean, + bookmarked: Boolean ) = chapterRepository.updateChapterBookmarked( mangaId = manga.id, chapterIndex = index, - bookmarked = bookmarked, + bookmarked = bookmarked ) fun asFlow( chapter: Chapter, - bookmarked: Boolean, + bookmarked: Boolean ) = chapterRepository.updateChapterBookmarked( mangaId = chapter.mangaId, chapterIndex = chapter.index, - bookmarked = bookmarked, + bookmarked = bookmarked ) companion object { diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/interactor/UpdateChapterLastPageRead.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/interactor/UpdateChapterLastPageRead.kt index 1c753341..4e5ed681 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/interactor/UpdateChapterLastPageRead.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/interactor/UpdateChapterLastPageRead.kt @@ -19,7 +19,7 @@ class UpdateChapterLastPageRead @Inject constructor(private val chapterRepositor suspend fun await( mangaId: Long, index: Int, - lastPageRead: Int, + lastPageRead: Int ) = asFlow(mangaId, index, lastPageRead) .catch { log.warn(it) { "Failed to update chapter last page read for chapter $index of $mangaId" } } .collect() @@ -27,14 +27,14 @@ class UpdateChapterLastPageRead @Inject constructor(private val chapterRepositor suspend fun await( manga: Manga, index: Int, - lastPageRead: Int, + lastPageRead: Int ) = asFlow(manga, index, lastPageRead) .catch { log.warn(it) { "Failed to update chapter last page read for chapter $index of ${manga.title}(${manga.id})" } } .collect() suspend fun await( chapter: Chapter, - lastPageRead: Int, + lastPageRead: Int ) = asFlow(chapter, lastPageRead) .catch { log.warn(it) { "Failed to update chapter last page read for chapter ${chapter.index} of ${chapter.mangaId}" } } .collect() @@ -42,30 +42,30 @@ class UpdateChapterLastPageRead @Inject constructor(private val chapterRepositor fun asFlow( mangaId: Long, index: Int, - lastPageRead: Int, + lastPageRead: Int ) = chapterRepository.updateChapterLastPageRead( mangaId = mangaId, chapterIndex = index, - lastPageRead = lastPageRead, + lastPageRead = lastPageRead ) fun asFlow( manga: Manga, index: Int, - lastPageRead: Int, + lastPageRead: Int ) = chapterRepository.updateChapterLastPageRead( mangaId = manga.id, chapterIndex = index, - lastPageRead = lastPageRead, + lastPageRead = lastPageRead ) fun asFlow( chapter: Chapter, - lastPageRead: Int, + lastPageRead: Int ) = chapterRepository.updateChapterLastPageRead( mangaId = chapter.mangaId, chapterIndex = chapter.index, - lastPageRead = lastPageRead, + lastPageRead = lastPageRead ) companion object { diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/interactor/UpdateChapterMarkPreviousRead.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/interactor/UpdateChapterMarkPreviousRead.kt index e5d2e691..83b92ce9 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/interactor/UpdateChapterMarkPreviousRead.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/interactor/UpdateChapterMarkPreviousRead.kt @@ -38,7 +38,7 @@ class UpdateChapterMarkPreviousRead @Inject constructor(private val chapterRepos fun asFlow( mangaId: Long, - index: Int, + index: Int ) = chapterRepository.updateChapterMarkPrevRead( mangaId = mangaId, chapterIndex = index @@ -46,17 +46,17 @@ class UpdateChapterMarkPreviousRead @Inject constructor(private val chapterRepos fun asFlow( manga: Manga, - index: Int, + index: Int ) = chapterRepository.updateChapterMarkPrevRead( mangaId = manga.id, - chapterIndex = index, + chapterIndex = index ) fun asFlow( - chapter: Chapter, + chapter: Chapter ) = chapterRepository.updateChapterMarkPrevRead( mangaId = chapter.mangaId, - chapterIndex = chapter.index, + chapterIndex = chapter.index ) companion object { diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/interactor/UpdateChapterRead.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/interactor/UpdateChapterRead.kt index db892149..aa5beb37 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/interactor/UpdateChapterRead.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/interactor/UpdateChapterRead.kt @@ -19,7 +19,7 @@ class UpdateChapterRead @Inject constructor(private val chapterRepository: Chapt suspend fun await( mangaId: Long, index: Int, - read: Boolean, + read: Boolean ) = asFlow(mangaId, index, read) .catch { log.warn(it) { "Failed to update chapter read status for chapter $index of $mangaId" } } .collect() @@ -27,14 +27,14 @@ class UpdateChapterRead @Inject constructor(private val chapterRepository: Chapt suspend fun await( manga: Manga, index: Int, - read: Boolean, + read: Boolean ) = asFlow(manga, index, read) .catch { log.warn(it) { "Failed to update chapter read status for chapter $index of ${manga.title}(${manga.id})" } } .collect() suspend fun await( chapter: Chapter, - read: Boolean, + read: Boolean ) = asFlow(chapter, read) .catch { log.warn(it) { "Failed to update chapter read status for chapter ${chapter.index} of ${chapter.mangaId}" } } .collect() @@ -42,30 +42,30 @@ class UpdateChapterRead @Inject constructor(private val chapterRepository: Chapt fun asFlow( mangaId: Long, index: Int, - read: Boolean, + read: Boolean ) = chapterRepository.updateChapterRead( mangaId = mangaId, chapterIndex = index, - read = read, + read = read ) fun asFlow( manga: Manga, index: Int, - read: Boolean, + read: Boolean ) = chapterRepository.updateChapterRead( mangaId = manga.id, chapterIndex = index, - read = read, + read = read ) fun asFlow( chapter: Chapter, - read: Boolean, + read: Boolean ) = chapterRepository.updateChapterRead( mangaId = chapter.mangaId, chapterIndex = chapter.index, - read = read, + read = read ) companion object { diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/service/ChapterRepository.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/service/ChapterRepository.kt index 92a8e038..8d210527 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/service/ChapterRepository.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/service/ChapterRepository.kt @@ -45,13 +45,13 @@ interface ChapterRepository { @Field("markPrevRead") markPreviousRead: Boolean? = null ): Flow*/ - //todo remove following updateChapter functions once ktorfit supports nullable parameters + // todo remove following updateChapter functions once ktorfit supports nullable parameters @FormUrlEncoded @PATCH("api/v1/manga/{mangaId}/chapter/{chapterIndex}") fun updateChapterRead( @Path("mangaId") mangaId: Long, @Path("chapterIndex") chapterIndex: Int, - @Field("read") read: Boolean, + @Field("read") read: Boolean ): Flow @FormUrlEncoded @@ -59,7 +59,7 @@ interface ChapterRepository { fun updateChapterBookmarked( @Path("mangaId") mangaId: Long, @Path("chapterIndex") chapterIndex: Int, - @Field("bookmarked") bookmarked: Boolean, + @Field("bookmarked") bookmarked: Boolean ): Flow @FormUrlEncoded @@ -67,7 +67,7 @@ interface ChapterRepository { fun updateChapterLastPageRead( @Path("mangaId") mangaId: Long, @Path("chapterIndex") chapterIndex: Int, - @Field("lastPageRead") lastPageRead: Int, + @Field("lastPageRead") lastPageRead: Int ): Flow @FormUrlEncoded