From a7cc5e664b8fd298aa08ad83749f062abbe5e50d Mon Sep 17 00:00:00 2001 From: Syer10 Date: Fri, 3 Oct 2025 21:04:05 -0400 Subject: [PATCH] Lint --- .../gosyer/jui/core/io/IosOkioExtensions.kt | 10 +- .../ca/gosyer/jui/data/SharedDataComponent.kt | 3 +- .../jui/data/backup/BackupRepositoryImpl.kt | 66 +++++----- .../data/category/CategoryRepositoryImpl.kt | 79 +++++------- .../jui/data/chapter/ChapterRepositoryImpl.kt | 88 ++++++------- .../data/download/DownloadRepositoryImpl.kt | 53 ++++---- .../data/extension/ExtensionRepositoryImpl.kt | 44 +++---- .../jui/data/global/GlobalRepositoryImpl.kt | 21 ++-- .../jui/data/library/LibraryRepositoryImpl.kt | 18 ++- .../jui/data/manga/MangaRepositoryImpl.kt | 45 +++---- .../data/settings/SettingsRepositoryImpl.kt | 10 +- .../jui/data/source/SourceRepositoryImpl.kt | 117 ++++++++++-------- .../jui/data/updates/UpdatesRepositoryImpl.kt | 27 ++-- .../ca/gosyer/jui/data/SharedDataComponent.kt | 4 +- .../ca/gosyer/jui/data/SharedDataComponent.kt | 4 +- .../ca/gosyer/jui/domain/ServerListeners.kt | 10 +- .../backup/interactor/ImportBackupFile.kt | 4 +- .../backup/interactor/ValidateBackupFile.kt | 4 +- .../domain/backup/service/BackupRepository.kt | 3 + .../category/service/CategoryRepository.kt | 17 +-- .../interactor/DeleteChapterDownload.kt | 14 +-- .../domain/chapter/interactor/GetChapter.kt | 11 +- .../chapter/interactor/GetChapterPages.kt | 4 +- .../chapter/interactor/UpdateChapter.kt | 98 +++++++-------- .../chapter/service/ChapterRepository.kt | 24 +--- .../interactor/QueueChapterDownload.kt | 6 +- .../download/service/DownloadRepository.kt | 13 +- .../extension/service/ExtensionRepository.kt | 17 +-- .../library/service/LibraryRepository.kt | 8 +- .../domain/manga/service/MangaRepository.kt | 13 +- .../jui/domain/settings/model/AuthMode.kt | 10 +- .../jui/domain/settings/model/DatabaseType.kt | 7 +- .../model/KoreaderSyncChecksumMethod.kt | 6 +- .../model/KoreaderSyncConflictStrategy.kt | 10 +- .../jui/domain/settings/model/SortOrder.kt | 14 +-- .../domain/source/interactor/GetFilterList.kt | 8 +- .../model/sourcefilters/SourceFilterChange.kt | 22 ++-- .../domain/source/service/SourceRepository.kt | 13 +- .../updates/service/UpdatesRepository.kt | 8 +- .../service/host/ServerHostPreference.kt | 8 +- .../jui/ui/sources/browse/SourceScreen.kt | 3 - 41 files changed, 406 insertions(+), 538 deletions(-) diff --git a/core/src/iosMain/kotlin/ca/gosyer/jui/core/io/IosOkioExtensions.kt b/core/src/iosMain/kotlin/ca/gosyer/jui/core/io/IosOkioExtensions.kt index 242d0830..cfcd2145 100644 --- a/core/src/iosMain/kotlin/ca/gosyer/jui/core/io/IosOkioExtensions.kt +++ b/core/src/iosMain/kotlin/ca/gosyer/jui/core/io/IosOkioExtensions.kt @@ -22,16 +22,16 @@ actual suspend fun ByteReadChannel.toSource(context: CoroutineContext): Source { channel.cancel() } - override fun read(sink: Buffer, byteCount: Long): Long { + override fun read( + sink: Buffer, + byteCount: Long, + ): Long { val buffer = ByteArray(byteCount.toInt()) val read = runBlocking(context) { channel.readAvailable(buffer) } sink.write(buffer.reversedArray()) return read.toLong() } - override fun timeout(): Timeout { - return Timeout() - } + override fun timeout(): Timeout = Timeout() } } - diff --git a/data/src/androidMain/kotlin/ca/gosyer/jui/data/SharedDataComponent.kt b/data/src/androidMain/kotlin/ca/gosyer/jui/data/SharedDataComponent.kt index ee01e816..d544483c 100644 --- a/data/src/androidMain/kotlin/ca/gosyer/jui/data/SharedDataComponent.kt +++ b/data/src/androidMain/kotlin/ca/gosyer/jui/data/SharedDataComponent.kt @@ -1,4 +1,3 @@ package ca.gosyer.jui.data -actual interface SharedDataComponent { -} +actual interface SharedDataComponent diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/backup/BackupRepositoryImpl.kt b/data/src/commonMain/kotlin/ca/gosyer/jui/data/backup/BackupRepositoryImpl.kt index 1770313d..865156e1 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/backup/BackupRepositoryImpl.kt +++ b/data/src/commonMain/kotlin/ca/gosyer/jui/data/backup/BackupRepositoryImpl.kt @@ -28,9 +28,8 @@ class BackupRepositoryImpl( private val http: Http, private val serverUrl: Url, ) : BackupRepository { - - override fun validateBackup(source: Source): Flow { - return apolloClient.query( + override fun validateBackup(source: Source): Flow = + apolloClient.query( ValidateBackupQuery( DefaultUpload.Builder() .content { @@ -38,21 +37,20 @@ class BackupRepositoryImpl( } .fileName("backup.tachibk") .contentType("application/octet-stream") - .build() - ) + .build(), + ), ).toFlow() .map { BackupValidationResult( missingSources = it.dataAssertNoErrors.validateBackup.missingSources.map { source -> "${source.name} (${source.id})" }, - missingTrackers = emptyList() + missingTrackers = emptyList(), ) } - } - override fun restoreBackup(source: Source): Flow> { - return apolloClient.mutation( + override fun restoreBackup(source: Source): Flow> = + apolloClient.mutation( RestoreBackupMutation( DefaultUpload.Builder() .content { @@ -60,8 +58,8 @@ class BackupRepositoryImpl( } .fileName("backup.tachibk") .contentType("application/octet-stream") - .build() - ) + .build(), + ), ).toFlow() .map { val data = it.dataAssertNoErrors @@ -69,54 +67,52 @@ class BackupRepositoryImpl( .restoreStatusFragment .toRestoreStatus() } - } - override fun restoreStatus(id: String): Flow { - return apolloClient.query( - RestoreStatusQuery(id) + override fun restoreStatus(id: String): Flow = + apolloClient.query( + RestoreStatusQuery(id), ).toFlow() .map { val data = it.dataAssertNoErrors data.restoreStatus!!.restoreStatusFragment.toRestoreStatus() } - } override fun createBackup( includeCategories: Boolean, includeChapters: Boolean, block: HttpRequestBuilder.() -> Unit, - ): Flow> { - return apolloClient + ): Flow> = + apolloClient .mutation( - CreateBackupMutation(includeCategories, includeChapters) + CreateBackupMutation(includeCategories, includeChapters), ) .toFlow() .map { val url = it.dataAssertNoErrors.createBackup.url val response = http.get( - Url("$serverUrl${url}") + Url("$serverUrl$url"), ) val fileName = response.headers["content-disposition"]!! .substringAfter("filename=") .trim('"') fileName to response.bodyAsChannel().toSource() } - } companion object { - private fun RestoreStatusFragment.toRestoreStatus() = RestoreStatus( - when (state) { - BackupRestoreState.IDLE -> RestoreState.IDLE - BackupRestoreState.SUCCESS -> RestoreState.SUCCESS - BackupRestoreState.FAILURE -> RestoreState.FAILURE - BackupRestoreState.RESTORING_CATEGORIES -> RestoreState.RESTORING_CATEGORIES - BackupRestoreState.RESTORING_MANGA -> RestoreState.RESTORING_MANGA - BackupRestoreState.RESTORING_META -> RestoreState.RESTORING_META - BackupRestoreState.RESTORING_SETTINGS -> RestoreState.RESTORING_SETTINGS - BackupRestoreState.UNKNOWN__ -> RestoreState.UNKNOWN - }, - mangaProgress, - totalManga, - ) + private fun RestoreStatusFragment.toRestoreStatus() = + RestoreStatus( + when (state) { + BackupRestoreState.IDLE -> RestoreState.IDLE + BackupRestoreState.SUCCESS -> RestoreState.SUCCESS + BackupRestoreState.FAILURE -> RestoreState.FAILURE + BackupRestoreState.RESTORING_CATEGORIES -> RestoreState.RESTORING_CATEGORIES + BackupRestoreState.RESTORING_MANGA -> RestoreState.RESTORING_MANGA + BackupRestoreState.RESTORING_META -> RestoreState.RESTORING_META + BackupRestoreState.RESTORING_SETTINGS -> RestoreState.RESTORING_SETTINGS + BackupRestoreState.UNKNOWN__ -> RestoreState.UNKNOWN + }, + mangaProgress, + totalManga, + ) } } diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/category/CategoryRepositoryImpl.kt b/data/src/commonMain/kotlin/ca/gosyer/jui/data/category/CategoryRepositoryImpl.kt index be5c5003..6ad03b50 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/category/CategoryRepositoryImpl.kt +++ b/data/src/commonMain/kotlin/ca/gosyer/jui/data/category/CategoryRepositoryImpl.kt @@ -32,142 +32,131 @@ class CategoryRepositoryImpl( private val apolloClient: ApolloClient, private val http: Http, private val serverUrl: Url, -): CategoryRepository { - override fun getMangaCategories(mangaId: Long): Flow> { - return apolloClient.query( - GetMangaCategoriesQuery(mangaId.toInt()) +) : CategoryRepository { + override fun getMangaCategories(mangaId: Long): Flow> = + apolloClient.query( + GetMangaCategoriesQuery(mangaId.toInt()), ) .toFlow() .map { val data = it.dataAssertNoErrors data.manga.categories.nodes.map { it.categoryFragment.toCategory() } } - } override fun addMangaToCategory( mangaId: Long, categoryId: Long, - ): Flow { - return apolloClient.mutation( - AddMangaToCategoriesMutation(mangaId.toInt(), listOf(categoryId.toInt())) + ): Flow = + apolloClient.mutation( + AddMangaToCategoriesMutation(mangaId.toInt(), listOf(categoryId.toInt())), ) .toFlow() .map { val data = it.dataAssertNoErrors data.updateMangaCategories!!.clientMutationId } - } override fun removeMangaFromCategory( mangaId: Long, categoryId: Long, - ): Flow { - return apolloClient.mutation( - RemoveMangaFromCategoriesMutation(mangaId.toInt(), listOf(categoryId.toInt())) + ): Flow = + apolloClient.mutation( + RemoveMangaFromCategoriesMutation(mangaId.toInt(), listOf(categoryId.toInt())), ) .toFlow() .map { val data = it.dataAssertNoErrors data.updateMangaCategories!!.clientMutationId } - } - override fun getCategories(): Flow> { - return apolloClient.query( - GetCategoriesQuery() + override fun getCategories(): Flow> = + apolloClient.query( + GetCategoriesQuery(), ) .toFlow() .map { val data = it.dataAssertNoErrors data.categories.nodes.map { it.categoryFragment.toCategory() } } - } - override fun createCategory(name: String): Flow { - return apolloClient.mutation( - CreateCategoryMutation(name) + override fun createCategory(name: String): Flow = + apolloClient.mutation( + CreateCategoryMutation(name), ) .toFlow() .map { val data = it.dataAssertNoErrors data.createCategory!!.clientMutationId } - } override fun modifyCategory( categoryId: Long, name: String, - ): Flow { - return apolloClient.mutation( - ModifyCategoryMutation(categoryId.toInt(), name) + ): Flow = + apolloClient.mutation( + ModifyCategoryMutation(categoryId.toInt(), name), ) .toFlow() .map { val data = it.dataAssertNoErrors data.updateCategory!!.clientMutationId } - } override fun reorderCategory( categoryId: Long, position: Int, - ): Flow { - return apolloClient.mutation( - ReorderCategoryMutation(categoryId.toInt(), position) + ): Flow = + apolloClient.mutation( + ReorderCategoryMutation(categoryId.toInt(), position), ) .toFlow() .map { val data = it.dataAssertNoErrors data.updateCategoryOrder!!.clientMutationId } - } - override fun deleteCategory(categoryId: Long): Flow { - return apolloClient.mutation( - DeleteCategoryMutation(categoryId.toInt()) + override fun deleteCategory(categoryId: Long): Flow = + apolloClient.mutation( + DeleteCategoryMutation(categoryId.toInt()), ) .toFlow() .map { val data = it.dataAssertNoErrors data.deleteCategory!!.clientMutationId } - } - override fun getMangaFromCategory(categoryId: Long): Flow> { - return apolloClient.query( - GetCategoryMangaQuery(listOf(categoryId.toInt())) + override fun getMangaFromCategory(categoryId: Long): Flow> = + apolloClient.query( + GetCategoryMangaQuery(listOf(categoryId.toInt())), ) .toFlow() .map { val data = it.dataAssertNoErrors data.mangas.nodes.map { it.mangaFragment.toManga() } } - } override fun updateCategoryMeta( categoryId: Long, key: String, value: String, - ): Flow { - return apolloClient.mutation( - SetCategoryMetaMutation(categoryId.toInt(), key, value) + ): Flow = + apolloClient.mutation( + SetCategoryMetaMutation(categoryId.toInt(), key, value), ) .toFlow() .map { val data = it.dataAssertNoErrors data.setCategoryMeta!!.clientMutationId } - } companion object { - internal fun CategoryFragment.toCategory(): Category { - return Category( + internal fun CategoryFragment.toCategory(): Category = + Category( id = id.toLong(), order = order, name = name, default = default, - meta = CategoryMeta() + meta = CategoryMeta(), ) - } } } diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/chapter/ChapterRepositoryImpl.kt b/data/src/commonMain/kotlin/ca/gosyer/jui/data/chapter/ChapterRepositoryImpl.kt index 21edfcf4..9c87fcb2 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/chapter/ChapterRepositoryImpl.kt +++ b/data/src/commonMain/kotlin/ca/gosyer/jui/data/chapter/ChapterRepositoryImpl.kt @@ -33,145 +33,130 @@ class ChapterRepositoryImpl( private val http: Http, private val serverUrl: Url, ) : ChapterRepository { - override fun getChapter(chapterId: Long): Flow { - return apolloClient.query( - GetChapterQuery(chapterId.toInt()) + override fun getChapter(chapterId: Long): Flow = + apolloClient.query( + GetChapterQuery(chapterId.toInt()), ) .toFlow() .map { val data = it.dataAssertNoErrors data.chapter.chapterFragment.toChapter() } - } - override fun getChapters(mangaId: Long): Flow> { - return apolloClient.query( - GetMangaChaptersQuery(mangaId.toInt()) + override fun getChapters(mangaId: Long): Flow> = + apolloClient.query( + GetMangaChaptersQuery(mangaId.toInt()), ) .toFlow() .map { val data = it.dataAssertNoErrors data.chapters.nodes.map { it.chapterFragment.toChapter() } } - } override fun updateChapter( chapterId: Long, bookmarked: Boolean?, read: Boolean?, lastPageRead: Int?, - ): Flow { - return apolloClient.mutation( + ): Flow = + apolloClient.mutation( UpdateChapterMutation( chapterId.toInt(), UpdateChapterPatchInput( isBookmarked = Optional.presentIfNotNull(bookmarked), isRead = Optional.presentIfNotNull(read), - lastPageRead = Optional.presentIfNotNull(lastPageRead) + lastPageRead = Optional.presentIfNotNull(lastPageRead), ), - ) + ), ) .toFlow() .map { it.dataAssertNoErrors } - } override fun updateChapters( chapterIds: List, bookmarked: Boolean?, read: Boolean?, lastPageRead: Int?, - ): Flow { - return apolloClient.mutation( + ): Flow = + apolloClient.mutation( UpdateChaptersMutation( chapterIds.map { it.toInt() }, UpdateChapterPatchInput( isBookmarked = Optional.presentIfNotNull(bookmarked), isRead = Optional.presentIfNotNull(read), - lastPageRead = Optional.presentIfNotNull(lastPageRead) + lastPageRead = Optional.presentIfNotNull(lastPageRead), ), - ) + ), ) .toFlow() .map { it.dataAssertNoErrors } - } - override fun deleteDownloadedChapter( - chapterId: Long, - ): Flow { - return apolloClient.mutation( + override fun deleteDownloadedChapter(chapterId: Long): Flow = + apolloClient.mutation( DeleteDownloadedChapterMutation( chapterId.toInt(), - ) + ), ) .toFlow() .map { it.dataAssertNoErrors } - } - override fun deleteDownloadedChapters( - chapterIds: List, - ): Flow { - return apolloClient.mutation( + override fun deleteDownloadedChapters(chapterIds: List): Flow = + apolloClient.mutation( DeleteDownloadedChaptersMutation( chapterIds.map { it.toInt() }, - ) + ), ) .toFlow() .map { it.dataAssertNoErrors } - } override fun updateChapterMeta( chapterId: Long, key: String, value: String, - ): Flow { - return apolloClient.mutation( + ): Flow = + apolloClient.mutation( UpdateChapterMetaMutation( chapterId.toInt(), key, value, - ) + ), ) .toFlow() .map { it.dataAssertNoErrors } - } - override fun fetchChapters( - mangaId: Long, - ): Flow> { - return apolloClient.mutation( + override fun fetchChapters(mangaId: Long): Flow> = + apolloClient.mutation( FetchChaptersMutation( mangaId.toInt(), - ) + ), ) .toFlow() .map { val chapters = it.dataAssertNoErrors chapters.fetchChapters!!.chapters.map { it.chapterFragment.toChapter() } } - } - override fun getPages(chapterId: Long): Flow> { - return apolloClient.mutation( + override fun getPages(chapterId: Long): Flow> = + apolloClient.mutation( FetchChapterPagesMutation( chapterId.toInt(), - ) + ), ) .toFlow() .map { val chapters = it.dataAssertNoErrors chapters.fetchChapterPages!!.pages } - } override fun getPage( url: String, @@ -182,10 +167,9 @@ class ChapterRepositoryImpl( return flow { http.get(realUrl, block).readBytes() } } - companion object { - internal fun ChapterFragment.toChapter(): Chapter { - return Chapter( + internal fun ChapterFragment.toChapter(): Chapter = + Chapter( id = id.toLong(), url = url, name = name, @@ -203,16 +187,14 @@ class ChapterRepositoryImpl( lastReadAt = lastPageRead, downloaded = isDownloaded, meta = ChapterMeta( - juiPageOffset = meta.find { it.key == "juiPageOffset" }?.value?.toIntOrNull() ?: 0 - ) + juiPageOffset = meta.find { it.key == "juiPageOffset" }?.value?.toIntOrNull() ?: 0, + ), ) - } - internal fun ChapterWithMangaFragment.toMangaAndChapter(): MangaAndChapter { - return MangaAndChapter( + internal fun ChapterWithMangaFragment.toMangaAndChapter(): MangaAndChapter = + MangaAndChapter( manga.mangaFragment.toManga(), chapterFragment.toChapter(), ) - } } } diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/download/DownloadRepositoryImpl.kt b/data/src/commonMain/kotlin/ca/gosyer/jui/data/download/DownloadRepositoryImpl.kt index 1a1afd75..ece04354 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/download/DownloadRepositoryImpl.kt +++ b/data/src/commonMain/kotlin/ca/gosyer/jui/data/download/DownloadRepositoryImpl.kt @@ -24,79 +24,70 @@ class DownloadRepositoryImpl( private val apolloClient: ApolloClient, private val http: Http, private val serverUrl: Url, -): DownloadRepository { - override fun startDownloading(): Flow { - return apolloClient.mutation( - StartDownloaderMutation() +) : DownloadRepository { + override fun startDownloading(): Flow = + apolloClient.mutation( + StartDownloaderMutation(), ) .toFlow() .map { it.dataAssertNoErrors } - } - override fun stopDownloading(): Flow { - return apolloClient.mutation( - StopDownloaderMutation() + override fun stopDownloading(): Flow = + apolloClient.mutation( + StopDownloaderMutation(), ) .toFlow() .map { it.dataAssertNoErrors } - } - override fun clearDownloadQueue(): Flow { - return apolloClient.mutation( - ClearDownloaderMutation() + override fun clearDownloadQueue(): Flow = + apolloClient.mutation( + ClearDownloaderMutation(), ) .toFlow() .map { it.dataAssertNoErrors } - } - override fun queueChapterDownload(chapterId: Long): Flow { - return apolloClient.mutation( - EnqueueChapterDownloadMutation(chapterId.toInt()) + override fun queueChapterDownload(chapterId: Long): Flow = + apolloClient.mutation( + EnqueueChapterDownloadMutation(chapterId.toInt()), ) .toFlow() .map { it.dataAssertNoErrors } - } - override fun stopChapterDownload(chapterId: Long): Flow { - return apolloClient.mutation( - DequeueChapterDownloadMutation(chapterId.toInt()) + override fun stopChapterDownload(chapterId: Long): Flow = + apolloClient.mutation( + DequeueChapterDownloadMutation(chapterId.toInt()), ) .toFlow() .map { it.dataAssertNoErrors } - } override fun reorderChapterDownload( chapterId: Long, to: Int, - ): Flow { - return apolloClient.mutation( - ReorderChapterDownloadMutation(chapterId.toInt(), to) + ): Flow = + apolloClient.mutation( + ReorderChapterDownloadMutation(chapterId.toInt(), to), ) .toFlow() .map { it.dataAssertNoErrors } - } - override fun batchDownload(chapterIds: List): Flow { - return apolloClient.mutation( - EnqueueChapterDownloadsMutation(chapterIds.map { it.toInt() }) + override fun batchDownload(chapterIds: List): Flow = + apolloClient.mutation( + EnqueueChapterDownloadsMutation(chapterIds.map { it.toInt() }), ) .toFlow() .map { it.dataAssertNoErrors } - } - - } diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/extension/ExtensionRepositoryImpl.kt b/data/src/commonMain/kotlin/ca/gosyer/jui/data/extension/ExtensionRepositoryImpl.kt index 89f0599a..c12df192 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/extension/ExtensionRepositoryImpl.kt +++ b/data/src/commonMain/kotlin/ca/gosyer/jui/data/extension/ExtensionRepositoryImpl.kt @@ -26,19 +26,18 @@ class ExtensionRepositoryImpl( private val apolloClient: ApolloClient, private val http: Http, private val serverUrl: Url, -): ExtensionRepository { - override fun getExtensionList(): Flow> { - return apolloClient.mutation( - FetchExtensionsMutation() +) : ExtensionRepository { + override fun getExtensionList(): Flow> = + apolloClient.mutation( + FetchExtensionsMutation(), ) .toFlow() .map { it.dataAssertNoErrors.fetchExtensions!!.extensions.map { it.extensionFragment.toExtension() } } - } - override fun installExtension(source: Source): Flow { - return apolloClient.mutation( + override fun installExtension(source: Source): Flow = + apolloClient.mutation( InstallExternalExtensionMutation( DefaultUpload.Builder() .content { @@ -46,48 +45,44 @@ class ExtensionRepositoryImpl( } .fileName("extension.apk") .contentType("application/octet-stream") - .build() - ) + .build(), + ), ) .toFlow() .map { it.dataAssertNoErrors.installExternalExtension!! } - } - override fun installExtension(pkgName: String): Flow { - return apolloClient.mutation( - InstallExtensionMutation(pkgName) + override fun installExtension(pkgName: String): Flow = + apolloClient.mutation( + InstallExtensionMutation(pkgName), ) .toFlow() .map { it.dataAssertNoErrors.updateExtension } - } - override fun updateExtension(pkgName: String): Flow { - return apolloClient.mutation( - UpdateExtensionMutation(pkgName) + override fun updateExtension(pkgName: String): Flow = + apolloClient.mutation( + UpdateExtensionMutation(pkgName), ) .toFlow() .map { it.dataAssertNoErrors.updateExtension } - } - override fun uninstallExtension(pkgName: String): Flow { - return apolloClient.mutation( - UninstallExtensionMutation(pkgName) + override fun uninstallExtension(pkgName: String): Flow = + apolloClient.mutation( + UninstallExtensionMutation(pkgName), ) .toFlow() .map { it.dataAssertNoErrors.updateExtension } - } companion object { - internal fun ExtensionFragment.toExtension(): Extension { - return Extension( + internal fun ExtensionFragment.toExtension(): Extension = + Extension( name = name, pkgName = pkgName, versionName = versionName, @@ -100,6 +95,5 @@ class ExtensionRepositoryImpl( obsolete = isObsolete, isNsfw = isNsfw, ) - } } } diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/global/GlobalRepositoryImpl.kt b/data/src/commonMain/kotlin/ca/gosyer/jui/data/global/GlobalRepositoryImpl.kt index da7e9730..0c9139c6 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/global/GlobalRepositoryImpl.kt +++ b/data/src/commonMain/kotlin/ca/gosyer/jui/data/global/GlobalRepositoryImpl.kt @@ -20,28 +20,27 @@ class GlobalRepositoryImpl( private val apolloClient: ApolloClient, private val http: Http, private val serverUrl: Url, -): GlobalRepository { - - override fun getGlobalMeta(): Flow { - return apolloClient.query( - GetGlobalMetaQuery() +) : GlobalRepository { + override fun getGlobalMeta(): Flow = + apolloClient.query( + GetGlobalMetaQuery(), ) .toFlow() .map { val data = it.dataAssertNoErrors GlobalMeta(data.metas.nodes.find { it.key == "example" }?.value?.toIntOrNull() ?: 0) } - } - override fun updateGlobalMeta(key: String, value: String): Flow { - return apolloClient.mutation( - SetGlobalMetaMutation(key, value) + override fun updateGlobalMeta( + key: String, + value: String, + ): Flow = + apolloClient.mutation( + SetGlobalMetaMutation(key, value), ) .toFlow() .map { val data = it.dataAssertNoErrors data.setGlobalMeta!!.clientMutationId } - } - } diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/library/LibraryRepositoryImpl.kt b/data/src/commonMain/kotlin/ca/gosyer/jui/data/library/LibraryRepositoryImpl.kt index a5f749c7..15ddda67 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/library/LibraryRepositoryImpl.kt +++ b/data/src/commonMain/kotlin/ca/gosyer/jui/data/library/LibraryRepositoryImpl.kt @@ -13,22 +13,20 @@ class LibraryRepositoryImpl( private val http: Http, private val serverUrl: Url, ) : LibraryRepository { - fun setMangaInLibrary(mangaId: Long, inLibrary: Boolean): Flow { - return apolloClient.mutation( - SetMangaInLibraryMutation(mangaId.toInt(), inLibrary) + fun setMangaInLibrary( + mangaId: Long, + inLibrary: Boolean, + ): Flow = + apolloClient.mutation( + SetMangaInLibraryMutation(mangaId.toInt(), inLibrary), ) .toFlow() .map { val data = it.dataAssertNoErrors data.updateManga!!.clientMutationId } - } - override fun addMangaToLibrary(mangaId: Long): Flow { - return setMangaInLibrary(mangaId, true) - } + override fun addMangaToLibrary(mangaId: Long): Flow = setMangaInLibrary(mangaId, true) - override fun removeMangaFromLibrary(mangaId: Long): Flow { - return setMangaInLibrary(mangaId, false) - } + override fun removeMangaFromLibrary(mangaId: Long): Flow = setMangaInLibrary(mangaId, false) } diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/manga/MangaRepositoryImpl.kt b/data/src/commonMain/kotlin/ca/gosyer/jui/data/manga/MangaRepositoryImpl.kt index 48ff33d5..7f50c25c 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/manga/MangaRepositoryImpl.kt +++ b/data/src/commonMain/kotlin/ca/gosyer/jui/data/manga/MangaRepositoryImpl.kt @@ -30,71 +30,66 @@ class MangaRepositoryImpl( private val http: Http, private val serverUrl: Url, ) : MangaRepository { - override fun getManga(mangaId: Long): Flow { - return apolloClient.query( - GetMangaQuery(mangaId.toInt()) + override fun getManga(mangaId: Long): Flow = + apolloClient.query( + GetMangaQuery(mangaId.toInt()), ) .toFlow() .map { val data = it.dataAssertNoErrors data.manga.mangaFragment.toManga() } - } - override fun refreshManga(mangaId: Long): Flow { - return apolloClient.mutation( - RefreshMangaMutation(mangaId.toInt()) + override fun refreshManga(mangaId: Long): Flow = + apolloClient.mutation( + RefreshMangaMutation(mangaId.toInt()), ) .toFlow() .map { val data = it.dataAssertNoErrors data.fetchManga!!.manga.mangaFragment.toManga() } - } - override fun getMangaLibrary(mangaId: Long): Flow { - return apolloClient.query( - GetMangaLibraryQuery(mangaId.toInt()) + override fun getMangaLibrary(mangaId: Long): Flow = + apolloClient.query( + GetMangaLibraryQuery(mangaId.toInt()), ) .toFlow() .map { val data = it.dataAssertNoErrors data.manga.libraryMangaFragment.toManga() } - } override fun getMangaThumbnail( mangaId: Long, block: HttpRequestBuilder.() -> Unit, - ): Flow { - return apolloClient.query( - GetThumbnailUrlQuery(mangaId.toInt()) + ): Flow = + apolloClient.query( + GetThumbnailUrlQuery(mangaId.toInt()), ) .toFlow() .map { val data = it.dataAssertNoErrors http.get(data.manga.thumbnailUrl!!).bodyAsChannel() } - } override fun updateMangaMeta( mangaId: Long, key: String, value: String, - ): Flow { - return apolloClient.mutation( - SetMangaMetaMutation(mangaId.toInt(), key, value) + ): Flow = + apolloClient.mutation( + SetMangaMetaMutation(mangaId.toInt(), key, value), ) .toFlow() .map { val data = it.dataAssertNoErrors data.setMangaMeta!!.clientMutationId } - } companion object { - internal fun MangaFragment.toManga(): Manga { - return Manga( + internal fun MangaFragment.toManga(): Manga = + Manga( id = id.toLong(), sourceId = sourceId, url = url, @@ -137,10 +132,9 @@ class MangaRepositoryImpl( age = age, chaptersAge = null, ) - } - internal fun LibraryMangaFragment.toManga(): Manga { - return Manga( + internal fun LibraryMangaFragment.toManga(): Manga = + Manga( id = id.toLong(), sourceId = sourceId, url = url, @@ -183,6 +177,5 @@ class MangaRepositoryImpl( age = age, chaptersAge = null, ) - } } } diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/settings/SettingsRepositoryImpl.kt b/data/src/commonMain/kotlin/ca/gosyer/jui/data/settings/SettingsRepositoryImpl.kt index 3a47167c..7e403349 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/settings/SettingsRepositoryImpl.kt +++ b/data/src/commonMain/kotlin/ca/gosyer/jui/data/settings/SettingsRepositoryImpl.kt @@ -118,7 +118,6 @@ class SettingsRepositoryImpl( webUIUpdateCheckInterval = webUIUpdateCheckInterval, ) - private fun AuthMode.toDomain() = when (this) { AuthMode.NONE -> DomainAuthMode.NONE @@ -354,9 +353,9 @@ class SettingsRepositoryImpl( } .flowOn(Dispatchers.IO) - override fun aboutServer(): Flow { - return apolloClient.query( - AboutServerQuery() + override fun aboutServer(): Flow = + apolloClient.query( + AboutServerQuery(), ) .toFlow() .map { @@ -370,9 +369,8 @@ class SettingsRepositoryImpl( }, data.aboutServer.buildTime, data.aboutServer.github, - data.aboutServer.discord + data.aboutServer.discord, ) } .flowOn(Dispatchers.IO) - } } diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/source/SourceRepositoryImpl.kt b/data/src/commonMain/kotlin/ca/gosyer/jui/data/source/SourceRepositoryImpl.kt index e79d666b..81f32c56 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/source/SourceRepositoryImpl.kt +++ b/data/src/commonMain/kotlin/ca/gosyer/jui/data/source/SourceRepositoryImpl.kt @@ -37,67 +37,61 @@ class SourceRepositoryImpl( private val http: Http, private val serverUrl: Url, ) : SourceRepository { - override fun getSourceList(): Flow> { - return apolloClient.query( - GetSourceListQuery() + override fun getSourceList(): Flow> = + apolloClient.query( + GetSourceListQuery(), ) .toFlow() .map { val data = it.dataAssertNoErrors data.sources.nodes.map { it.sourceFragment.toSource() } } - } - override fun getSourceInfo(sourceId: Long): Flow { - return apolloClient.query( - GetSourceQuery(sourceId) + override fun getSourceInfo(sourceId: Long): Flow = + apolloClient.query( + GetSourceQuery(sourceId), ) .toFlow() .map { val data = it.dataAssertNoErrors data.source.sourceFragment.toSource() } - } override fun getPopularManga( sourceId: Long, pageNum: Int, - ): Flow { - return apolloClient.mutation( - FetchPopularMangaMutation(sourceId, pageNum) + ): Flow = + apolloClient.mutation( + FetchPopularMangaMutation(sourceId, pageNum), ) .toFlow() .map { val data = it.dataAssertNoErrors MangaPage( data.fetchSourceManga!!.mangas.map { it.mangaFragment.toManga() }, - data.fetchSourceManga.hasNextPage + data.fetchSourceManga.hasNextPage, ) } - } override fun getLatestManga( sourceId: Long, pageNum: Int, - ): Flow { - return apolloClient.mutation( - FetchLatestMangaMutation(sourceId, pageNum) + ): Flow = + apolloClient.mutation( + FetchLatestMangaMutation(sourceId, pageNum), ) .toFlow() .map { val data = it.dataAssertNoErrors MangaPage( data.fetchSourceManga!!.mangas.map { it.mangaFragment.toManga() }, - data.fetchSourceManga.hasNextPage + data.fetchSourceManga.hasNextPage, ) } - } - override fun getFilterList( - sourceId: Long, - ): Flow> { - return apolloClient.query( - GetSourceFiltersQuery(sourceId) + override fun getFilterList(sourceId: Long): Flow> = + apolloClient.query( + GetSourceFiltersQuery(sourceId), ) .toFlow() .map { @@ -112,6 +106,7 @@ class SourceRepositoryImpl( filter.checkBoxFilterDefault, ) } + "HeaderFilter" -> { val filter = filter.onHeaderFilter!! SourceFilter.Header( @@ -119,15 +114,17 @@ class SourceRepositoryImpl( filter.name, ) } + "SelectFilter" -> { val filter = filter.onSelectFilter!! SourceFilter.Select( index, filter.name, filter.values, - filter.selectFilterDefault + filter.selectFilterDefault, ) } + "TriStateFilter" -> { val filter = filter.onTriStateFilter!! SourceFilter.TriState( @@ -141,6 +138,7 @@ class SourceRepositoryImpl( }, ) } + "TextFilter" -> { val filter = filter.onTextFilter!! SourceFilter.Text( @@ -149,6 +147,7 @@ class SourceRepositoryImpl( filter.textFilterDefault, ) } + "SortFilter" -> { val filter = filter.onSortFilter!! SourceFilter.Sort( @@ -160,6 +159,7 @@ class SourceRepositoryImpl( }, ) } + "SeparatorFilter" -> { val filter = filter.onSeparatorFilter!! SourceFilter.Separator( @@ -167,6 +167,7 @@ class SourceRepositoryImpl( filter.name, ) } + "GroupFilter" -> { SourceFilter.Group( index, @@ -181,6 +182,7 @@ class SourceRepositoryImpl( filter.checkBoxFilterDefault, ) } + "HeaderFilter" -> { val filter = filter.onHeaderFilter!! SourceFilter.Header( @@ -188,15 +190,17 @@ class SourceRepositoryImpl( filter.name, ) } + "SelectFilter" -> { val filter = filter.onSelectFilter!! SourceFilter.Select( index, filter.name, filter.values, - filter.selectFilterDefault + filter.selectFilterDefault, ) } + "TriStateFilter" -> { val filter = filter.onTriStateFilter!! SourceFilter.TriState( @@ -210,6 +214,7 @@ class SourceRepositoryImpl( }, ) } + "TextFilter" -> { val filter = filter.onTextFilter!! SourceFilter.Text( @@ -218,6 +223,7 @@ class SourceRepositoryImpl( filter.textFilterDefault, ) } + "SortFilter" -> { val filter = filter.onSortFilter!! SourceFilter.Sort( @@ -229,6 +235,7 @@ class SourceRepositoryImpl( }, ) } + "SeparatorFilter" -> { val filter = filter.onSeparatorFilter!! SourceFilter.Separator( @@ -236,16 +243,17 @@ class SourceRepositoryImpl( filter.name, ) } + else -> SourceFilter.Header(index, "") } - } + }, ) } + else -> SourceFilter.Header(index, "") } } } - } fun SourceFilter.toFilterChange(): List? { return when (this) { @@ -254,28 +262,34 @@ class SourceRepositoryImpl( } else { null } + is SourceFilter.Header -> null + is SourceFilter.Select -> if (value != default) { listOf(FilterChangeInput(position = position, selectState = value.toOptional())) } else { null } + is SourceFilter.Separator -> null + is SourceFilter.Sort -> if (value != default) { listOf( FilterChangeInput( position = position, - sortState = value?.let { SortSelectionInput(it.ascending, it.index) }.toOptional() - ) + sortState = value?.let { SortSelectionInput(it.ascending, it.index) }.toOptional(), + ), ) } else { null } + is SourceFilter.Text -> if (value != default) { listOf(FilterChangeInput(position = position, textState = value.toOptional())) } else { null } + is SourceFilter.TriState -> if (value != default) { listOf( FilterChangeInput( @@ -285,29 +299,31 @@ class SourceRepositoryImpl( TriStateValue.INCLUDE -> TriState.INCLUDE TriStateValue.EXCLUDE -> TriState.EXCLUDE }.toOptional(), - ) + ), ) } else { null } + is SourceFilter.Group -> value.mapNotNull { FilterChangeInput( position = position, groupChange = it.toFilterChange() ?.firstOrNull() ?.toOptional() - ?: return@mapNotNull null + ?: return@mapNotNull null, ) } } } + override fun getSearchResults( sourceId: Long, pageNum: Int, searchTerm: String?, filters: List?, - ): Flow { - return apolloClient.mutation( + ): Flow = + apolloClient.mutation( FetchSearchMangaMutation( sourceId, pageNum, @@ -322,14 +338,13 @@ class SourceRepositoryImpl( val data = it.dataAssertNoErrors MangaPage( data.fetchSourceManga!!.mangas.map { it.mangaFragment.toManga() }, - data.fetchSourceManga.hasNextPage + data.fetchSourceManga.hasNextPage, ) } - } - override fun getSourceSettings(sourceId: Long): Flow> { - return apolloClient.query( - GetSourcePreferencesQuery(sourceId) + override fun getSourceSettings(sourceId: Long): Flow> = + apolloClient.query( + GetSourcePreferencesQuery(sourceId), ) .toFlow() .map { @@ -349,6 +364,7 @@ class SourceRepositoryImpl( default = it.checkBoxDefault, ) } + "EditTextPreference" -> preference.onEditTextPreference!!.let { EditTextSourcePreference( position = index, @@ -364,6 +380,7 @@ class SourceRepositoryImpl( text = it.text, ) } + "SwitchPreference" -> preference.onSwitchPreference!!.let { SwitchSourcePreference( position = index, @@ -376,6 +393,7 @@ class SourceRepositoryImpl( default = it.switchPreferenceDefault, ) } + "MultiSelectListPreference" -> preference.onMultiSelectListPreference!!.let { MultiSelectListSourcePreference( position = index, @@ -389,9 +407,10 @@ class SourceRepositoryImpl( dialogTitle = it.dialogTitle, dialogMessage = it.dialogMessage, entries = it.entries, - entryValues = it.entryValues + entryValues = it.entryValues, ) } + "ListPreference" -> preference.onListPreference!!.let { ListSourcePreference( position = index, @@ -403,20 +422,20 @@ class SourceRepositoryImpl( currentValue = it.listPreferenceCurrentValue, default = it.listPreferenceDefault, entries = it.entries, - entryValues = it.entryValues + entryValues = it.entryValues, ) } + else -> null } } } - } override fun setSourceSetting( sourceId: Long, sourcePreference: SourcePreference, - ): Flow { - return apolloClient.mutation( + ): Flow = + apolloClient.mutation( SetSourceSettingMutation( sourceId, SourcePreferenceChangeInput( @@ -426,18 +445,17 @@ class SourceRepositoryImpl( editTextState = (sourcePreference as? EditTextSourcePreference)?.currentValue.toOptional(), multiSelectState = (sourcePreference as? MultiSelectListSourcePreference)?.currentValue.toOptional(), listState = (sourcePreference as? ListSourcePreference)?.currentValue.toOptional(), - ) - ) + ), + ), ) .toFlow() .map { it.dataAssertNoErrors.updateSourcePreference!!.clientMutationId } - } companion object { - internal fun SourceFragment.toSource(): Source { - return Source( + internal fun SourceFragment.toSource(): Source = + Source( id, name, lang, @@ -445,8 +463,7 @@ class SourceRepositoryImpl( supportsLatest, isConfigurable, isNsfw, - displayName + displayName, ) - } } } diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/updates/UpdatesRepositoryImpl.kt b/data/src/commonMain/kotlin/ca/gosyer/jui/data/updates/UpdatesRepositoryImpl.kt index 4e2a3afd..68d75d6c 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/updates/UpdatesRepositoryImpl.kt +++ b/data/src/commonMain/kotlin/ca/gosyer/jui/data/updates/UpdatesRepositoryImpl.kt @@ -22,42 +22,37 @@ class UpdatesRepositoryImpl( private val apolloClient: ApolloClient, private val http: Http, private val serverUrl: Url, -): UpdatesRepository { - override fun getRecentUpdates(pageNum: Int): Flow { - return apolloClient.query( - GetChapterUpdatesQuery(50, pageNum * 50) +) : UpdatesRepository { + override fun getRecentUpdates(pageNum: Int): Flow = + apolloClient.query( + GetChapterUpdatesQuery(50, pageNum * 50), ) .toFlow() .map { val data = it.dataAssertNoErrors Updates( data.chapters.nodes.map { it.chapterWithMangaFragment.toMangaAndChapter() }, - data.chapters.pageInfo.hasNextPage + data.chapters.pageInfo.hasNextPage, ) - } - } - override fun updateLibrary(): Flow { - return apolloClient.mutation( - UpdateLibraryMutation() + override fun updateLibrary(): Flow = + apolloClient.mutation( + UpdateLibraryMutation(), ) .toFlow() .map { val data = it.dataAssertNoErrors data.updateLibraryManga!!.clientMutationId } - } - override fun updateCategory(categoryId: Long): Flow { - return apolloClient.mutation( - UpdateCategoryMutation(listOf(categoryId.toInt())) + override fun updateCategory(categoryId: Long): Flow = + apolloClient.mutation( + UpdateCategoryMutation(listOf(categoryId.toInt())), ) .toFlow() .map { val data = it.dataAssertNoErrors data.updateCategoryManga!!.clientMutationId } - } - } diff --git a/data/src/desktopMain/kotlin/ca/gosyer/jui/data/SharedDataComponent.kt b/data/src/desktopMain/kotlin/ca/gosyer/jui/data/SharedDataComponent.kt index cb98f575..d544483c 100644 --- a/data/src/desktopMain/kotlin/ca/gosyer/jui/data/SharedDataComponent.kt +++ b/data/src/desktopMain/kotlin/ca/gosyer/jui/data/SharedDataComponent.kt @@ -1,5 +1,3 @@ package ca.gosyer.jui.data -actual interface SharedDataComponent { - -} +actual interface SharedDataComponent diff --git a/data/src/iosMain/kotlin/ca/gosyer/jui/data/SharedDataComponent.kt b/data/src/iosMain/kotlin/ca/gosyer/jui/data/SharedDataComponent.kt index cb98f575..d544483c 100644 --- a/data/src/iosMain/kotlin/ca/gosyer/jui/data/SharedDataComponent.kt +++ b/data/src/iosMain/kotlin/ca/gosyer/jui/data/SharedDataComponent.kt @@ -1,5 +1,3 @@ package ca.gosyer.jui.data -actual interface SharedDataComponent { - -} +actual interface SharedDataComponent diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/ServerListeners.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/ServerListeners.kt index 29eaa6ab..73fee015 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/ServerListeners.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/ServerListeners.kt @@ -99,7 +99,7 @@ class ServerListeners .startWith(Unit) .combine( _mangaChapterIdsListener.filter { mangaIdPredate?.invoke(it) ?: false } - .startWith(Unit) + .startWith(Unit), ) { _, _ -> } return idsListener @@ -107,17 +107,13 @@ class ServerListeners .flatMapLatest { flow } } - fun updateChapters( - chapterIds: List, - ) { + fun updateChapters(chapterIds: List) { scope.launch { _chapterIdsListener.emit(chapterIds) } } - fun updateChapters( - vararg chapterIds: Long, - ) { + fun updateChapters(vararg chapterIds: Long) { scope.launch { _chapterIdsListener.emit(chapterIds.toList()) } diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/backup/interactor/ImportBackupFile.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/backup/interactor/ImportBackupFile.kt index 19b6dfa0..19f3f32a 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/backup/interactor/ImportBackupFile.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/backup/interactor/ImportBackupFile.kt @@ -30,9 +30,7 @@ class ImportBackupFile } .singleOrNull() - fun asFlow( - file: Path, - ) = backupRepository.restoreBackup(FileSystem.SYSTEM.source(file)) + fun asFlow(file: Path) = backupRepository.restoreBackup(FileSystem.SYSTEM.source(file)) companion object { private val log = logging() diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/backup/interactor/ValidateBackupFile.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/backup/interactor/ValidateBackupFile.kt index cddc08e3..453f45db 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/backup/interactor/ValidateBackupFile.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/backup/interactor/ValidateBackupFile.kt @@ -30,9 +30,7 @@ class ValidateBackupFile } .singleOrNull() - fun asFlow( - file: Path, - ) = backupRepository.validateBackup(FileSystem.SYSTEM.source(file)) + fun asFlow(file: Path) = backupRepository.validateBackup(FileSystem.SYSTEM.source(file)) companion object { private val log = logging() diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/backup/service/BackupRepository.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/backup/service/BackupRepository.kt index 087d7107..66e3ec28 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/backup/service/BackupRepository.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/backup/service/BackupRepository.kt @@ -8,8 +8,11 @@ import okio.Source interface BackupRepository { fun validateBackup(source: Source): Flow + fun restoreBackup(source: Source): Flow> + fun restoreStatus(id: String): Flow + fun createBackup( includeCategories: Boolean, includeChapters: Boolean, diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/category/service/CategoryRepository.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/category/service/CategoryRepository.kt index d845b71d..aa6c9018 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/category/service/CategoryRepository.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/category/service/CategoryRepository.kt @@ -11,10 +11,7 @@ import ca.gosyer.jui.domain.manga.model.Manga import kotlinx.coroutines.flow.Flow interface CategoryRepository { - - fun getMangaCategories( - mangaId: Long, - ): Flow> + fun getMangaCategories(mangaId: Long): Flow> fun addMangaToCategory( mangaId: Long, @@ -28,9 +25,7 @@ interface CategoryRepository { fun getCategories(): Flow> - fun createCategory( - name: String, - ): Flow + fun createCategory(name: String): Flow fun modifyCategory( categoryId: Long, @@ -42,13 +37,9 @@ interface CategoryRepository { position: Int, ): Flow - fun deleteCategory( - categoryId: Long, - ): Flow + fun deleteCategory(categoryId: Long): Flow - fun getMangaFromCategory( - categoryId: Long, - ): Flow> + fun getMangaFromCategory(categoryId: Long): Flow> fun updateCategoryMeta( categoryId: Long, diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/interactor/DeleteChapterDownload.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/interactor/DeleteChapterDownload.kt index f0537466..fd7bcb18 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/interactor/DeleteChapterDownload.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/interactor/DeleteChapterDownload.kt @@ -64,20 +64,18 @@ class DeleteChapterDownload } .collect() - fun asFlow( - chapterId: Long, - ) = chapterRepository.deleteDownloadedChapter(chapterId) - .onEach { serverListeners.updateChapters(chapterId) } + fun asFlow(chapterId: Long) = + chapterRepository.deleteDownloadedChapter(chapterId) + .onEach { serverListeners.updateChapters(chapterId) } @JvmName("asFlowChapter") fun asFlow(chapter: Chapter) = chapterRepository.deleteDownloadedChapter(chapter.id) .onEach { serverListeners.updateChapters(chapter.id) } - fun asFlow( - chapterIds: List, - ) = chapterRepository.deleteDownloadedChapters(chapterIds) - .onEach { serverListeners.updateChapters(chapterIds) } + fun asFlow(chapterIds: List) = + chapterRepository.deleteDownloadedChapters(chapterIds) + .onEach { serverListeners.updateChapters(chapterIds) } @JvmName("asFlowChapters") fun asFlow(chapter: List) = diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/interactor/GetChapter.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/interactor/GetChapter.kt index 3023dff2..74f8c265 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/interactor/GetChapter.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/interactor/GetChapter.kt @@ -43,12 +43,11 @@ class GetChapter } .singleOrNull() - fun asFlow( - chapterId: Long, - ) = serverListeners.combineChapters( - chapterRepository.getChapter(chapterId), - chapterIdPredate = { ids -> chapterId in ids }, - ) + fun asFlow(chapterId: Long) = + serverListeners.combineChapters( + chapterRepository.getChapter(chapterId), + chapterIdPredate = { ids -> chapterId in ids }, + ) fun asFlow(chapter: Chapter) = serverListeners.combineChapters( diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/interactor/GetChapterPages.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/interactor/GetChapterPages.kt index 88867aa8..beedcbfa 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/interactor/GetChapterPages.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/interactor/GetChapterPages.kt @@ -39,9 +39,7 @@ class GetChapterPages } .singleOrNull() - fun asFlow( - chapterId: Long, - ) = chapterRepository.getPages(chapterId) + fun asFlow(chapterId: Long) = chapterRepository.getPages(chapterId) fun asFlow( url: String, diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/interactor/UpdateChapter.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/interactor/UpdateChapter.kt index b4143ced..f872bfef 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/interactor/UpdateChapter.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/interactor/UpdateChapter.kt @@ -48,32 +48,32 @@ class UpdateChapter } .collect() - suspend fun await( - chapterIds: List, - bookmarked: Boolean? = null, - read: Boolean? = null, - lastPageRead: Int? = null, - onError: suspend (Throwable) -> Unit = {}, - ) = asFlow(chapterIds, bookmarked, read, lastPageRead) - .catch { - onError(it) - log.warn(it) { "Failed to update chapter bookmark for chapters $chapterIds" } - } - .collect() + suspend fun await( + chapterIds: List, + bookmarked: Boolean? = null, + read: Boolean? = null, + lastPageRead: Int? = null, + onError: suspend (Throwable) -> Unit = {}, + ) = asFlow(chapterIds, bookmarked, read, lastPageRead) + .catch { + onError(it) + log.warn(it) { "Failed to update chapter bookmark for chapters $chapterIds" } + } + .collect() - @JvmName("awaitChapters") - suspend fun await( - chapters: List, - bookmarked: Boolean? = null, - read: Boolean? = null, - lastPageRead: Int? = null, - onError: suspend (Throwable) -> Unit = {}, - ) = asFlow(chapters, bookmarked, read, lastPageRead) - .catch { - onError(it) - log.warn(it) { "Failed to update chapter bookmark for chapters ${chapters.joinToString { it.id.toString() }}" } - } - .collect() + @JvmName("awaitChapters") + suspend fun await( + chapters: List, + bookmarked: Boolean? = null, + read: Boolean? = null, + lastPageRead: Int? = null, + onError: suspend (Throwable) -> Unit = {}, + ) = asFlow(chapters, bookmarked, read, lastPageRead) + .catch { + onError(it) + log.warn(it) { "Failed to update chapter bookmark for chapters ${chapters.joinToString { it.id.toString() }}" } + } + .collect() fun asFlow( chapterId: Long, @@ -91,7 +91,7 @@ class UpdateChapter chapter: Chapter, bookmarked: Boolean? = null, read: Boolean? = null, - lastPageRead: Int? = null + lastPageRead: Int? = null, ) = chapterRepository.updateChapter( chapterId = chapter.id, bookmarked = bookmarked, @@ -99,30 +99,30 @@ class UpdateChapter lastPageRead = lastPageRead, ).onEach { serverListeners.updateChapters(chapter.id) } - fun asFlow( - chapterIds: List, - bookmarked: Boolean? = null, - read: Boolean? = null, - lastPageRead: Int? = null, - ) = chapterRepository.updateChapters( - chapterIds = chapterIds, - bookmarked = bookmarked, - read = read, - lastPageRead = lastPageRead, - ).onEach { serverListeners.updateChapters(chapterIds) } + fun asFlow( + chapterIds: List, + bookmarked: Boolean? = null, + read: Boolean? = null, + lastPageRead: Int? = null, + ) = chapterRepository.updateChapters( + chapterIds = chapterIds, + bookmarked = bookmarked, + read = read, + lastPageRead = lastPageRead, + ).onEach { serverListeners.updateChapters(chapterIds) } - @JvmName("asFlowChapters") - fun asFlow( - chapters: List, - bookmarked: Boolean? = null, - read: Boolean? = null, - lastPageRead: Int? = null - ) = chapterRepository.updateChapters( - chapterIds = chapters.map { it.id }, - bookmarked = bookmarked, - read = read, - lastPageRead = lastPageRead, - ).onEach { serverListeners.updateChapters(chapters.map { it.id }) } + @JvmName("asFlowChapters") + fun asFlow( + chapters: List, + bookmarked: Boolean? = null, + read: Boolean? = null, + lastPageRead: Int? = null, + ) = chapterRepository.updateChapters( + chapterIds = chapters.map { it.id }, + bookmarked = bookmarked, + read = read, + lastPageRead = lastPageRead, + ).onEach { serverListeners.updateChapters(chapters.map { it.id }) } companion object { private val log = logging() 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 139e45f4..2e9c4d2e 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 @@ -5,13 +5,9 @@ import io.ktor.client.request.HttpRequestBuilder import kotlinx.coroutines.flow.Flow interface ChapterRepository { - fun getChapter( - chapterId: Long, - ): Flow + fun getChapter(chapterId: Long): Flow - fun getChapters( - mangaId: Long, - ): Flow> + fun getChapters(mangaId: Long): Flow> fun updateChapter( chapterId: Long, @@ -27,13 +23,9 @@ interface ChapterRepository { lastPageRead: Int? = null, ): Flow - fun deleteDownloadedChapter( - chapterId: Long, - ): Flow + fun deleteDownloadedChapter(chapterId: Long): Flow - fun deleteDownloadedChapters( - chapterIds: List, - ): Flow + fun deleteDownloadedChapters(chapterIds: List): Flow fun updateChapterMeta( chapterId: Long, @@ -41,13 +33,9 @@ interface ChapterRepository { value: String, ): Flow - fun fetchChapters( - mangaId: Long, - ): Flow> + fun fetchChapters(mangaId: Long): Flow> - fun getPages( - chapterId: Long, - ): Flow> + fun getPages(chapterId: Long): Flow> fun getPage( url: String, diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/download/interactor/QueueChapterDownload.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/download/interactor/QueueChapterDownload.kt index 11b4e56c..cfcd1b3a 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/download/interactor/QueueChapterDownload.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/download/interactor/QueueChapterDownload.kt @@ -23,13 +23,11 @@ class QueueChapterDownload ) = asFlow(chapterId) .catch { onError(it) - log.warn(it) { "Failed to queue chapter ${chapterId} for a download" } + log.warn(it) { "Failed to queue chapter $chapterId for a download" } } .collect() - fun asFlow( - chapterId: Long, - ) = downloadRepository.queueChapterDownload(chapterId) + fun asFlow(chapterId: Long) = downloadRepository.queueChapterDownload(chapterId) companion object { private val log = logging() diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/download/service/DownloadRepository.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/download/service/DownloadRepository.kt index c8ef643d..7ea47b6c 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/download/service/DownloadRepository.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/download/service/DownloadRepository.kt @@ -9,27 +9,20 @@ package ca.gosyer.jui.domain.download.service import kotlinx.coroutines.flow.Flow interface DownloadRepository { - fun startDownloading(): Flow fun stopDownloading(): Flow fun clearDownloadQueue(): Flow - fun queueChapterDownload( - chapterId: Long, - ): Flow + fun queueChapterDownload(chapterId: Long): Flow - fun stopChapterDownload( - chapterId: Long, - ): Flow + fun stopChapterDownload(chapterId: Long): Flow fun reorderChapterDownload( chapterId: Long, to: Int, ): Flow - fun batchDownload( - chapterIds: List, - ): Flow + fun batchDownload(chapterIds: List): Flow } diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/extension/service/ExtensionRepository.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/extension/service/ExtensionRepository.kt index 8b1f98b6..dabbfb47 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/extension/service/ExtensionRepository.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/extension/service/ExtensionRepository.kt @@ -11,22 +11,13 @@ import kotlinx.coroutines.flow.Flow import okio.Source interface ExtensionRepository { - fun getExtensionList(): Flow> - fun installExtension( - source: Source, - ): Flow + fun installExtension(source: Source): Flow - fun installExtension( - pkgName: String, - ): Flow + fun installExtension(pkgName: String): Flow - fun updateExtension( - pkgName: String, - ): Flow + fun updateExtension(pkgName: String): Flow - fun uninstallExtension( - pkgName: String, - ): Flow + fun uninstallExtension(pkgName: String): Flow } diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/library/service/LibraryRepository.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/library/service/LibraryRepository.kt index 8778e3e6..fded1ab8 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/library/service/LibraryRepository.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/library/service/LibraryRepository.kt @@ -9,11 +9,7 @@ package ca.gosyer.jui.domain.library.service import kotlinx.coroutines.flow.Flow interface LibraryRepository { - fun addMangaToLibrary( - mangaId: Long, - ): Flow + fun addMangaToLibrary(mangaId: Long): Flow - fun removeMangaFromLibrary( - mangaId: Long, - ): Flow + fun removeMangaFromLibrary(mangaId: Long): Flow } diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/manga/service/MangaRepository.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/manga/service/MangaRepository.kt index b6f47530..03e47f7c 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/manga/service/MangaRepository.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/manga/service/MangaRepository.kt @@ -12,18 +12,11 @@ import io.ktor.utils.io.ByteReadChannel import kotlinx.coroutines.flow.Flow interface MangaRepository { + fun getManga(mangaId: Long): Flow - fun getManga( - mangaId: Long, - ): Flow + fun refreshManga(mangaId: Long): Flow - fun refreshManga( - mangaId: Long, - ): Flow - - fun getMangaLibrary( - mangaId: Long, - ): Flow + fun getMangaLibrary(mangaId: Long): Flow fun getMangaThumbnail( mangaId: Long, diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/settings/model/AuthMode.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/settings/model/AuthMode.kt index 2e0f0fa7..9fa626e0 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/settings/model/AuthMode.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/settings/model/AuthMode.kt @@ -1,9 +1,9 @@ package ca.gosyer.jui.domain.settings.model enum class AuthMode { - NONE, - BASIC_AUTH, - SIMPLE_LOGIN, - UI_LOGIN, - UNKNOWN__, + NONE, + BASIC_AUTH, + SIMPLE_LOGIN, + UI_LOGIN, + UNKNOWN__, } diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/settings/model/DatabaseType.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/settings/model/DatabaseType.kt index 3adf3a3d..1a99211b 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/settings/model/DatabaseType.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/settings/model/DatabaseType.kt @@ -1,8 +1,7 @@ package ca.gosyer.jui.domain.settings.model enum class DatabaseType { - H2, - POSTGRESQL, - UNKNOWN__, - ; + H2, + POSTGRESQL, + UNKNOWN__, } diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/settings/model/KoreaderSyncChecksumMethod.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/settings/model/KoreaderSyncChecksumMethod.kt index 5a522bad..b888e10b 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/settings/model/KoreaderSyncChecksumMethod.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/settings/model/KoreaderSyncChecksumMethod.kt @@ -1,7 +1,7 @@ package ca.gosyer.jui.domain.settings.model enum class KoreaderSyncChecksumMethod { - BINARY, - FILENAME, - UNKNOWN__, + BINARY, + FILENAME, + UNKNOWN__, } diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/settings/model/KoreaderSyncConflictStrategy.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/settings/model/KoreaderSyncConflictStrategy.kt index 9f020318..60cf6630 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/settings/model/KoreaderSyncConflictStrategy.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/settings/model/KoreaderSyncConflictStrategy.kt @@ -1,9 +1,9 @@ package ca.gosyer.jui.domain.settings.model enum class KoreaderSyncConflictStrategy { - PROMPT, - KEEP_LOCAL, - KEEP_REMOTE, - DISABLED, - UNKNOWN__, + PROMPT, + KEEP_LOCAL, + KEEP_REMOTE, + DISABLED, + UNKNOWN__, } diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/settings/model/SortOrder.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/settings/model/SortOrder.kt index 6369b6e7..037511e0 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/settings/model/SortOrder.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/settings/model/SortOrder.kt @@ -1,11 +1,11 @@ package ca.gosyer.jui.domain.settings.model enum class SortOrder { - ASC, - DESC, - ASC_NULLS_FIRST, - DESC_NULLS_FIRST, - ASC_NULLS_LAST, - DESC_NULLS_LAST, - UNKNOWN__, + ASC, + DESC, + ASC_NULLS_FIRST, + DESC_NULLS_FIRST, + ASC_NULLS_LAST, + DESC_NULLS_LAST, + UNKNOWN__, } diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/interactor/GetFilterList.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/interactor/GetFilterList.kt index 4d2a9fbf..4c6375df 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/interactor/GetFilterList.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/interactor/GetFilterList.kt @@ -38,13 +38,9 @@ class GetFilterList } .singleOrNull() - fun asFlow( - source: Source, - ) = sourceRepository.getFilterList(source.id) + fun asFlow(source: Source) = sourceRepository.getFilterList(source.id) - fun asFlow( - sourceId: Long, - ) = sourceRepository.getFilterList(sourceId) + fun asFlow(sourceId: Long) = sourceRepository.getFilterList(sourceId) companion object { private val log = logging() diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcefilters/SourceFilterChange.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcefilters/SourceFilterChange.kt index 4b69de3e..1f559ef5 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcefilters/SourceFilterChange.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcefilters/SourceFilterChange.kt @@ -25,31 +25,31 @@ data class SourceFilterChangeOld( ) } - sealed interface SourceFilter { val position: Int + data class Checkbox( override val position: Int, val name: String, val default: Boolean, val value: Boolean = default, - ): SourceFilter + ) : SourceFilter data class Header( override val position: Int, val name: String, - ): SourceFilter + ) : SourceFilter data class Separator( override val position: Int, val name: String, - ): SourceFilter + ) : SourceFilter data class Group( override val position: Int, val name: String, val value: List, - ): SourceFilter + ) : SourceFilter data class Select( override val position: Int, @@ -57,7 +57,7 @@ sealed interface SourceFilter { val values: List, val default: Int, val value: Int = default, - ): SourceFilter + ) : SourceFilter data class Sort( override val position: Int, @@ -65,10 +65,10 @@ sealed interface SourceFilter { val values: List, val default: SelectionChange?, val value: SelectionChange? = default, - ): SourceFilter { + ) : SourceFilter { data class SelectionChange( val ascending: Boolean, - val index: Int + val index: Int, ) } @@ -77,18 +77,18 @@ sealed interface SourceFilter { val name: String, val default: String, val value: String = default, - ): SourceFilter + ) : SourceFilter data class TriState( override val position: Int, val name: String, val default: TriStateValue, val value: TriStateValue = default, - ): SourceFilter { + ) : SourceFilter { enum class TriStateValue { IGNORE, INCLUDE, - EXCLUDE + EXCLUDE, } } } diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/service/SourceRepository.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/service/SourceRepository.kt index 12dbedf6..d2f22ad6 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/service/SourceRepository.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/service/SourceRepository.kt @@ -13,12 +13,9 @@ import ca.gosyer.jui.domain.source.model.sourcepreference.SourcePreference import kotlinx.coroutines.flow.Flow interface SourceRepository { - fun getSourceList(): Flow> - fun getSourceInfo( - sourceId: Long, - ): Flow + fun getSourceInfo(sourceId: Long): Flow fun getPopularManga( sourceId: Long, @@ -30,9 +27,7 @@ interface SourceRepository { pageNum: Int, ): Flow - fun getFilterList( - sourceId: Long, - ): Flow> + fun getFilterList(sourceId: Long): Flow> fun getSearchResults( sourceId: Long, @@ -41,9 +36,7 @@ interface SourceRepository { filters: List?, ): Flow - fun getSourceSettings( - sourceId: Long, - ): Flow> + fun getSourceSettings(sourceId: Long): Flow> fun setSourceSetting( sourceId: Long, diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/updates/service/UpdatesRepository.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/updates/service/UpdatesRepository.kt index fd8b5abe..ba57e2fd 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/updates/service/UpdatesRepository.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/updates/service/UpdatesRepository.kt @@ -10,13 +10,9 @@ import ca.gosyer.jui.domain.updates.model.Updates import kotlinx.coroutines.flow.Flow interface UpdatesRepository { - fun getRecentUpdates( - pageNum: Int, - ): Flow + fun getRecentUpdates(pageNum: Int): Flow fun updateLibrary(): Flow - fun updateCategory( - categoryId: Long, - ): Flow + fun updateCategory(categoryId: Long): Flow } diff --git a/domain/src/desktopMain/kotlin/ca/gosyer/jui/domain/server/service/host/ServerHostPreference.kt b/domain/src/desktopMain/kotlin/ca/gosyer/jui/domain/server/service/host/ServerHostPreference.kt index 91b25933..a779799c 100644 --- a/domain/src/desktopMain/kotlin/ca/gosyer/jui/domain/server/service/host/ServerHostPreference.kt +++ b/domain/src/desktopMain/kotlin/ca/gosyer/jui/domain/server/service/host/ServerHostPreference.kt @@ -67,10 +67,10 @@ sealed class ServerHostPreference { class RootPath( preferenceStore: PreferenceStore, ) : StringServerHostPreference( - preferenceStore, - "rootDir", - "", - ) + preferenceStore, + "rootDir", + "", + ) class IP( preferenceStore: PreferenceStore, diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/browse/SourceScreen.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/browse/SourceScreen.kt index 6cad7bdc..aad89bc9 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/browse/SourceScreen.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/browse/SourceScreen.kt @@ -25,7 +25,6 @@ import cafe.adriel.voyager.navigator.currentOrThrow import kotlinx.coroutines.flow.collect import kotlinx.coroutines.flow.mapLatest import kotlinx.coroutines.flow.merge -import org.lighthousegames.logging.logging private fun SourceFiltersView<*, *>.toSourceFilter(): SourceFilter { return when (this) { @@ -40,8 +39,6 @@ private fun SourceFiltersView<*, *>.toSourceFilter(): SourceFilter { } } -val logs = logging() - class SourceScreen( val source: Source, private val initialQuery: String? = null,