diff --git a/android/build.gradle.kts b/android/build.gradle.kts index 45072d2a..a5d039a7 100644 --- a/android/build.gradle.kts +++ b/android/build.gradle.kts @@ -13,8 +13,8 @@ plugins { dependencies { implementation(projects.core) implementation(projects.i18n) - implementation(projects.data) implementation(projects.domain) + implementation(projects.data) implementation(projects.uiCore) implementation(projects.presentation) diff --git a/android/src/main/kotlin/ca/gosyer/jui/android/App.kt b/android/src/main/kotlin/ca/gosyer/jui/android/App.kt index 6017f809..ce3a92e7 100644 --- a/android/src/main/kotlin/ca/gosyer/jui/android/App.kt +++ b/android/src/main/kotlin/ca/gosyer/jui/android/App.kt @@ -15,7 +15,7 @@ import androidx.lifecycle.lifecycleScope import ca.gosyer.jui.android.data.notification.Notifications import ca.gosyer.jui.core.prefs.Preference import ca.gosyer.jui.core.prefs.getAsFlow -import ca.gosyer.jui.data.ui.model.ThemeMode +import ca.gosyer.jui.domain.ui.model.ThemeMode import kotlinx.coroutines.flow.launchIn import org.lighthousegames.logging.logging import java.util.Locale diff --git a/android/src/main/kotlin/ca/gosyer/jui/android/AppComponent.kt b/android/src/main/kotlin/ca/gosyer/jui/android/AppComponent.kt index 6c067e60..f53995f1 100644 --- a/android/src/main/kotlin/ca/gosyer/jui/android/AppComponent.kt +++ b/android/src/main/kotlin/ca/gosyer/jui/android/AppComponent.kt @@ -9,6 +9,7 @@ package ca.gosyer.jui.android import android.annotation.SuppressLint import android.content.Context import ca.gosyer.jui.core.di.AppScope +import ca.gosyer.jui.data.DataComponent import ca.gosyer.jui.domain.DomainComponent import ca.gosyer.jui.ui.base.UiComponent import me.tatarka.inject.annotations.Component @@ -20,7 +21,7 @@ abstract class AppComponent( @get:AppScope @get:Provides val context: Context -) : DomainComponent, UiComponent { +) : DataComponent, DomainComponent, UiComponent { abstract val appMigrations: AppMigrations diff --git a/android/src/main/kotlin/ca/gosyer/jui/android/AppMigrations.kt b/android/src/main/kotlin/ca/gosyer/jui/android/AppMigrations.kt index 606eab8d..948b893b 100644 --- a/android/src/main/kotlin/ca/gosyer/jui/android/AppMigrations.kt +++ b/android/src/main/kotlin/ca/gosyer/jui/android/AppMigrations.kt @@ -7,7 +7,7 @@ package ca.gosyer.jui.android import ca.gosyer.jui.android.data.update.UpdateCheckWorker -import ca.gosyer.jui.data.migration.MigrationPreferences +import ca.gosyer.jui.domain.migration.service.MigrationPreferences import ca.gosyer.jui.uicore.vm.ContextWrapper import me.tatarka.inject.annotations.Inject diff --git a/android/src/main/kotlin/ca/gosyer/jui/android/data/download/AndroidDownloadService.kt b/android/src/main/kotlin/ca/gosyer/jui/android/data/download/AndroidDownloadService.kt index 8134ac3f..5b41cce1 100644 --- a/android/src/main/kotlin/ca/gosyer/jui/android/data/download/AndroidDownloadService.kt +++ b/android/src/main/kotlin/ca/gosyer/jui/android/data/download/AndroidDownloadService.kt @@ -20,13 +20,13 @@ import ca.gosyer.jui.android.util.notificationManager import ca.gosyer.jui.core.lang.chop import ca.gosyer.jui.core.lang.throwIfCancellation import ca.gosyer.jui.core.prefs.getAsFlow -import ca.gosyer.jui.data.download.model.DownloadState -import ca.gosyer.jui.data.download.model.DownloadStatus -import ca.gosyer.jui.data.server.requests.downloadsQuery import ca.gosyer.jui.domain.base.WebsocketService.Actions import ca.gosyer.jui.domain.base.WebsocketService.Status -import ca.gosyer.jui.domain.download.DownloadService -import ca.gosyer.jui.domain.download.DownloadService.Companion.status +import ca.gosyer.jui.domain.download.model.DownloadState +import ca.gosyer.jui.domain.download.model.DownloadStatus +import ca.gosyer.jui.domain.download.service.DownloadService +import ca.gosyer.jui.domain.download.service.DownloadService.Companion.status +import ca.gosyer.jui.domain.server.model.requests.downloadsQuery import ca.gosyer.jui.i18n.MR import dev.icerock.moko.resources.desc.desc import dev.icerock.moko.resources.format diff --git a/android/src/main/kotlin/ca/gosyer/jui/android/data/update/UpdateCheckWorker.kt b/android/src/main/kotlin/ca/gosyer/jui/android/data/update/UpdateCheckWorker.kt index 321cf677..77e7633c 100644 --- a/android/src/main/kotlin/ca/gosyer/jui/android/data/update/UpdateCheckWorker.kt +++ b/android/src/main/kotlin/ca/gosyer/jui/android/data/update/UpdateCheckWorker.kt @@ -18,7 +18,7 @@ import ca.gosyer.jui.android.AppComponent import ca.gosyer.jui.android.data.notification.Notifications import ca.gosyer.jui.android.util.notificationBuilder import ca.gosyer.jui.android.util.notificationManager -import ca.gosyer.jui.domain.update.UpdateChecker.Update +import ca.gosyer.jui.domain.updates.interactor.UpdateChecker.Update import ca.gosyer.jui.i18n.MR import dev.icerock.moko.resources.desc.desc import kotlinx.coroutines.flow.singleOrNull diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/models/Page.kt b/core/src/commonMain/kotlin/ca/gosyer/jui/core/CoreComponent.kt similarity index 57% rename from data/src/commonMain/kotlin/ca/gosyer/jui/data/models/Page.kt rename to core/src/commonMain/kotlin/ca/gosyer/jui/core/CoreComponent.kt index 25942f9c..b889881d 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/models/Page.kt +++ b/core/src/commonMain/kotlin/ca/gosyer/jui/core/CoreComponent.kt @@ -4,12 +4,10 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package ca.gosyer.jui.data.models +package ca.gosyer.jui.core -import kotlinx.serialization.Serializable +import ca.gosyer.jui.core.prefs.PreferenceStoreFactory -@Serializable -data class Page( - val index: Int, - var imageUrl: String, -) +interface CoreComponent { + val preferenceFactory: PreferenceStoreFactory +} diff --git a/data/build.gradle.kts b/data/build.gradle.kts index 53e51214..762d1e0d 100644 --- a/data/build.gradle.kts +++ b/data/build.gradle.kts @@ -38,15 +38,12 @@ kotlin { api(libs.serialization.json) api(libs.kotlinInject.runtime) api(libs.ktor.core) - api(libs.ktor.contentNegotiation) - api(libs.ktor.serialization.json) - api(libs.ktor.auth) - api(libs.ktor.logging) api(libs.ktor.websockets) api(libs.okio) api(libs.dateTime) api(projects.core) api(projects.i18n) + api(projects.domain) } } val commonTest by getting { @@ -59,7 +56,6 @@ kotlin { val desktopMain by getting { dependencies { api(kotlin("stdlib-jdk8")) - api(libs.ktor.okHttp) } } val desktopTest by getting { @@ -68,7 +64,6 @@ kotlin { val androidMain by getting { dependencies { api(kotlin("stdlib-jdk8")) - api(libs.ktor.okHttp) } } val androidTest by getting { diff --git a/data/src/androidMain/kotlin/ca/gosyer/jui/data/DataComponent.kt b/data/src/androidMain/kotlin/ca/gosyer/jui/data/DataComponent.kt deleted file mode 100644 index 8a56c4cb..00000000 --- a/data/src/androidMain/kotlin/ca/gosyer/jui/data/DataComponent.kt +++ /dev/null @@ -1,94 +0,0 @@ -/* - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. - */ - -package ca.gosyer.jui.data - -import ca.gosyer.jui.core.di.AppScope -import ca.gosyer.jui.core.prefs.PreferenceStoreFactory -import ca.gosyer.jui.data.catalog.CatalogPreferences -import ca.gosyer.jui.data.extension.ExtensionPreferences -import ca.gosyer.jui.data.library.LibraryPreferences -import ca.gosyer.jui.data.migration.MigrationPreferences -import ca.gosyer.jui.data.reader.ReaderPreferences -import ca.gosyer.jui.data.server.Http -import ca.gosyer.jui.data.server.HttpProvider -import ca.gosyer.jui.data.server.ServerPreferences -import ca.gosyer.jui.data.ui.UiPreferences -import ca.gosyer.jui.data.update.UpdatePreferences -import me.tatarka.inject.annotations.Provides - -actual interface DataComponent { - val preferenceFactory: PreferenceStoreFactory - - val httpProvider: HttpProvider - - val http: Http - - val serverPreferences: ServerPreferences - - val extensionPreferences: ExtensionPreferences - - val catalogPreferences: CatalogPreferences - - val libraryPreferences: LibraryPreferences - - val readerPreferences: ReaderPreferences - - val uiPreferences: UiPreferences - - val migrationPreferences: MigrationPreferences - - val updatePreferences: UpdatePreferences - - @get:AppScope - @get:Provides - val serverPreferencesFactory: ServerPreferences - get() = ServerPreferences(preferenceFactory.create("server")) - - @get:AppScope - @get:Provides - val extensionPreferencesFactory: ExtensionPreferences - get() = ExtensionPreferences(preferenceFactory.create("extension")) - - @get:AppScope - @get:Provides - val catalogPreferencesFactory: CatalogPreferences - get() = CatalogPreferences(preferenceFactory.create("catalog")) - - @get:AppScope - @get:Provides - val libraryPreferencesFactory: LibraryPreferences - get() = LibraryPreferences(preferenceFactory.create("library")) - - @get:AppScope - @get:Provides - val readerPreferencesFactory: ReaderPreferences - get() = ReaderPreferences(preferenceFactory.create("reader")) { name -> - preferenceFactory.create("reader", name) - } - - @get:AppScope - @get:Provides - val uiPreferencesFactory: UiPreferences - get() = UiPreferences(preferenceFactory.create("ui")) - - @get:AppScope - @get:Provides - val migrationPreferencesFactory: MigrationPreferences - get() = MigrationPreferences(preferenceFactory.create("migration")) - - @get:AppScope - @get:Provides - val updatePreferencesFactory: UpdatePreferences - get() = UpdatePreferences(preferenceFactory.create("update")) - - @get:AppScope - @get:Provides - val httpFactory: Http - get() = httpProvider.get(serverPreferences) - - companion object -} diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/DataComponent.kt b/data/src/commonMain/kotlin/ca/gosyer/jui/data/DataComponent.kt index 8b80dd22..133405e5 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/DataComponent.kt +++ b/data/src/commonMain/kotlin/ca/gosyer/jui/data/DataComponent.kt @@ -6,4 +6,57 @@ package ca.gosyer.jui.data -expect interface DataComponent +import ca.gosyer.jui.data.backup.BackupRepositoryImpl +import ca.gosyer.jui.data.category.CategoryRepositoryImpl +import ca.gosyer.jui.data.chapter.ChapterRepositoryImpl +import ca.gosyer.jui.data.download.DownloadRepositoryImpl +import ca.gosyer.jui.data.extension.ExtensionRepositoryImpl +import ca.gosyer.jui.data.library.LibraryRepositoryImpl +import ca.gosyer.jui.data.manga.MangaRepositoryImpl +import ca.gosyer.jui.data.settings.SettingsRepositoryImpl +import ca.gosyer.jui.data.source.SourceRepositoryImpl +import ca.gosyer.jui.data.updates.UpdatesRepositoryImpl +import ca.gosyer.jui.domain.backup.service.BackupRepository +import ca.gosyer.jui.domain.category.service.CategoryRepository +import ca.gosyer.jui.domain.chapter.service.ChapterRepository +import ca.gosyer.jui.domain.download.service.DownloadRepository +import ca.gosyer.jui.domain.extension.service.ExtensionRepository +import ca.gosyer.jui.domain.library.service.LibraryRepository +import ca.gosyer.jui.domain.manga.service.MangaRepository +import ca.gosyer.jui.domain.settings.service.SettingsRepository +import ca.gosyer.jui.domain.source.service.SourceRepository +import ca.gosyer.jui.domain.updates.service.UpdatesRepository +import me.tatarka.inject.annotations.Provides + +interface DataComponent { + + val BackupRepositoryImpl.bind: BackupRepository + @Provides get() = this + + val CategoryRepositoryImpl.bind: CategoryRepository + @Provides get() = this + + val ChapterRepositoryImpl.bind: ChapterRepository + @Provides get() = this + + val DownloadRepositoryImpl.bind: DownloadRepository + @Provides get() = this + + val ExtensionRepositoryImpl.bind: ExtensionRepository + @Provides get() = this + + val LibraryRepositoryImpl.bind: LibraryRepository + @Provides get() = this + + val MangaRepositoryImpl.bind: MangaRepository + @Provides get() = this + + val SettingsRepositoryImpl.bind: SettingsRepository + @Provides get() = this + + val SourceRepositoryImpl.bind: SourceRepository + @Provides get() = this + + val UpdatesRepositoryImpl.bind: UpdatesRepository + @Provides get() = this +} diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/server/interactions/BackupInteractionHandler.kt b/data/src/commonMain/kotlin/ca/gosyer/jui/data/backup/BackupRepositoryImpl.kt similarity index 70% rename from data/src/commonMain/kotlin/ca/gosyer/jui/data/server/interactions/BackupInteractionHandler.kt rename to data/src/commonMain/kotlin/ca/gosyer/jui/data/backup/BackupRepositoryImpl.kt index d67ea303..38d89b92 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/server/interactions/BackupInteractionHandler.kt +++ b/data/src/commonMain/kotlin/ca/gosyer/jui/data/backup/BackupRepositoryImpl.kt @@ -4,16 +4,18 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package ca.gosyer.jui.data.server.interactions +package ca.gosyer.jui.data.backup import ca.gosyer.jui.core.io.SYSTEM import ca.gosyer.jui.core.lang.IO -import ca.gosyer.jui.data.models.BackupValidationResult -import ca.gosyer.jui.data.server.Http -import ca.gosyer.jui.data.server.ServerPreferences -import ca.gosyer.jui.data.server.requests.backupFileExportRequest -import ca.gosyer.jui.data.server.requests.backupFileImportRequest -import ca.gosyer.jui.data.server.requests.validateBackupFileRequest +import ca.gosyer.jui.data.base.BaseRepository +import ca.gosyer.jui.domain.backup.model.BackupValidationResult +import ca.gosyer.jui.domain.backup.service.BackupRepository +import ca.gosyer.jui.domain.server.Http +import ca.gosyer.jui.domain.server.model.requests.backupFileExportRequest +import ca.gosyer.jui.domain.server.model.requests.backupFileImportRequest +import ca.gosyer.jui.domain.server.model.requests.validateBackupFileRequest +import ca.gosyer.jui.domain.server.service.ServerPreferences import io.ktor.client.call.body import io.ktor.client.plugins.expectSuccess import io.ktor.client.request.HttpRequestBuilder @@ -32,10 +34,10 @@ import okio.FileSystem import okio.Path import okio.buffer -class BackupInteractionHandler @Inject constructor( +class BackupRepositoryImpl @Inject constructor( client: Http, serverPreferences: ServerPreferences -) : BaseInteractionHandler(client, serverPreferences) { +) : BaseRepository(client, serverPreferences), BackupRepository { private fun buildFormData(file: Path) = formData { append( @@ -47,7 +49,7 @@ class BackupInteractionHandler @Inject constructor( ) } - fun importBackupFile(file: Path, block: HttpRequestBuilder.() -> Unit = {}) = flow { + override fun importBackupFile(file: Path, block: HttpRequestBuilder.() -> Unit) = flow { val response = client.submitFormWithBinaryData( buildUrl { path(backupFileImportRequest()) }, formData = buildFormData(file) @@ -58,7 +60,7 @@ class BackupInteractionHandler @Inject constructor( emit(response) }.flowOn(Dispatchers.IO) - fun validateBackupFile(file: Path, block: HttpRequestBuilder.() -> Unit = {}) = flow { + override fun validateBackupFile(file: Path, block: HttpRequestBuilder.() -> Unit) = flow { val response = client.submitFormWithBinaryData( buildUrl { path(validateBackupFileRequest()) }, formData = buildFormData(file) @@ -69,7 +71,7 @@ class BackupInteractionHandler @Inject constructor( emit(response) }.flowOn(Dispatchers.IO) - fun exportBackupFile(block: HttpRequestBuilder.() -> Unit = {}) = flow { + override fun exportBackupFile(block: HttpRequestBuilder.() -> Unit) = flow { val response = client.get( buildUrl { path(backupFileExportRequest()) }, ) { diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/server/interactions/BaseInteractionHandler.kt b/data/src/commonMain/kotlin/ca/gosyer/jui/data/base/BaseRepository.kt similarity index 79% rename from data/src/commonMain/kotlin/ca/gosyer/jui/data/server/interactions/BaseInteractionHandler.kt rename to data/src/commonMain/kotlin/ca/gosyer/jui/data/base/BaseRepository.kt index 5bc12622..88f4955a 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/server/interactions/BaseInteractionHandler.kt +++ b/data/src/commonMain/kotlin/ca/gosyer/jui/data/base/BaseRepository.kt @@ -4,13 +4,13 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package ca.gosyer.jui.data.server.interactions +package ca.gosyer.jui.data.base -import ca.gosyer.jui.data.server.Http -import ca.gosyer.jui.data.server.ServerPreferences +import ca.gosyer.jui.domain.server.Http +import ca.gosyer.jui.domain.server.service.ServerPreferences import io.ktor.http.URLBuilder -open class BaseInteractionHandler( +open class BaseRepository( protected val client: Http, serverPreferences: ServerPreferences ) { diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/server/interactions/CategoryInteractionHandler.kt b/data/src/commonMain/kotlin/ca/gosyer/jui/data/category/CategoryRepositoryImpl.kt similarity index 58% rename from data/src/commonMain/kotlin/ca/gosyer/jui/data/server/interactions/CategoryInteractionHandler.kt rename to data/src/commonMain/kotlin/ca/gosyer/jui/data/category/CategoryRepositoryImpl.kt index 315f804c..1a2a504f 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/server/interactions/CategoryInteractionHandler.kt +++ b/data/src/commonMain/kotlin/ca/gosyer/jui/data/category/CategoryRepositoryImpl.kt @@ -4,22 +4,24 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package ca.gosyer.jui.data.server.interactions +package ca.gosyer.jui.data.category import ca.gosyer.jui.core.lang.IO -import ca.gosyer.jui.data.models.Category -import ca.gosyer.jui.data.models.Manga -import ca.gosyer.jui.data.server.Http -import ca.gosyer.jui.data.server.ServerPreferences -import ca.gosyer.jui.data.server.requests.addMangaToCategoryQuery -import ca.gosyer.jui.data.server.requests.categoryDeleteRequest -import ca.gosyer.jui.data.server.requests.categoryModifyRequest -import ca.gosyer.jui.data.server.requests.categoryReorderRequest -import ca.gosyer.jui.data.server.requests.createCategoryRequest -import ca.gosyer.jui.data.server.requests.getCategoriesQuery -import ca.gosyer.jui.data.server.requests.getMangaCategoriesQuery -import ca.gosyer.jui.data.server.requests.getMangaInCategoryQuery -import ca.gosyer.jui.data.server.requests.removeMangaFromCategoryRequest +import ca.gosyer.jui.data.base.BaseRepository +import ca.gosyer.jui.domain.category.model.Category +import ca.gosyer.jui.domain.category.service.CategoryRepository +import ca.gosyer.jui.domain.manga.model.Manga +import ca.gosyer.jui.domain.server.Http +import ca.gosyer.jui.domain.server.model.requests.addMangaToCategoryQuery +import ca.gosyer.jui.domain.server.model.requests.categoryDeleteRequest +import ca.gosyer.jui.domain.server.model.requests.categoryModifyRequest +import ca.gosyer.jui.domain.server.model.requests.categoryReorderRequest +import ca.gosyer.jui.domain.server.model.requests.createCategoryRequest +import ca.gosyer.jui.domain.server.model.requests.getCategoriesQuery +import ca.gosyer.jui.domain.server.model.requests.getMangaCategoriesQuery +import ca.gosyer.jui.domain.server.model.requests.getMangaInCategoryQuery +import ca.gosyer.jui.domain.server.model.requests.removeMangaFromCategoryRequest +import ca.gosyer.jui.domain.server.service.ServerPreferences import io.ktor.client.call.body import io.ktor.client.plugins.expectSuccess import io.ktor.client.request.delete @@ -33,12 +35,12 @@ import kotlinx.coroutines.flow.flow import kotlinx.coroutines.flow.flowOn import me.tatarka.inject.annotations.Inject -class CategoryInteractionHandler @Inject constructor( +class CategoryRepositoryImpl @Inject constructor( client: Http, serverPreferences: ServerPreferences -) : BaseInteractionHandler(client, serverPreferences) { +) : BaseRepository(client, serverPreferences), CategoryRepository { - fun getMangaCategories(mangaId: Long) = flow { + override fun getMangaCategories(mangaId: Long) = flow { val response = client.get( buildUrl { path(getMangaCategoriesQuery(mangaId)) }, ) { @@ -47,9 +49,7 @@ class CategoryInteractionHandler @Inject constructor( emit(response) }.flowOn(Dispatchers.IO) - fun getMangaCategories(manga: Manga) = getMangaCategories(manga.id) - - fun addMangaToCategory(mangaId: Long, categoryId: Long) = flow { + override fun addMangaToCategory(mangaId: Long, categoryId: Long) = flow { val response = client.get( buildUrl { path(addMangaToCategoryQuery(mangaId, categoryId)) } ) { @@ -57,11 +57,8 @@ class CategoryInteractionHandler @Inject constructor( } emit(response) }.flowOn(Dispatchers.IO) - fun addMangaToCategory(manga: Manga, category: Category) = addMangaToCategory(manga.id, category.id) - fun addMangaToCategory(manga: Manga, categoryId: Long) = addMangaToCategory(manga.id, categoryId) - fun addMangaToCategory(mangaId: Long, category: Category) = addMangaToCategory(mangaId, category.id) - fun removeMangaFromCategory(mangaId: Long, categoryId: Long) = flow { + override fun removeMangaFromCategory(mangaId: Long, categoryId: Long) = flow { val response = client.delete( buildUrl { path(removeMangaFromCategoryRequest(mangaId, categoryId)) } ) { @@ -69,11 +66,8 @@ class CategoryInteractionHandler @Inject constructor( } emit(response) }.flowOn(Dispatchers.IO) - fun removeMangaFromCategory(manga: Manga, category: Category) = removeMangaFromCategory(manga.id, category.id) - fun removeMangaFromCategory(manga: Manga, categoryId: Long) = removeMangaFromCategory(manga.id, categoryId) - fun removeMangaFromCategory(mangaId: Long, category: Category) = removeMangaFromCategory(mangaId, category.id) - fun getCategories(dropDefault: Boolean = false) = flow { + override fun getCategories(dropDefault: Boolean) = flow { val response = client.get( buildUrl { path(getCategoriesQuery()) }, ) { @@ -86,7 +80,7 @@ class CategoryInteractionHandler @Inject constructor( emit(response) }.flowOn(Dispatchers.IO) - fun createCategory(name: String) = flow { + override fun createCategory(name: String) = flow { val response = client.submitForm( buildUrl { path(createCategoryRequest()) }, formParameters = Parameters.build { @@ -98,7 +92,7 @@ class CategoryInteractionHandler @Inject constructor( emit(response) }.flowOn(Dispatchers.IO) - fun modifyCategory(categoryId: Long, name: String? = null, isLanding: Boolean? = null) = flow { + override fun modifyCategory(categoryId: Long, name: String?, isLanding: Boolean?) = flow { val response = client.submitForm( buildUrl { path(categoryModifyRequest(categoryId)) }, formParameters = Parameters.build { @@ -115,9 +109,8 @@ class CategoryInteractionHandler @Inject constructor( } emit(response) }.flowOn(Dispatchers.IO) - fun modifyCategory(category: Category, name: String? = null, isLanding: Boolean? = null) = modifyCategory(category.id, name, isLanding) - fun reorderCategory(to: Int, from: Int) = flow { + override fun reorderCategory(to: Int, from: Int) = flow { val response = client.submitForm( buildUrl { path(categoryReorderRequest()) }, formParameters = Parameters.build { @@ -131,7 +124,7 @@ class CategoryInteractionHandler @Inject constructor( emit(response) }.flowOn(Dispatchers.IO) - fun deleteCategory(categoryId: Long) = flow { + override fun deleteCategory(categoryId: Long) = flow { val response = client.delete( buildUrl { path(categoryDeleteRequest(categoryId)) }, ) { @@ -139,9 +132,8 @@ class CategoryInteractionHandler @Inject constructor( } emit(response) }.flowOn(Dispatchers.IO) - fun deleteCategory(category: Category) = deleteCategory(category.id) - fun getMangaFromCategory(categoryId: Long) = flow { + override fun getMangaFromCategory(categoryId: Long) = flow { val response = client.get( buildUrl { path(getMangaInCategoryQuery(categoryId)) }, ) { @@ -149,5 +141,4 @@ class CategoryInteractionHandler @Inject constructor( }.body>() emit(response) }.flowOn(Dispatchers.IO) - fun getMangaFromCategory(category: Category) = getMangaFromCategory(category.id) } 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 new file mode 100644 index 00000000..f6bfda7a --- /dev/null +++ b/data/src/commonMain/kotlin/ca/gosyer/jui/data/chapter/ChapterRepositoryImpl.kt @@ -0,0 +1,146 @@ +/* + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +package ca.gosyer.jui.data.chapter + +import ca.gosyer.jui.core.lang.IO +import ca.gosyer.jui.data.base.BaseRepository +import ca.gosyer.jui.domain.chapter.model.Chapter +import ca.gosyer.jui.domain.chapter.service.ChapterRepository +import ca.gosyer.jui.domain.server.Http +import ca.gosyer.jui.domain.server.model.requests.deleteDownloadedChapterRequest +import ca.gosyer.jui.domain.server.model.requests.getChapterQuery +import ca.gosyer.jui.domain.server.model.requests.getMangaChaptersQuery +import ca.gosyer.jui.domain.server.model.requests.getPageQuery +import ca.gosyer.jui.domain.server.model.requests.queueDownloadChapterRequest +import ca.gosyer.jui.domain.server.model.requests.stopDownloadingChapterRequest +import ca.gosyer.jui.domain.server.model.requests.updateChapterMetaRequest +import ca.gosyer.jui.domain.server.model.requests.updateChapterRequest +import ca.gosyer.jui.domain.server.service.ServerPreferences +import io.ktor.client.call.body +import io.ktor.client.plugins.expectSuccess +import io.ktor.client.request.HttpRequestBuilder +import io.ktor.client.request.delete +import io.ktor.client.request.forms.submitForm +import io.ktor.client.request.get +import io.ktor.http.HttpMethod +import io.ktor.http.Parameters +import io.ktor.http.path +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.flow.flow +import kotlinx.coroutines.flow.flowOn +import me.tatarka.inject.annotations.Inject + +class ChapterRepositoryImpl @Inject constructor( + client: Http, + serverPreferences: ServerPreferences +) : BaseRepository(client, serverPreferences), ChapterRepository { + + override fun getChapters(mangaId: Long, refresh: Boolean) = flow { + val response = client.get( + buildUrl { + path(getMangaChaptersQuery(mangaId)) + if (refresh) { + parameter("onlineFetch", true) + } + } + ) { + expectSuccess = true + }.body>() + emit(response) + }.flowOn(Dispatchers.IO) + + override fun getChapter(mangaId: Long, chapterIndex: Int) = flow { + val response = client.get( + buildUrl { path(getChapterQuery(mangaId, chapterIndex)) } + ) { + expectSuccess = true + }.body() + emit(response) + }.flowOn(Dispatchers.IO) + + override fun updateChapter( + mangaId: Long, + chapterIndex: Int, + read: Boolean?, + bookmarked: Boolean?, + lastPageRead: Int?, + markPreviousRead: Boolean? + ) = flow { + val response = client.submitForm( + buildUrl { path(updateChapterRequest(mangaId, chapterIndex)) }, + formParameters = Parameters.build { + if (read != null) { + append("read", read.toString()) + } + if (bookmarked != null) { + append("bookmarked", bookmarked.toString()) + } + if (lastPageRead != null) { + append("lastPageRead", lastPageRead.toString()) + } + if (markPreviousRead != null) { + append("markPrevRead", markPreviousRead.toString()) + } + } + ) { + method = HttpMethod.Patch + expectSuccess = true + } + emit(response) + }.flowOn(Dispatchers.IO) + + override fun getPage(mangaId: Long, chapterIndex: Int, pageNum: Int, block: HttpRequestBuilder.() -> Unit) = flow { + val response = client.get( + buildUrl { path(getPageQuery(mangaId, chapterIndex, pageNum)) } + ) { + expectSuccess = true + block() + } + emit(response) + }.flowOn(Dispatchers.IO) + + override fun deleteChapterDownload(mangaId: Long, chapterIndex: Int) = flow { + val response = client.delete( + buildUrl { path(deleteDownloadedChapterRequest(mangaId, chapterIndex)) } + ) { + expectSuccess = true + } + emit(response) + }.flowOn(Dispatchers.IO) + + override fun queueChapterDownload(mangaId: Long, chapterIndex: Int) = flow { + val response = client.get( + buildUrl { path(queueDownloadChapterRequest(mangaId, chapterIndex)) } + ) { + expectSuccess = true + } + emit(response) + }.flowOn(Dispatchers.IO) + + override fun stopChapterDownload(mangaId: Long, chapterIndex: Int) = flow { + val response = client.delete( + buildUrl { path(stopDownloadingChapterRequest(mangaId, chapterIndex)) } + ) { + expectSuccess = true + } + emit(response) + }.flowOn(Dispatchers.IO) + + override fun updateChapterMeta(mangaId: Long, chapterIndex: Int, key: String, value: String) = flow { + val response = client.submitForm( + buildUrl { path(updateChapterMetaRequest(mangaId, chapterIndex)) }, + formParameters = Parameters.build { + append("key", key) + append("value", value) + } + ) { + method = HttpMethod.Patch + expectSuccess = true + } + emit(response) + }.flowOn(Dispatchers.IO) +} diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/server/interactions/DownloadInteractionHandler.kt b/data/src/commonMain/kotlin/ca/gosyer/jui/data/download/DownloadRepositoryImpl.kt similarity index 61% rename from data/src/commonMain/kotlin/ca/gosyer/jui/data/server/interactions/DownloadInteractionHandler.kt rename to data/src/commonMain/kotlin/ca/gosyer/jui/data/download/DownloadRepositoryImpl.kt index a7d24a4a..5bca7875 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/server/interactions/DownloadInteractionHandler.kt +++ b/data/src/commonMain/kotlin/ca/gosyer/jui/data/download/DownloadRepositoryImpl.kt @@ -4,14 +4,16 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package ca.gosyer.jui.data.server.interactions +package ca.gosyer.jui.data.download import ca.gosyer.jui.core.lang.IO -import ca.gosyer.jui.data.server.Http -import ca.gosyer.jui.data.server.ServerPreferences -import ca.gosyer.jui.data.server.requests.downloadsClearRequest -import ca.gosyer.jui.data.server.requests.downloadsStartRequest -import ca.gosyer.jui.data.server.requests.downloadsStopRequest +import ca.gosyer.jui.data.base.BaseRepository +import ca.gosyer.jui.domain.download.service.DownloadRepository +import ca.gosyer.jui.domain.server.Http +import ca.gosyer.jui.domain.server.model.requests.downloadsClearRequest +import ca.gosyer.jui.domain.server.model.requests.downloadsStartRequest +import ca.gosyer.jui.domain.server.model.requests.downloadsStopRequest +import ca.gosyer.jui.domain.server.service.ServerPreferences import io.ktor.client.plugins.expectSuccess import io.ktor.client.request.get import io.ktor.http.path @@ -20,12 +22,12 @@ import kotlinx.coroutines.flow.flow import kotlinx.coroutines.flow.flowOn import me.tatarka.inject.annotations.Inject -class DownloadInteractionHandler @Inject constructor( +class DownloadRepositoryImpl @Inject constructor( client: Http, serverPreferences: ServerPreferences -) : BaseInteractionHandler(client, serverPreferences) { +) : BaseRepository(client, serverPreferences), DownloadRepository { - fun startDownloading() = flow { + override fun startDownloading() = flow { val response = client.get( buildUrl { path(downloadsStartRequest()) }, ) { @@ -34,7 +36,7 @@ class DownloadInteractionHandler @Inject constructor( emit(response) }.flowOn(Dispatchers.IO) - fun stopDownloading() = flow { + override fun stopDownloading() = flow { val response = client.get( buildUrl { path(downloadsStopRequest()) }, ) { @@ -43,7 +45,7 @@ class DownloadInteractionHandler @Inject constructor( emit(response) }.flowOn(Dispatchers.IO) - fun clearDownloadQueue() = flow { + override fun clearDownloadQueue() = flow { val response = client.get( buildUrl { path(downloadsClearRequest()) }, ) { diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/server/interactions/ExtensionInteractionHandler.kt b/data/src/commonMain/kotlin/ca/gosyer/jui/data/extension/ExtensionRepositoryImpl.kt similarity index 62% rename from data/src/commonMain/kotlin/ca/gosyer/jui/data/server/interactions/ExtensionInteractionHandler.kt rename to data/src/commonMain/kotlin/ca/gosyer/jui/data/extension/ExtensionRepositoryImpl.kt index 88f7d3e1..64ab3f7c 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/server/interactions/ExtensionInteractionHandler.kt +++ b/data/src/commonMain/kotlin/ca/gosyer/jui/data/extension/ExtensionRepositoryImpl.kt @@ -4,17 +4,19 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package ca.gosyer.jui.data.server.interactions +package ca.gosyer.jui.data.extension import ca.gosyer.jui.core.lang.IO -import ca.gosyer.jui.data.models.Extension -import ca.gosyer.jui.data.server.Http -import ca.gosyer.jui.data.server.ServerPreferences -import ca.gosyer.jui.data.server.requests.apkIconQuery -import ca.gosyer.jui.data.server.requests.apkInstallQuery -import ca.gosyer.jui.data.server.requests.apkUninstallQuery -import ca.gosyer.jui.data.server.requests.apkUpdateQuery -import ca.gosyer.jui.data.server.requests.extensionListQuery +import ca.gosyer.jui.data.base.BaseRepository +import ca.gosyer.jui.domain.extension.model.Extension +import ca.gosyer.jui.domain.extension.service.ExtensionRepository +import ca.gosyer.jui.domain.server.Http +import ca.gosyer.jui.domain.server.model.requests.apkIconQuery +import ca.gosyer.jui.domain.server.model.requests.apkInstallQuery +import ca.gosyer.jui.domain.server.model.requests.apkUninstallQuery +import ca.gosyer.jui.domain.server.model.requests.apkUpdateQuery +import ca.gosyer.jui.domain.server.model.requests.extensionListQuery +import ca.gosyer.jui.domain.server.service.ServerPreferences import io.ktor.client.call.body import io.ktor.client.plugins.expectSuccess import io.ktor.client.request.HttpRequestBuilder @@ -26,12 +28,12 @@ import kotlinx.coroutines.flow.flow import kotlinx.coroutines.flow.flowOn import me.tatarka.inject.annotations.Inject -class ExtensionInteractionHandler @Inject constructor( +class ExtensionRepositoryImpl @Inject constructor( client: Http, serverPreferences: ServerPreferences -) : BaseInteractionHandler(client, serverPreferences) { +) : BaseRepository(client, serverPreferences), ExtensionRepository { - fun getExtensionList() = flow { + override fun getExtensionList() = flow { val response = client.get( buildUrl { path(extensionListQuery()) }, ) { @@ -40,7 +42,7 @@ class ExtensionInteractionHandler @Inject constructor( emit(response) }.flowOn(Dispatchers.IO) - fun installExtension(extension: Extension) = flow { + override fun installExtension(extension: Extension) = flow { val response = client.get( buildUrl { path(apkInstallQuery(extension.pkgName)) }, ) { @@ -49,7 +51,7 @@ class ExtensionInteractionHandler @Inject constructor( emit(response) }.flowOn(Dispatchers.IO) - fun updateExtension(extension: Extension) = flow { + override fun updateExtension(extension: Extension) = flow { val response = client.get( buildUrl { path(apkUpdateQuery(extension.pkgName)) }, ) { @@ -58,7 +60,7 @@ class ExtensionInteractionHandler @Inject constructor( emit(response) }.flowOn(Dispatchers.IO) - fun uninstallExtension(extension: Extension) = flow { + override fun uninstallExtension(extension: Extension) = flow { val response = client.get( buildUrl { path(apkUninstallQuery(extension.pkgName)) }, ) { @@ -67,7 +69,7 @@ class ExtensionInteractionHandler @Inject constructor( emit(response) }.flowOn(Dispatchers.IO) - fun getApkIcon(extension: Extension, block: HttpRequestBuilder.() -> Unit) = flow { + override fun getApkIcon(extension: Extension, block: HttpRequestBuilder.() -> Unit) = flow { val response = client.get( buildUrl { path(apkIconQuery(extension.apkName)) }, ) { diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/server/interactions/LibraryInteractionHandler.kt b/data/src/commonMain/kotlin/ca/gosyer/jui/data/library/LibraryRepositoryImpl.kt similarity index 60% rename from data/src/commonMain/kotlin/ca/gosyer/jui/data/server/interactions/LibraryInteractionHandler.kt rename to data/src/commonMain/kotlin/ca/gosyer/jui/data/library/LibraryRepositoryImpl.kt index ad3f3e50..50576ed7 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/server/interactions/LibraryInteractionHandler.kt +++ b/data/src/commonMain/kotlin/ca/gosyer/jui/data/library/LibraryRepositoryImpl.kt @@ -4,14 +4,15 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package ca.gosyer.jui.data.server.interactions +package ca.gosyer.jui.data.library import ca.gosyer.jui.core.lang.IO -import ca.gosyer.jui.data.models.Manga -import ca.gosyer.jui.data.server.Http -import ca.gosyer.jui.data.server.ServerPreferences -import ca.gosyer.jui.data.server.requests.addMangaToLibraryQuery -import ca.gosyer.jui.data.server.requests.removeMangaFromLibraryRequest +import ca.gosyer.jui.data.base.BaseRepository +import ca.gosyer.jui.domain.library.service.LibraryRepository +import ca.gosyer.jui.domain.server.Http +import ca.gosyer.jui.domain.server.model.requests.addMangaToLibraryQuery +import ca.gosyer.jui.domain.server.model.requests.removeMangaFromLibraryRequest +import ca.gosyer.jui.domain.server.service.ServerPreferences import io.ktor.client.plugins.expectSuccess import io.ktor.client.request.delete import io.ktor.client.request.get @@ -21,12 +22,12 @@ import kotlinx.coroutines.flow.flow import kotlinx.coroutines.flow.flowOn import me.tatarka.inject.annotations.Inject -class LibraryInteractionHandler @Inject constructor( +class LibraryRepositoryImpl @Inject constructor( client: Http, serverPreferences: ServerPreferences -) : BaseInteractionHandler(client, serverPreferences) { +) : BaseRepository(client, serverPreferences), LibraryRepository { - fun addMangaToLibrary(mangaId: Long) = flow { + override fun addMangaToLibrary(mangaId: Long) = flow { val response = client.get( buildUrl { path(addMangaToLibraryQuery(mangaId)) }, ) { @@ -35,9 +36,7 @@ class LibraryInteractionHandler @Inject constructor( emit(response) }.flowOn(Dispatchers.IO) - fun addMangaToLibrary(manga: Manga) = addMangaToLibrary(manga.id) - - fun removeMangaFromLibrary(mangaId: Long) = flow { + override fun removeMangaFromLibrary(mangaId: Long) = flow { val response = client.delete( buildUrl { path(removeMangaFromLibraryRequest(mangaId)) }, ) { @@ -45,6 +44,4 @@ class LibraryInteractionHandler @Inject constructor( } emit(response) }.flowOn(Dispatchers.IO) - - fun removeMangaFromLibrary(manga: Manga) = removeMangaFromLibrary(manga.id) } diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/server/interactions/MangaInteractionHandler.kt b/data/src/commonMain/kotlin/ca/gosyer/jui/data/manga/MangaRepositoryImpl.kt similarity index 66% rename from data/src/commonMain/kotlin/ca/gosyer/jui/data/server/interactions/MangaInteractionHandler.kt rename to data/src/commonMain/kotlin/ca/gosyer/jui/data/manga/MangaRepositoryImpl.kt index 8892a170..6bbdad78 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/server/interactions/MangaInteractionHandler.kt +++ b/data/src/commonMain/kotlin/ca/gosyer/jui/data/manga/MangaRepositoryImpl.kt @@ -4,15 +4,17 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package ca.gosyer.jui.data.server.interactions +package ca.gosyer.jui.data.manga import ca.gosyer.jui.core.lang.IO -import ca.gosyer.jui.data.models.Manga -import ca.gosyer.jui.data.server.Http -import ca.gosyer.jui.data.server.ServerPreferences -import ca.gosyer.jui.data.server.requests.mangaQuery -import ca.gosyer.jui.data.server.requests.mangaThumbnailQuery -import ca.gosyer.jui.data.server.requests.updateMangaMetaRequest +import ca.gosyer.jui.data.base.BaseRepository +import ca.gosyer.jui.domain.manga.model.Manga +import ca.gosyer.jui.domain.manga.service.MangaRepository +import ca.gosyer.jui.domain.server.Http +import ca.gosyer.jui.domain.server.model.requests.mangaQuery +import ca.gosyer.jui.domain.server.model.requests.mangaThumbnailQuery +import ca.gosyer.jui.domain.server.model.requests.updateMangaMetaRequest +import ca.gosyer.jui.domain.server.service.ServerPreferences import io.ktor.client.call.body import io.ktor.client.plugins.expectSuccess import io.ktor.client.request.HttpRequestBuilder @@ -27,12 +29,12 @@ import kotlinx.coroutines.flow.flow import kotlinx.coroutines.flow.flowOn import me.tatarka.inject.annotations.Inject -class MangaInteractionHandler @Inject constructor( +class MangaRepositoryImpl @Inject constructor( client: Http, serverPreferences: ServerPreferences -) : BaseInteractionHandler(client, serverPreferences) { +) : BaseRepository(client, serverPreferences), MangaRepository { - fun getManga(mangaId: Long, refresh: Boolean = false) = flow { + override fun getManga(mangaId: Long, refresh: Boolean) = flow { val response = client.get( buildUrl { path(mangaQuery(mangaId)) @@ -46,9 +48,7 @@ class MangaInteractionHandler @Inject constructor( emit(response) }.flowOn(Dispatchers.IO) - fun getManga(manga: Manga, refresh: Boolean = false) = getManga(manga.id, refresh) - - fun getMangaThumbnail(mangaId: Long, block: HttpRequestBuilder.() -> Unit) = flow { + override fun getMangaThumbnail(mangaId: Long, block: HttpRequestBuilder.() -> Unit) = flow { val response = client.get( buildUrl { path(mangaThumbnailQuery(mangaId)) }, ) { @@ -58,7 +58,7 @@ class MangaInteractionHandler @Inject constructor( emit(response) }.flowOn(Dispatchers.IO) - fun updateMangaMeta(mangaId: Long, key: String, value: String) = flow { + override fun updateMangaMeta(mangaId: Long, key: String, value: String) = flow { val response = client.submitForm( buildUrl { path(updateMangaMetaRequest(mangaId),) }, formParameters = Parameters.build { @@ -71,6 +71,4 @@ class MangaInteractionHandler @Inject constructor( } emit(response) }.flowOn(Dispatchers.IO) - - fun updateMangaMeta(manga: Manga, key: String, value: String) = updateMangaMeta(manga.id, key, value) } diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/server/interactions/ChapterInteractionHandler.kt b/data/src/commonMain/kotlin/ca/gosyer/jui/data/server/interactions/ChapterInteractionHandler.kt deleted file mode 100644 index 9b79d585..00000000 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/server/interactions/ChapterInteractionHandler.kt +++ /dev/null @@ -1,215 +0,0 @@ -/* - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. - */ - -package ca.gosyer.jui.data.server.interactions - -import ca.gosyer.jui.core.lang.IO -import ca.gosyer.jui.data.models.Chapter -import ca.gosyer.jui.data.models.Manga -import ca.gosyer.jui.data.server.Http -import ca.gosyer.jui.data.server.ServerPreferences -import ca.gosyer.jui.data.server.requests.deleteDownloadedChapterRequest -import ca.gosyer.jui.data.server.requests.getChapterQuery -import ca.gosyer.jui.data.server.requests.getMangaChaptersQuery -import ca.gosyer.jui.data.server.requests.getPageQuery -import ca.gosyer.jui.data.server.requests.queueDownloadChapterRequest -import ca.gosyer.jui.data.server.requests.stopDownloadingChapterRequest -import ca.gosyer.jui.data.server.requests.updateChapterMetaRequest -import ca.gosyer.jui.data.server.requests.updateChapterRequest -import io.ktor.client.call.body -import io.ktor.client.plugins.expectSuccess -import io.ktor.client.request.HttpRequestBuilder -import io.ktor.client.request.delete -import io.ktor.client.request.forms.submitForm -import io.ktor.client.request.get -import io.ktor.http.HttpMethod -import io.ktor.http.Parameters -import io.ktor.http.path -import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.flow.flow -import kotlinx.coroutines.flow.flowOn -import me.tatarka.inject.annotations.Inject - -class ChapterInteractionHandler @Inject constructor( - client: Http, - serverPreferences: ServerPreferences -) : BaseInteractionHandler(client, serverPreferences) { - - fun getChapters(mangaId: Long, refresh: Boolean = false) = flow { - val response = client.get( - buildUrl { - path(getMangaChaptersQuery(mangaId)) - if (refresh) { - parameter("onlineFetch", true) - } - } - ) { - expectSuccess = true - }.body>() - emit(response) - }.flowOn(Dispatchers.IO) - - fun getChapters(manga: Manga, refresh: Boolean = false) = getChapters(manga.id, refresh) - - fun getChapter(mangaId: Long, chapterIndex: Int) = flow { - val response = client.get( - buildUrl { path(getChapterQuery(mangaId, chapterIndex)) } - ) { - expectSuccess = true - }.body() - emit(response) - }.flowOn(Dispatchers.IO) - - fun getChapter(chapter: Chapter) = getChapter(chapter.mangaId, chapter.index) - - fun getChapter(manga: Manga, chapterIndex: Int) = getChapter(manga.id, chapterIndex) - - fun getChapter(manga: Manga, chapter: Chapter) = getChapter(manga.id, chapter.index) - - fun updateChapter( - mangaId: Long, - chapterIndex: Int, - read: Boolean? = null, - bookmarked: Boolean? = null, - lastPageRead: Int? = null, - markPreviousRead: Boolean? = null - ) = flow { - val response = client.submitForm( - buildUrl { path(updateChapterRequest(mangaId, chapterIndex)) }, - formParameters = Parameters.build { - if (read != null) { - append("read", read.toString()) - } - if (bookmarked != null) { - append("bookmarked", bookmarked.toString()) - } - if (lastPageRead != null) { - append("lastPageRead", lastPageRead.toString()) - } - if (markPreviousRead != null) { - append("markPrevRead", markPreviousRead.toString()) - } - } - ) { - method = HttpMethod.Patch - expectSuccess = true - } - emit(response) - }.flowOn(Dispatchers.IO) - - fun updateChapter( - manga: Manga, - chapterIndex: Int, - read: Boolean? = null, - bookmarked: Boolean? = null, - lastPageRead: Int? = null, - markPreviousRead: Boolean? = null - ) = updateChapter( - manga.id, - chapterIndex, - read, - bookmarked, - lastPageRead, - markPreviousRead - ) - - fun updateChapter( - manga: Manga, - chapter: Chapter, - read: Boolean? = null, - bookmarked: Boolean? = null, - lastPageRead: Int? = null, - markPreviousRead: Boolean? = null - ) = updateChapter( - manga.id, - chapter.index, - read, - bookmarked, - lastPageRead, - markPreviousRead - ) - - fun getPage(mangaId: Long, chapterIndex: Int, pageNum: Int, block: HttpRequestBuilder.() -> Unit) = flow { - val response = client.get( - buildUrl { path(getPageQuery(mangaId, chapterIndex, pageNum)) } - ) { - expectSuccess = true - block() - } - emit(response) - }.flowOn(Dispatchers.IO) - - fun getPage(chapter: Chapter, pageNum: Int, block: HttpRequestBuilder.() -> Unit) = getPage(chapter.mangaId, chapter.index, pageNum, block) - - fun getPage(manga: Manga, chapterIndex: Int, pageNum: Int, block: HttpRequestBuilder.() -> Unit) = getPage(manga.id, chapterIndex, pageNum, block) - - fun getPage(manga: Manga, chapter: Chapter, pageNum: Int, block: HttpRequestBuilder.() -> Unit) = getPage(manga.id, chapter.index, pageNum, block) - - fun deleteChapterDownload(mangaId: Long, chapterIndex: Int) = flow { - val response = client.delete( - buildUrl { path(deleteDownloadedChapterRequest(mangaId, chapterIndex)) } - ) { - expectSuccess = true - } - emit(response) - }.flowOn(Dispatchers.IO) - - fun deleteChapterDownload(chapter: Chapter) = deleteChapterDownload(chapter.mangaId, chapter.index) - - fun deleteChapterDownload(manga: Manga, chapterIndex: Int) = deleteChapterDownload(manga.id, chapterIndex) - - fun deleteChapterDownload(manga: Manga, chapter: Chapter) = deleteChapterDownload(manga.id, chapter.index) - - fun queueChapterDownload(mangaId: Long, chapterIndex: Int) = flow { - val response = client.get( - buildUrl { path(queueDownloadChapterRequest(mangaId, chapterIndex)) } - ) { - expectSuccess = true - } - emit(response) - }.flowOn(Dispatchers.IO) - - fun queueChapterDownload(chapter: Chapter) = queueChapterDownload(chapter.mangaId, chapter.index) - - fun queueChapterDownload(manga: Manga, chapterIndex: Int) = queueChapterDownload(manga.id, chapterIndex) - - fun queueChapterDownload(manga: Manga, chapter: Chapter) = queueChapterDownload(manga.id, chapter.index) - - fun stopChapterDownload(mangaId: Long, chapterIndex: Int) = flow { - val response = client.delete( - buildUrl { path(stopDownloadingChapterRequest(mangaId, chapterIndex)) } - ) { - expectSuccess = true - } - emit(response) - }.flowOn(Dispatchers.IO) - - fun stopChapterDownload(chapter: Chapter) = stopChapterDownload(chapter.mangaId, chapter.index) - - fun stopChapterDownload(manga: Manga, chapterIndex: Int) = stopChapterDownload(manga.id, chapterIndex) - - fun stopChapterDownload(manga: Manga, chapter: Chapter) = stopChapterDownload(manga.id, chapter.index) - - fun updateChapterMeta(mangaId: Long, chapterIndex: Int, key: String, value: String) = flow { - val response = client.submitForm( - buildUrl { path(updateChapterMetaRequest(mangaId, chapterIndex)) }, - formParameters = Parameters.build { - append("key", key) - append("value", value) - } - ) { - method = HttpMethod.Patch - expectSuccess = true - } - emit(response) - }.flowOn(Dispatchers.IO) - - fun updateChapterMeta(chapter: Chapter, key: String, value: String) = updateChapterMeta(chapter.mangaId, chapter.index, key, value) - - fun updateChapterMeta(manga: Manga, chapterIndex: Int, key: String, value: String) = updateChapterMeta(manga.id, chapterIndex, key, value) - - fun updateChapterMeta(manga: Manga, chapter: Chapter, key: String, value: String) = updateChapterMeta(manga.id, chapter.index, key, value) -} diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/server/interactions/SettingsInteractionHandler.kt b/data/src/commonMain/kotlin/ca/gosyer/jui/data/settings/SettingsRepositoryImpl.kt similarity index 62% rename from data/src/commonMain/kotlin/ca/gosyer/jui/data/server/interactions/SettingsInteractionHandler.kt rename to data/src/commonMain/kotlin/ca/gosyer/jui/data/settings/SettingsRepositoryImpl.kt index 2d192039..d0d82a97 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/server/interactions/SettingsInteractionHandler.kt +++ b/data/src/commonMain/kotlin/ca/gosyer/jui/data/settings/SettingsRepositoryImpl.kt @@ -4,14 +4,16 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package ca.gosyer.jui.data.server.interactions +package ca.gosyer.jui.data.settings import ca.gosyer.jui.core.lang.IO -import ca.gosyer.jui.data.models.About -import ca.gosyer.jui.data.server.Http -import ca.gosyer.jui.data.server.ServerPreferences -import ca.gosyer.jui.data.server.requests.aboutQuery -import ca.gosyer.jui.data.server.requests.checkUpdateQuery +import ca.gosyer.jui.data.base.BaseRepository +import ca.gosyer.jui.domain.server.Http +import ca.gosyer.jui.domain.server.model.requests.aboutQuery +import ca.gosyer.jui.domain.server.model.requests.checkUpdateQuery +import ca.gosyer.jui.domain.server.service.ServerPreferences +import ca.gosyer.jui.domain.settings.model.About +import ca.gosyer.jui.domain.settings.service.SettingsRepository import io.ktor.client.call.body import io.ktor.client.plugins.expectSuccess import io.ktor.client.request.get @@ -22,12 +24,12 @@ import kotlinx.coroutines.flow.flow import kotlinx.coroutines.flow.flowOn import me.tatarka.inject.annotations.Inject -class SettingsInteractionHandler @Inject constructor( +class SettingsRepositoryImpl @Inject constructor( client: Http, serverPreferences: ServerPreferences -) : BaseInteractionHandler(client, serverPreferences) { +) : BaseRepository(client, serverPreferences), SettingsRepository { - fun aboutServer() = flow { + override fun aboutServer() = flow { val response = client.get( buildUrl { path(aboutQuery()) }, ) { @@ -36,7 +38,7 @@ class SettingsInteractionHandler @Inject constructor( emit(response) }.flowOn(Dispatchers.IO) - fun checkUpdate() = flow { + override fun checkUpdate() = flow { val response = client.post( buildUrl { path(checkUpdateQuery()) }, ) { diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/server/interactions/SourceInteractionHandler.kt b/data/src/commonMain/kotlin/ca/gosyer/jui/data/source/SourceRepositoryImpl.kt similarity index 53% rename from data/src/commonMain/kotlin/ca/gosyer/jui/data/server/interactions/SourceInteractionHandler.kt rename to data/src/commonMain/kotlin/ca/gosyer/jui/data/source/SourceRepositoryImpl.kt index 22876342..119ab766 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/server/interactions/SourceInteractionHandler.kt +++ b/data/src/commonMain/kotlin/ca/gosyer/jui/data/source/SourceRepositoryImpl.kt @@ -4,27 +4,28 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package ca.gosyer.jui.data.server.interactions +package ca.gosyer.jui.data.source import ca.gosyer.jui.core.lang.IO -import ca.gosyer.jui.data.models.MangaPage -import ca.gosyer.jui.data.models.Source -import ca.gosyer.jui.data.models.sourcefilters.SourceFilter -import ca.gosyer.jui.data.models.sourcefilters.SourceFilterChange -import ca.gosyer.jui.data.models.sourcepreference.SourcePreference -import ca.gosyer.jui.data.models.sourcepreference.SourcePreferenceChange -import ca.gosyer.jui.data.server.Http -import ca.gosyer.jui.data.server.ServerPreferences -import ca.gosyer.jui.data.server.requests.getFilterListQuery -import ca.gosyer.jui.data.server.requests.getSourceSettingsQuery -import ca.gosyer.jui.data.server.requests.globalSearchQuery -import ca.gosyer.jui.data.server.requests.setFilterRequest -import ca.gosyer.jui.data.server.requests.sourceInfoQuery -import ca.gosyer.jui.data.server.requests.sourceLatestQuery -import ca.gosyer.jui.data.server.requests.sourceListQuery -import ca.gosyer.jui.data.server.requests.sourcePopularQuery -import ca.gosyer.jui.data.server.requests.sourceSearchQuery -import ca.gosyer.jui.data.server.requests.updateSourceSettingQuery +import ca.gosyer.jui.data.base.BaseRepository +import ca.gosyer.jui.domain.server.Http +import ca.gosyer.jui.domain.server.model.requests.getFilterListQuery +import ca.gosyer.jui.domain.server.model.requests.getSourceSettingsQuery +import ca.gosyer.jui.domain.server.model.requests.setFilterRequest +import ca.gosyer.jui.domain.server.model.requests.sourceInfoQuery +import ca.gosyer.jui.domain.server.model.requests.sourceLatestQuery +import ca.gosyer.jui.domain.server.model.requests.sourceListQuery +import ca.gosyer.jui.domain.server.model.requests.sourcePopularQuery +import ca.gosyer.jui.domain.server.model.requests.sourceSearchQuery +import ca.gosyer.jui.domain.server.model.requests.updateSourceSettingQuery +import ca.gosyer.jui.domain.server.service.ServerPreferences +import ca.gosyer.jui.domain.source.model.MangaPage +import ca.gosyer.jui.domain.source.model.Source +import ca.gosyer.jui.domain.source.model.sourcefilters.SourceFilter +import ca.gosyer.jui.domain.source.model.sourcefilters.SourceFilterChange +import ca.gosyer.jui.domain.source.model.sourcepreference.SourcePreference +import ca.gosyer.jui.domain.source.model.sourcepreference.SourcePreferenceChange +import ca.gosyer.jui.domain.source.service.SourceRepository import io.ktor.client.call.body import io.ktor.client.plugins.expectSuccess import io.ktor.client.request.get @@ -40,12 +41,12 @@ import kotlinx.serialization.encodeToString import kotlinx.serialization.json.Json import me.tatarka.inject.annotations.Inject -class SourceInteractionHandler @Inject constructor( +class SourceRepositoryImpl @Inject constructor( client: Http, serverPreferences: ServerPreferences -) : BaseInteractionHandler(client, serverPreferences) { +) : BaseRepository(client, serverPreferences), SourceRepository { - fun getSourceList() = flow { + override fun getSourceList() = flow { val response = client.get( buildUrl { path(sourceListQuery()) }, ) { @@ -54,7 +55,7 @@ class SourceInteractionHandler @Inject constructor( emit(response) }.flowOn(Dispatchers.IO) - fun getSourceInfo(sourceId: Long) = flow { + override fun getSourceInfo(sourceId: Long) = flow { val response = client.get( buildUrl { path(sourceInfoQuery(sourceId)) }, ) { @@ -63,9 +64,7 @@ class SourceInteractionHandler @Inject constructor( emit(response) }.flowOn(Dispatchers.IO) - fun getSourceInfo(source: Source) = getSourceInfo(source.id) - - fun getPopularManga(sourceId: Long, pageNum: Int) = flow { + override fun getPopularManga(sourceId: Long, pageNum: Int) = flow { val response = client.get( buildUrl { path(sourcePopularQuery(sourceId, pageNum)) }, ) { @@ -74,12 +73,7 @@ class SourceInteractionHandler @Inject constructor( emit(response) }.flowOn(Dispatchers.IO) - fun getPopularManga(source: Source, pageNum: Int) = getPopularManga( - source.id, - pageNum - ) - - fun getLatestManga(sourceId: Long, pageNum: Int) = flow { + override fun getLatestManga(sourceId: Long, pageNum: Int) = flow { val response = client.get( buildUrl { path(sourceLatestQuery(sourceId, pageNum)) }, ) { @@ -88,27 +82,7 @@ class SourceInteractionHandler @Inject constructor( emit(response) }.flowOn(Dispatchers.IO) - fun getLatestManga(source: Source, pageNum: Int) = getLatestManga( - source.id, - pageNum - ) - - // TODO: 2021-03-14 - fun getGlobalSearchResults(searchTerm: String) = flow { - val response = client.get( - buildUrl { - path(globalSearchQuery()) - if (searchTerm.isNotBlank()) { - parameter("searchTerm", searchTerm) - } - }, - ) { - expectSuccess = true - } - emit(response) - }.flowOn(Dispatchers.IO) - - fun getSearchResults(sourceId: Long, searchTerm: String, pageNum: Int) = flow { + override fun getSearchResults(sourceId: Long, searchTerm: String, pageNum: Int) = flow { val response = client.get( buildUrl { path(sourceSearchQuery(sourceId)) @@ -123,13 +97,7 @@ class SourceInteractionHandler @Inject constructor( emit(response) }.flowOn(Dispatchers.IO) - fun getSearchResults(source: Source, searchTerm: String, pageNum: Int) = getSearchResults( - source.id, - searchTerm, - pageNum - ) - - fun getFilterList(sourceId: Long, reset: Boolean = false) = flow { + override fun getFilterList(sourceId: Long, reset: Boolean) = flow { val response = client.get( buildUrl { path(getFilterListQuery(sourceId)) @@ -138,17 +106,12 @@ class SourceInteractionHandler @Inject constructor( } }, ) { - url { - - } expectSuccess = true }.body>() emit(response) }.flowOn(Dispatchers.IO) - fun getFilterList(source: Source, reset: Boolean = false) = getFilterList(source.id, reset) - - fun setFilter(sourceId: Long, sourceFilter: SourceFilterChange) = flow { + override fun setFilter(sourceId: Long, sourceFilter: SourceFilterChange) = flow { val response = client.post( buildUrl { path(setFilterRequest(sourceId)) }, ) { @@ -159,12 +122,12 @@ class SourceInteractionHandler @Inject constructor( emit(response) }.flowOn(Dispatchers.IO) - fun setFilter(sourceId: Long, position: Int, value: Any) = setFilter( + override fun setFilter(sourceId: Long, position: Int, value: Any) = setFilter( sourceId, SourceFilterChange(position, value) ) - fun setFilter(sourceId: Long, parentPosition: Int, childPosition: Int, value: Any) = setFilter( + override fun setFilter(sourceId: Long, parentPosition: Int, childPosition: Int, value: Any) = setFilter( sourceId, SourceFilterChange( parentPosition, @@ -172,7 +135,7 @@ class SourceInteractionHandler @Inject constructor( ) ) - fun getSourceSettings(sourceId: Long) = flow { + override fun getSourceSettings(sourceId: Long) = flow { val response = client.get( buildUrl { path(getSourceSettingsQuery(sourceId)) }, ) { @@ -181,9 +144,7 @@ class SourceInteractionHandler @Inject constructor( emit(response) }.flowOn(Dispatchers.IO) - fun getSourceSettings(source: Source) = getSourceSettings(source.id) - - fun setSourceSetting(sourceId: Long, sourcePreference: SourcePreferenceChange) = flow { + override fun setSourceSetting(sourceId: Long, sourcePreference: SourcePreferenceChange) = flow { val response = client.post( buildUrl { path(updateSourceSettingQuery(sourceId)) }, ) { @@ -194,7 +155,7 @@ class SourceInteractionHandler @Inject constructor( emit(response) }.flowOn(Dispatchers.IO) - fun setSourceSetting(sourceId: Long, position: Int, value: Any) = setSourceSetting( + override fun setSourceSetting(sourceId: Long, position: Int, value: Any) = setSourceSetting( sourceId, SourcePreferenceChange(position, value) ) diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/server/interactions/UpdatesInteractionHandler.kt b/data/src/commonMain/kotlin/ca/gosyer/jui/data/updates/UpdatesRepositoryImpl.kt similarity index 67% rename from data/src/commonMain/kotlin/ca/gosyer/jui/data/server/interactions/UpdatesInteractionHandler.kt rename to data/src/commonMain/kotlin/ca/gosyer/jui/data/updates/UpdatesRepositoryImpl.kt index 7971ecbc..ef0e36bf 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/server/interactions/UpdatesInteractionHandler.kt +++ b/data/src/commonMain/kotlin/ca/gosyer/jui/data/updates/UpdatesRepositoryImpl.kt @@ -4,15 +4,16 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package ca.gosyer.jui.data.server.interactions +package ca.gosyer.jui.data.updates import ca.gosyer.jui.core.lang.IO -import ca.gosyer.jui.data.models.Category -import ca.gosyer.jui.data.models.Updates -import ca.gosyer.jui.data.server.Http -import ca.gosyer.jui.data.server.ServerPreferences -import ca.gosyer.jui.data.server.requests.fetchUpdatesRequest -import ca.gosyer.jui.data.server.requests.recentUpdatesQuery +import ca.gosyer.jui.data.base.BaseRepository +import ca.gosyer.jui.domain.server.Http +import ca.gosyer.jui.domain.server.model.requests.fetchUpdatesRequest +import ca.gosyer.jui.domain.server.model.requests.recentUpdatesQuery +import ca.gosyer.jui.domain.server.service.ServerPreferences +import ca.gosyer.jui.domain.updates.model.Updates +import ca.gosyer.jui.domain.updates.service.UpdatesRepository import io.ktor.client.call.body import io.ktor.client.plugins.expectSuccess import io.ktor.client.request.forms.submitForm @@ -25,12 +26,12 @@ import kotlinx.coroutines.flow.flow import kotlinx.coroutines.flow.flowOn import me.tatarka.inject.annotations.Inject -class UpdatesInteractionHandler @Inject constructor( +class UpdatesRepositoryImpl @Inject constructor( client: Http, serverPreferences: ServerPreferences -) : BaseInteractionHandler(client, serverPreferences) { +) : BaseRepository(client, serverPreferences), UpdatesRepository { - fun getRecentUpdates(pageNum: Int) = flow { + override fun getRecentUpdates(pageNum: Int) = flow { val response = client.get( buildUrl { path(recentUpdatesQuery(pageNum)) } ) { @@ -39,7 +40,7 @@ class UpdatesInteractionHandler @Inject constructor( emit(response) }.flowOn(Dispatchers.IO) - fun updateLibrary() = flow { + override fun updateLibrary() = flow { val response = client.post( buildUrl { path(fetchUpdatesRequest()) } ) { @@ -48,7 +49,7 @@ class UpdatesInteractionHandler @Inject constructor( emit(response) }.flowOn(Dispatchers.IO) - fun updateCategory(categoryId: Long) = flow { + override fun updateCategory(categoryId: Long) = flow { val response = client.submitForm( buildUrl { path(fetchUpdatesRequest()) }, formParameters = Parameters.build { @@ -59,6 +60,4 @@ class UpdatesInteractionHandler @Inject constructor( } emit(response) }.flowOn(Dispatchers.IO) - - fun updateCategory(category: Category) = updateCategory(category.id) } diff --git a/data/src/desktopMain/kotlin/ca/gosyer/jui/data/DataComponent.kt b/data/src/desktopMain/kotlin/ca/gosyer/jui/data/DataComponent.kt deleted file mode 100644 index b636f25a..00000000 --- a/data/src/desktopMain/kotlin/ca/gosyer/jui/data/DataComponent.kt +++ /dev/null @@ -1,102 +0,0 @@ -/* - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. - */ - -package ca.gosyer.jui.data - -import ca.gosyer.jui.core.di.AppScope -import ca.gosyer.jui.core.prefs.PreferenceStoreFactory -import ca.gosyer.jui.data.catalog.CatalogPreferences -import ca.gosyer.jui.data.extension.ExtensionPreferences -import ca.gosyer.jui.data.library.LibraryPreferences -import ca.gosyer.jui.data.migration.MigrationPreferences -import ca.gosyer.jui.data.reader.ReaderPreferences -import ca.gosyer.jui.data.server.Http -import ca.gosyer.jui.data.server.HttpProvider -import ca.gosyer.jui.data.server.ServerHostPreferences -import ca.gosyer.jui.data.server.ServerPreferences -import ca.gosyer.jui.data.ui.UiPreferences -import ca.gosyer.jui.data.update.UpdatePreferences -import me.tatarka.inject.annotations.Provides - -actual interface DataComponent { - val preferenceFactory: PreferenceStoreFactory - - val httpProvider: HttpProvider - - val http: Http - - val serverHostPreferences: ServerHostPreferences - - val serverPreferences: ServerPreferences - - val extensionPreferences: ExtensionPreferences - - val catalogPreferences: CatalogPreferences - - val libraryPreferences: LibraryPreferences - - val readerPreferences: ReaderPreferences - - val uiPreferences: UiPreferences - - val migrationPreferences: MigrationPreferences - - val updatePreferences: UpdatePreferences - - @get:AppScope - @get:Provides - val serverHostPreferencesFactory: ServerHostPreferences - get() = ServerHostPreferences(preferenceFactory.create("host")) - - @get:AppScope - @get:Provides - val serverPreferencesFactory: ServerPreferences - get() = ServerPreferences(preferenceFactory.create("server")) - - @get:AppScope - @get:Provides - val extensionPreferencesFactory: ExtensionPreferences - get() = ExtensionPreferences(preferenceFactory.create("extension")) - - @get:AppScope - @get:Provides - val catalogPreferencesFactory: CatalogPreferences - get() = CatalogPreferences(preferenceFactory.create("catalog")) - - @get:AppScope - @get:Provides - val libraryPreferencesFactory: LibraryPreferences - get() = LibraryPreferences(preferenceFactory.create("library")) - - @get:AppScope - @get:Provides - val readerPreferencesFactory: ReaderPreferences - get() = ReaderPreferences(preferenceFactory.create("reader")) { name -> - preferenceFactory.create("reader", name) - } - - @get:AppScope - @get:Provides - val uiPreferencesFactory: UiPreferences - get() = UiPreferences(preferenceFactory.create("ui")) - - @get:AppScope - @get:Provides - val migrationPreferencesFactory: MigrationPreferences - get() = MigrationPreferences(preferenceFactory.create("migration")) - - @get:AppScope - @get:Provides - val updatePreferencesFactory: UpdatePreferences - get() = UpdatePreferences(preferenceFactory.create("update")) - - @get:AppScope - @get:Provides - val httpFactory: Http - get() = httpProvider.get(serverPreferences) - - companion object -} diff --git a/desktop/build.gradle.kts b/desktop/build.gradle.kts index cd334c11..1c87aeb5 100644 --- a/desktop/build.gradle.kts +++ b/desktop/build.gradle.kts @@ -20,8 +20,8 @@ plugins { dependencies { implementation(projects.core) implementation(projects.i18n) - implementation(projects.data) implementation(projects.domain) + implementation(projects.data) implementation(projects.uiCore) implementation(projects.presentation) diff --git a/desktop/src/main/kotlin/ca/gosyer/jui/desktop/AppComponent.kt b/desktop/src/main/kotlin/ca/gosyer/jui/desktop/AppComponent.kt index 4cbdc633..fa20117a 100644 --- a/desktop/src/main/kotlin/ca/gosyer/jui/desktop/AppComponent.kt +++ b/desktop/src/main/kotlin/ca/gosyer/jui/desktop/AppComponent.kt @@ -7,6 +7,7 @@ package ca.gosyer.jui.desktop import ca.gosyer.jui.core.di.AppScope +import ca.gosyer.jui.data.DataComponent import ca.gosyer.jui.domain.DomainComponent import ca.gosyer.jui.ui.base.UiComponent import me.tatarka.inject.annotations.Component @@ -14,7 +15,7 @@ import me.tatarka.inject.annotations.Provides @AppScope @Component -abstract class AppComponent : DomainComponent, UiComponent { +abstract class AppComponent : DataComponent, DomainComponent, UiComponent { abstract val appMigrations: AppMigrations diff --git a/desktop/src/main/kotlin/ca/gosyer/jui/desktop/AppMigrations.kt b/desktop/src/main/kotlin/ca/gosyer/jui/desktop/AppMigrations.kt index 2620c99f..e468c93e 100644 --- a/desktop/src/main/kotlin/ca/gosyer/jui/desktop/AppMigrations.kt +++ b/desktop/src/main/kotlin/ca/gosyer/jui/desktop/AppMigrations.kt @@ -6,8 +6,8 @@ package ca.gosyer.jui.desktop -import ca.gosyer.jui.data.migration.MigrationPreferences import ca.gosyer.jui.desktop.build.BuildConfig +import ca.gosyer.jui.domain.migration.service.MigrationPreferences import ca.gosyer.jui.uicore.vm.ContextWrapper import me.tatarka.inject.annotations.Inject diff --git a/desktop/src/main/kotlin/ca/gosyer/jui/desktop/main.kt b/desktop/src/main/kotlin/ca/gosyer/jui/desktop/main.kt index 654a1786..c42997eb 100644 --- a/desktop/src/main/kotlin/ca/gosyer/jui/desktop/main.kt +++ b/desktop/src/main/kotlin/ca/gosyer/jui/desktop/main.kt @@ -26,10 +26,10 @@ import androidx.compose.ui.window.rememberWindowState import ca.gosyer.jui.core.io.userDataDir import ca.gosyer.jui.core.lang.withUIContext import ca.gosyer.jui.core.prefs.getAsFlow -import ca.gosyer.jui.data.server.ServerService.ServerResult -import ca.gosyer.jui.data.ui.model.ThemeMode import ca.gosyer.jui.desktop.build.BuildConfig import ca.gosyer.jui.desktop.logging.initializeLogger +import ca.gosyer.jui.domain.server.service.ServerService.ServerResult +import ca.gosyer.jui.domain.ui.model.ThemeMode import ca.gosyer.jui.i18n.MR import ca.gosyer.jui.ui.base.dialog.getMaterialDialogProperties import ca.gosyer.jui.ui.base.theme.AppTheme diff --git a/domain/build.gradle.kts b/domain/build.gradle.kts index af2ff88f..a4fe7484 100644 --- a/domain/build.gradle.kts +++ b/domain/build.gradle.kts @@ -33,17 +33,21 @@ kotlin { } val commonMain by getting { dependencies { + api(kotlin("stdlib-common")) api(kotlin("stdlib-common")) api(libs.coroutines.core) api(libs.serialization.json) api(libs.kotlinInject.runtime) api(libs.ktor.core) + api(libs.ktor.contentNegotiation) + api(libs.ktor.serialization.json) + api(libs.ktor.auth) + api(libs.ktor.logging) api(libs.ktor.websockets) api(libs.okio) api(libs.dateTime) api(projects.core) api(projects.i18n) - api(projects.data) } } val commonTest by getting { @@ -56,6 +60,7 @@ kotlin { val desktopMain by getting { dependencies { api(kotlin("stdlib-jdk8")) + api(libs.ktor.okHttp) } } val desktopTest by getting { @@ -64,6 +69,7 @@ kotlin { val androidMain by getting { dependencies { api(kotlin("stdlib-jdk8")) + api(libs.ktor.okHttp) } } val androidTest by getting { diff --git a/domain/src/androidMain/kotlin/ca/gosyer/jui/domain/DomainComponent.kt b/domain/src/androidMain/kotlin/ca/gosyer/jui/domain/DomainComponent.kt index d8d10372..ee32ccd0 100644 --- a/domain/src/androidMain/kotlin/ca/gosyer/jui/domain/DomainComponent.kt +++ b/domain/src/androidMain/kotlin/ca/gosyer/jui/domain/DomainComponent.kt @@ -6,23 +6,102 @@ package ca.gosyer.jui.domain +import ca.gosyer.jui.core.CoreComponent import ca.gosyer.jui.core.di.AppScope -import ca.gosyer.jui.data.DataComponent -import ca.gosyer.jui.domain.download.DownloadService -import ca.gosyer.jui.domain.library.LibraryUpdateService -import ca.gosyer.jui.domain.migration.RunMigrations -import ca.gosyer.jui.domain.update.UpdateChecker +import ca.gosyer.jui.domain.download.service.DownloadService +import ca.gosyer.jui.domain.extension.service.ExtensionPreferences +import ca.gosyer.jui.domain.library.service.LibraryPreferences +import ca.gosyer.jui.domain.library.service.LibraryUpdateService +import ca.gosyer.jui.domain.migration.interactor.RunMigrations +import ca.gosyer.jui.domain.migration.service.MigrationPreferences +import ca.gosyer.jui.domain.reader.service.ReaderPreferences +import ca.gosyer.jui.domain.server.Http +import ca.gosyer.jui.domain.server.HttpProvider +import ca.gosyer.jui.domain.server.service.ServerPreferences +import ca.gosyer.jui.domain.source.service.CatalogPreferences +import ca.gosyer.jui.domain.ui.service.UiPreferences +import ca.gosyer.jui.domain.updates.interactor.UpdateChecker +import ca.gosyer.jui.domain.updates.service.UpdatePreferences import me.tatarka.inject.annotations.Provides -actual interface DomainComponent : DataComponent { +actual interface DomainComponent : CoreComponent { + // Providers + val httpProvider: HttpProvider + // Factories + val migrations: RunMigrations + + val updateChecker: UpdateChecker + + // Singletons val downloadService: DownloadService val libraryUpdateService: LibraryUpdateService - val migrations: RunMigrations + val http: Http - val updateChecker: UpdateChecker + val serverPreferences: ServerPreferences + + val extensionPreferences: ExtensionPreferences + + val catalogPreferences: CatalogPreferences + + val libraryPreferences: LibraryPreferences + + val readerPreferences: ReaderPreferences + + val uiPreferences: UiPreferences + + val migrationPreferences: MigrationPreferences + + val updatePreferences: UpdatePreferences + + @get:AppScope + @get:Provides + val serverPreferencesFactory: ServerPreferences + get() = ServerPreferences(preferenceFactory.create("server")) + + @get:AppScope + @get:Provides + val extensionPreferencesFactory: ExtensionPreferences + get() = ExtensionPreferences(preferenceFactory.create("extension")) + + @get:AppScope + @get:Provides + val catalogPreferencesFactory: CatalogPreferences + get() = CatalogPreferences(preferenceFactory.create("catalog")) + + @get:AppScope + @get:Provides + val libraryPreferencesFactory: LibraryPreferences + get() = LibraryPreferences(preferenceFactory.create("library")) + + @get:AppScope + @get:Provides + val readerPreferencesFactory: ReaderPreferences + get() = ReaderPreferences(preferenceFactory.create("reader")) { name -> + preferenceFactory.create("reader", name) + } + + @get:AppScope + @get:Provides + val uiPreferencesFactory: UiPreferences + get() = UiPreferences(preferenceFactory.create("ui")) + + @get:AppScope + @get:Provides + val migrationPreferencesFactory: MigrationPreferences + get() = MigrationPreferences(preferenceFactory.create("migration")) + + @get:AppScope + @get:Provides + val updatePreferencesFactory: UpdatePreferences + get() = UpdatePreferences(preferenceFactory.create("update")) + + @get:AppScope + @get:Provides + val httpFactory: Http + get() = httpProvider.get(serverPreferences) @get:AppScope @get:Provides @@ -34,13 +113,5 @@ actual interface DomainComponent : DataComponent { val downloadServiceFactory: DownloadService get() = DownloadService(serverPreferences, http) - @get:AppScope - @get:Provides - val migrationsFactory: RunMigrations - get() = RunMigrations(migrationPreferences, readerPreferences) - - @get:AppScope - @get:Provides - val updateCheckerFactory: UpdateChecker - get() = UpdateChecker(updatePreferences, http) -} \ No newline at end of file + companion object +} diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/DomainComponent.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/DomainComponent.kt index 6968964d..187b536e 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/DomainComponent.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/DomainComponent.kt @@ -6,4 +6,4 @@ package ca.gosyer.jui.domain -expect interface DomainComponent \ No newline at end of file +expect interface DomainComponent diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/models/BackupValidationResult.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/backup/model/BackupValidationResult.kt similarity index 90% rename from data/src/commonMain/kotlin/ca/gosyer/jui/data/models/BackupValidationResult.kt rename to domain/src/commonMain/kotlin/ca/gosyer/jui/domain/backup/model/BackupValidationResult.kt index d2981f19..e6c13c8b 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/models/BackupValidationResult.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/backup/model/BackupValidationResult.kt @@ -4,7 +4,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package ca.gosyer.jui.data.models +package ca.gosyer.jui.domain.backup.model import kotlinx.serialization.Serializable 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 new file mode 100644 index 00000000..6255e085 --- /dev/null +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/backup/service/BackupRepository.kt @@ -0,0 +1,19 @@ +/* + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +package ca.gosyer.jui.domain.backup.service + +import ca.gosyer.jui.domain.backup.model.BackupValidationResult +import io.ktor.client.request.HttpRequestBuilder +import io.ktor.client.statement.HttpResponse +import kotlinx.coroutines.flow.Flow +import okio.Path + +interface BackupRepository { + fun importBackupFile(file: Path, block: HttpRequestBuilder.() -> Unit = {}): Flow + fun validateBackupFile(file: Path, block: HttpRequestBuilder.() -> Unit = {}): Flow + fun exportBackupFile(block: HttpRequestBuilder.() -> Unit = {}): Flow +} diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/base/WebsocketService.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/base/WebsocketService.kt index 599275cb..ed783bd0 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/base/WebsocketService.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/base/WebsocketService.kt @@ -7,8 +7,8 @@ package ca.gosyer.jui.domain.base import ca.gosyer.jui.core.lang.throwIfCancellation -import ca.gosyer.jui.data.server.Http -import ca.gosyer.jui.data.server.ServerPreferences +import ca.gosyer.jui.domain.server.Http +import ca.gosyer.jui.domain.server.service.ServerPreferences import io.ktor.client.plugins.websocket.ws import io.ktor.http.URLProtocol import io.ktor.websocket.Frame diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/models/Category.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/category/model/Category.kt similarity index 89% rename from data/src/commonMain/kotlin/ca/gosyer/jui/data/models/Category.kt rename to domain/src/commonMain/kotlin/ca/gosyer/jui/domain/category/model/Category.kt index 4383f191..730bd239 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/models/Category.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/category/model/Category.kt @@ -4,7 +4,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package ca.gosyer.jui.data.models +package ca.gosyer.jui.domain.category.model import kotlinx.serialization.Serializable 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 new file mode 100644 index 00000000..8a0fafc4 --- /dev/null +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/category/service/CategoryRepository.kt @@ -0,0 +1,24 @@ +/* + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +package ca.gosyer.jui.domain.category.service + +import ca.gosyer.jui.domain.category.model.Category +import ca.gosyer.jui.domain.manga.model.Manga +import io.ktor.client.statement.HttpResponse +import kotlinx.coroutines.flow.Flow + +interface CategoryRepository { + fun getMangaCategories(mangaId: Long): Flow> + fun addMangaToCategory(mangaId: Long, categoryId: Long): Flow + fun removeMangaFromCategory(mangaId: Long, categoryId: Long): Flow + fun getCategories(dropDefault: Boolean = false): Flow> + fun createCategory(name: String): Flow + fun modifyCategory(categoryId: Long, name: String? = null, isLanding: Boolean? = null): Flow + fun reorderCategory(to: Int, from: Int): Flow + fun deleteCategory(categoryId: Long): Flow + fun getMangaFromCategory(categoryId: Long): Flow> +} diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/interactor/UpdateChapterMeta.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/interactor/UpdateChapterMeta.kt new file mode 100644 index 00000000..b46e87ef --- /dev/null +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/interactor/UpdateChapterMeta.kt @@ -0,0 +1,32 @@ +/* + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +package ca.gosyer.jui.domain.chapter.interactor + +import ca.gosyer.jui.domain.chapter.model.Chapter +import ca.gosyer.jui.domain.chapter.service.ChapterRepository +import kotlinx.coroutines.flow.emitAll +import kotlinx.coroutines.flow.flow +import me.tatarka.inject.annotations.Inject + +class UpdateChapterMeta @Inject constructor(private val chapterRepository: ChapterRepository) { + + fun subscribe( + chapter: Chapter, + pageOffset: Int = chapter.meta.juiPageOffset + ) = flow { + if (pageOffset != chapter.meta.juiPageOffset) { + emitAll( + chapterRepository.updateChapterMeta( + chapter.mangaId, + chapter.index, + "juiPageOffset", + pageOffset.toString() + ) + ) + } + } +} diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/models/Chapter.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/model/Chapter.kt similarity index 59% rename from data/src/commonMain/kotlin/ca/gosyer/jui/data/models/Chapter.kt rename to domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/model/Chapter.kt index 17c232aa..4916f9e2 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/models/Chapter.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/model/Chapter.kt @@ -4,11 +4,8 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package ca.gosyer.jui.data.models +package ca.gosyer.jui.domain.chapter.model -import ca.gosyer.jui.data.server.interactions.ChapterInteractionHandler -import kotlinx.coroutines.flow.collect -import kotlinx.coroutines.flow.flow import kotlinx.serialization.Serializable @Serializable @@ -29,18 +26,7 @@ data class Chapter( val lastReadAt: Int?, val downloaded: Boolean, val meta: ChapterMeta -) { - fun updateRemote( - chapterHandler: ChapterInteractionHandler, - pageOffset: Int = meta.juiPageOffset - ) = flow { - if (pageOffset != meta.juiPageOffset) { - chapterHandler.updateChapterMeta(this@Chapter, "juiPageOffset", pageOffset.toString()) - .collect() - } - emit(Unit) - } -} +) @Serializable data class ChapterMeta( 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 new file mode 100644 index 00000000..098c7b1d --- /dev/null +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/service/ChapterRepository.kt @@ -0,0 +1,37 @@ +/* + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +package ca.gosyer.jui.domain.chapter.service + +import ca.gosyer.jui.domain.chapter.model.Chapter +import io.ktor.client.request.HttpRequestBuilder +import io.ktor.client.statement.HttpResponse +import kotlinx.coroutines.flow.Flow + +interface ChapterRepository { + fun getChapters(mangaId: Long, refresh: Boolean = false): Flow> + fun getChapter(mangaId: Long, chapterIndex: Int): Flow + fun updateChapter( + mangaId: Long, + chapterIndex: Int, + read: Boolean? = null, + bookmarked: Boolean? = null, + lastPageRead: Int? = null, + markPreviousRead: Boolean? = null + ): Flow + + fun getPage( + mangaId: Long, + chapterIndex: Int, + pageNum: Int, + block: HttpRequestBuilder.() -> Unit + ): Flow + + fun deleteChapterDownload(mangaId: Long, chapterIndex: Int): Flow + fun queueChapterDownload(mangaId: Long, chapterIndex: Int): Flow + fun stopChapterDownload(mangaId: Long, chapterIndex: Int): Flow + fun updateChapterMeta(mangaId: Long, chapterIndex: Int, key: String, value: String): Flow +} diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/download/model/DownloadChapter.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/download/model/DownloadChapter.kt similarity index 78% rename from data/src/commonMain/kotlin/ca/gosyer/jui/data/download/model/DownloadChapter.kt rename to domain/src/commonMain/kotlin/ca/gosyer/jui/domain/download/model/DownloadChapter.kt index 6cebfc10..b7e8be75 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/download/model/DownloadChapter.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/download/model/DownloadChapter.kt @@ -4,10 +4,10 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package ca.gosyer.jui.data.download.model +package ca.gosyer.jui.domain.download.model -import ca.gosyer.jui.data.models.Chapter -import ca.gosyer.jui.data.models.Manga +import ca.gosyer.jui.domain.chapter.model.Chapter +import ca.gosyer.jui.domain.manga.model.Manga import kotlinx.serialization.Serializable @Serializable diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/download/model/DownloadState.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/download/model/DownloadState.kt similarity index 89% rename from data/src/commonMain/kotlin/ca/gosyer/jui/data/download/model/DownloadState.kt rename to domain/src/commonMain/kotlin/ca/gosyer/jui/domain/download/model/DownloadState.kt index 357f2c71..61e48663 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/download/model/DownloadState.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/download/model/DownloadState.kt @@ -4,7 +4,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package ca.gosyer.jui.data.download.model +package ca.gosyer.jui.domain.download.model import kotlinx.serialization.Serializable diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/download/model/DownloadStatus.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/download/model/DownloadStatus.kt similarity index 89% rename from data/src/commonMain/kotlin/ca/gosyer/jui/data/download/model/DownloadStatus.kt rename to domain/src/commonMain/kotlin/ca/gosyer/jui/domain/download/model/DownloadStatus.kt index 0ed3f72f..b34f5ede 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/download/model/DownloadStatus.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/download/model/DownloadStatus.kt @@ -4,7 +4,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package ca.gosyer.jui.data.download.model +package ca.gosyer.jui.domain.download.model import kotlinx.serialization.Serializable diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/download/model/DownloaderStatus.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/download/model/DownloaderStatus.kt similarity index 88% rename from data/src/commonMain/kotlin/ca/gosyer/jui/data/download/model/DownloaderStatus.kt rename to domain/src/commonMain/kotlin/ca/gosyer/jui/domain/download/model/DownloaderStatus.kt index 0745440d..713d7752 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/download/model/DownloaderStatus.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/download/model/DownloaderStatus.kt @@ -4,7 +4,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package ca.gosyer.jui.data.download.model +package ca.gosyer.jui.domain.download.model import kotlinx.serialization.Serializable 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 new file mode 100644 index 00000000..03755eb7 --- /dev/null +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/download/service/DownloadRepository.kt @@ -0,0 +1,16 @@ +/* + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +package ca.gosyer.jui.domain.download.service + +import io.ktor.client.statement.HttpResponse +import kotlinx.coroutines.flow.Flow + +interface DownloadRepository { + fun startDownloading(): Flow + fun stopDownloading(): Flow + fun clearDownloadQueue(): Flow +} diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/download/DownloadService.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/download/service/DownloadService.kt similarity index 80% rename from domain/src/commonMain/kotlin/ca/gosyer/jui/domain/download/DownloadService.kt rename to domain/src/commonMain/kotlin/ca/gosyer/jui/domain/download/service/DownloadService.kt index 3101bff3..d8b58958 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/download/DownloadService.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/download/service/DownloadService.kt @@ -4,15 +4,15 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package ca.gosyer.jui.domain.download +package ca.gosyer.jui.domain.download.service -import ca.gosyer.jui.data.download.model.DownloadChapter -import ca.gosyer.jui.data.download.model.DownloadStatus -import ca.gosyer.jui.data.download.model.DownloaderStatus -import ca.gosyer.jui.data.server.Http -import ca.gosyer.jui.data.server.ServerPreferences -import ca.gosyer.jui.data.server.requests.downloadsQuery import ca.gosyer.jui.domain.base.WebsocketService +import ca.gosyer.jui.domain.download.model.DownloadChapter +import ca.gosyer.jui.domain.download.model.DownloadStatus +import ca.gosyer.jui.domain.download.model.DownloaderStatus +import ca.gosyer.jui.domain.server.Http +import ca.gosyer.jui.domain.server.model.requests.downloadsQuery +import ca.gosyer.jui.domain.server.service.ServerPreferences import io.ktor.websocket.Frame import io.ktor.websocket.readText import kotlinx.coroutines.flow.MutableStateFlow diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/models/Extension.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/extension/model/Extension.kt similarity index 92% rename from data/src/commonMain/kotlin/ca/gosyer/jui/data/models/Extension.kt rename to domain/src/commonMain/kotlin/ca/gosyer/jui/domain/extension/model/Extension.kt index db684494..54312e84 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/models/Extension.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/extension/model/Extension.kt @@ -4,7 +4,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package ca.gosyer.jui.data.models +package ca.gosyer.jui.domain.extension.model import kotlinx.serialization.Serializable diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/extension/ExtensionPreferences.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/extension/service/ExtensionPreferences.kt similarity index 92% rename from data/src/commonMain/kotlin/ca/gosyer/jui/data/extension/ExtensionPreferences.kt rename to domain/src/commonMain/kotlin/ca/gosyer/jui/domain/extension/service/ExtensionPreferences.kt index cf1838c5..310b666c 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/extension/ExtensionPreferences.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/extension/service/ExtensionPreferences.kt @@ -4,7 +4,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package ca.gosyer.jui.data.extension +package ca.gosyer.jui.domain.extension.service import androidx.compose.ui.text.intl.Locale import ca.gosyer.jui.core.prefs.Preference 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 new file mode 100644 index 00000000..723dfd29 --- /dev/null +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/extension/service/ExtensionRepository.kt @@ -0,0 +1,21 @@ +/* + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +package ca.gosyer.jui.domain.extension.service + +import ca.gosyer.jui.domain.extension.model.Extension +import io.ktor.client.request.HttpRequestBuilder +import io.ktor.client.statement.HttpResponse +import io.ktor.utils.io.ByteReadChannel +import kotlinx.coroutines.flow.Flow + +interface ExtensionRepository { + fun getExtensionList(): Flow> + fun installExtension(extension: Extension): Flow + fun updateExtension(extension: Extension): Flow + fun uninstallExtension(extension: Extension): Flow + fun getApkIcon(extension: Extension, block: HttpRequestBuilder.() -> Unit): Flow +} diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/library/model/DisplayMode.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/library/model/DisplayMode.kt similarity index 94% rename from data/src/commonMain/kotlin/ca/gosyer/jui/data/library/model/DisplayMode.kt rename to domain/src/commonMain/kotlin/ca/gosyer/jui/domain/library/model/DisplayMode.kt index a1c2a851..be994832 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/library/model/DisplayMode.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/library/model/DisplayMode.kt @@ -4,7 +4,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package ca.gosyer.jui.data.library.model +package ca.gosyer.jui.domain.library.model import ca.gosyer.jui.i18n.MR import dev.icerock.moko.resources.StringResource diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/library/model/FilterState.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/library/model/FilterState.kt similarity index 88% rename from data/src/commonMain/kotlin/ca/gosyer/jui/data/library/model/FilterState.kt rename to domain/src/commonMain/kotlin/ca/gosyer/jui/domain/library/model/FilterState.kt index 5012297e..ac6340c3 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/library/model/FilterState.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/library/model/FilterState.kt @@ -4,7 +4,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package ca.gosyer.jui.data.library.model +package ca.gosyer.jui.domain.library.model import kotlinx.serialization.Serializable diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/library/model/JobStatus.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/library/model/JobStatus.kt similarity index 88% rename from data/src/commonMain/kotlin/ca/gosyer/jui/data/library/model/JobStatus.kt rename to domain/src/commonMain/kotlin/ca/gosyer/jui/domain/library/model/JobStatus.kt index 29cc77ee..62562f48 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/library/model/JobStatus.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/library/model/JobStatus.kt @@ -4,7 +4,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package ca.gosyer.jui.data.library.model +package ca.gosyer.jui.domain.library.model import kotlinx.serialization.Serializable diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/library/model/Sort.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/library/model/Sort.kt similarity index 94% rename from data/src/commonMain/kotlin/ca/gosyer/jui/data/library/model/Sort.kt rename to domain/src/commonMain/kotlin/ca/gosyer/jui/domain/library/model/Sort.kt index 885053b2..89391a53 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/library/model/Sort.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/library/model/Sort.kt @@ -4,7 +4,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package ca.gosyer.jui.data.library.model +package ca.gosyer.jui.domain.library.model import ca.gosyer.jui.i18n.MR import dev.icerock.moko.resources.StringResource diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/library/model/UpdateStatus.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/library/model/UpdateStatus.kt similarity index 89% rename from data/src/commonMain/kotlin/ca/gosyer/jui/data/library/model/UpdateStatus.kt rename to domain/src/commonMain/kotlin/ca/gosyer/jui/domain/library/model/UpdateStatus.kt index db2b27f5..b9892620 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/library/model/UpdateStatus.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/library/model/UpdateStatus.kt @@ -4,7 +4,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package ca.gosyer.jui.data.library.model +package ca.gosyer.jui.domain.library.model import kotlinx.serialization.Serializable diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/library/LibraryPreferences.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/library/service/LibraryPreferences.kt similarity index 82% rename from data/src/commonMain/kotlin/ca/gosyer/jui/data/library/LibraryPreferences.kt rename to domain/src/commonMain/kotlin/ca/gosyer/jui/domain/library/service/LibraryPreferences.kt index d1631944..d29651cb 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/library/LibraryPreferences.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/library/service/LibraryPreferences.kt @@ -4,13 +4,12 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package ca.gosyer.jui.data.library +package ca.gosyer.jui.domain.library.service import ca.gosyer.jui.core.prefs.Preference import ca.gosyer.jui.core.prefs.PreferenceStore -import ca.gosyer.jui.data.library.model.DisplayMode -import ca.gosyer.jui.data.library.model.FilterState -import ca.gosyer.jui.data.library.model.Sort +import ca.gosyer.jui.domain.library.model.FilterState +import ca.gosyer.jui.domain.library.model.Sort class LibraryPreferences(private val preferenceStore: PreferenceStore) { @@ -38,8 +37,8 @@ class LibraryPreferences(private val preferenceStore: PreferenceStore) { return preferenceStore.getBoolean("sort_ascending", true) } - fun displayMode(): Preference { - return preferenceStore.getJsonObject("display_mode", DisplayMode.CompactGrid, DisplayMode.serializer()) + fun displayMode(): Preference { + return preferenceStore.getJsonObject("display_mode", ca.gosyer.jui.domain.library.model.DisplayMode.CompactGrid, ca.gosyer.jui.domain.library.model.DisplayMode.serializer()) } fun gridColumns(): Preference { 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 new file mode 100644 index 00000000..3a72ec21 --- /dev/null +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/library/service/LibraryRepository.kt @@ -0,0 +1,15 @@ +/* + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +package ca.gosyer.jui.domain.library.service + +import io.ktor.client.statement.HttpResponse +import kotlinx.coroutines.flow.Flow + +interface LibraryRepository { + fun addMangaToLibrary(mangaId: Long): Flow + fun removeMangaFromLibrary(mangaId: Long): Flow +} diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/library/LibraryUpdateService.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/library/service/LibraryUpdateService.kt similarity index 80% rename from domain/src/commonMain/kotlin/ca/gosyer/jui/domain/library/LibraryUpdateService.kt rename to domain/src/commonMain/kotlin/ca/gosyer/jui/domain/library/service/LibraryUpdateService.kt index dead6228..ef2dd8be 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/library/LibraryUpdateService.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/library/service/LibraryUpdateService.kt @@ -4,13 +4,13 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package ca.gosyer.jui.domain.library +package ca.gosyer.jui.domain.library.service -import ca.gosyer.jui.data.library.model.UpdateStatus -import ca.gosyer.jui.data.server.Http -import ca.gosyer.jui.data.server.ServerPreferences -import ca.gosyer.jui.data.server.requests.updatesQuery import ca.gosyer.jui.domain.base.WebsocketService +import ca.gosyer.jui.domain.library.model.UpdateStatus +import ca.gosyer.jui.domain.server.Http +import ca.gosyer.jui.domain.server.model.requests.updatesQuery +import ca.gosyer.jui.domain.server.service.ServerPreferences import io.ktor.websocket.Frame import io.ktor.websocket.readText import kotlinx.coroutines.flow.MutableStateFlow diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/manga/interactor/UpdateMangaMeta.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/manga/interactor/UpdateMangaMeta.kt new file mode 100644 index 00000000..abd373b3 --- /dev/null +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/manga/interactor/UpdateMangaMeta.kt @@ -0,0 +1,31 @@ +/* + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +package ca.gosyer.jui.domain.manga.interactor + +import ca.gosyer.jui.domain.manga.model.Manga +import ca.gosyer.jui.domain.manga.service.MangaRepository +import kotlinx.coroutines.flow.emitAll +import kotlinx.coroutines.flow.flow +import me.tatarka.inject.annotations.Inject + +class UpdateMangaMeta @Inject constructor(private val mangaRepository: MangaRepository) { + + fun subscribe( + manga: Manga, + readerMode: String = manga.meta.juiReaderMode + ) = flow { + if (readerMode != manga.meta.juiReaderMode) { + emitAll( + mangaRepository.updateMangaMeta( + manga.id, + "juiReaderMode", + readerMode + ) + ) + } + } +} diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/models/Manga.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/manga/model/Manga.kt similarity index 74% rename from data/src/commonMain/kotlin/ca/gosyer/jui/data/models/Manga.kt rename to domain/src/commonMain/kotlin/ca/gosyer/jui/domain/manga/model/Manga.kt index ee293c6c..e37a39c9 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/models/Manga.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/manga/model/Manga.kt @@ -4,13 +4,11 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package ca.gosyer.jui.data.models +package ca.gosyer.jui.domain.manga.model -import ca.gosyer.jui.data.server.interactions.MangaInteractionHandler +import ca.gosyer.jui.domain.source.model.Source import ca.gosyer.jui.i18n.MR import dev.icerock.moko.resources.StringResource -import kotlinx.coroutines.flow.collect -import kotlinx.coroutines.flow.flow import kotlinx.serialization.Serializable import kotlinx.serialization.Transient @@ -35,18 +33,7 @@ data class Manga( val inLibraryAt: Long, val unreadCount: Int?, val downloadCount: Int? -) { - suspend fun updateRemote( - mangaHandler: MangaInteractionHandler, - readerMode: String = meta.juiReaderMode - ) = flow { - if (readerMode != meta.juiReaderMode) { - mangaHandler.updateMangaMeta(this@Manga, "juiReaderMode", readerMode) - .collect() - } - emit(Unit) - } -} +) @Serializable data class MangaMeta( 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 new file mode 100644 index 00000000..b1df47ca --- /dev/null +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/manga/service/MangaRepository.kt @@ -0,0 +1,19 @@ +/* + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +package ca.gosyer.jui.domain.manga.service + +import ca.gosyer.jui.domain.manga.model.Manga +import io.ktor.client.request.HttpRequestBuilder +import io.ktor.client.statement.HttpResponse +import io.ktor.utils.io.ByteReadChannel +import kotlinx.coroutines.flow.Flow + +interface MangaRepository { + fun getManga(mangaId: Long, refresh: Boolean = false): Flow + fun getMangaThumbnail(mangaId: Long, block: HttpRequestBuilder.() -> Unit): Flow + fun updateMangaMeta(mangaId: Long, key: String, value: String): Flow +} diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/migration/RunMigrations.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/migration/interactor/RunMigrations.kt similarity index 82% rename from domain/src/commonMain/kotlin/ca/gosyer/jui/domain/migration/RunMigrations.kt rename to domain/src/commonMain/kotlin/ca/gosyer/jui/domain/migration/interactor/RunMigrations.kt index db8ef134..e0fea6ee 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/migration/RunMigrations.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/migration/interactor/RunMigrations.kt @@ -4,11 +4,11 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package ca.gosyer.jui.domain.migration +package ca.gosyer.jui.domain.migration.interactor -import ca.gosyer.jui.data.migration.MigrationPreferences -import ca.gosyer.jui.data.reader.ReaderPreferences import ca.gosyer.jui.domain.build.BuildKonfig +import ca.gosyer.jui.domain.migration.service.MigrationPreferences +import ca.gosyer.jui.domain.reader.service.ReaderPreferences import me.tatarka.inject.annotations.Inject class RunMigrations @Inject constructor( diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/migration/MigrationPreferences.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/migration/service/MigrationPreferences.kt similarity index 92% rename from data/src/commonMain/kotlin/ca/gosyer/jui/data/migration/MigrationPreferences.kt rename to domain/src/commonMain/kotlin/ca/gosyer/jui/domain/migration/service/MigrationPreferences.kt index 97ccd6ba..3bea8e9b 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/migration/MigrationPreferences.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/migration/service/MigrationPreferences.kt @@ -4,7 +4,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package ca.gosyer.jui.data.migration +package ca.gosyer.jui.domain.migration.service import ca.gosyer.jui.core.prefs.Preference import ca.gosyer.jui.core.prefs.PreferenceStore diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/reader/ReaderModeWatch.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/reader/ReaderModeWatch.kt index 1643e3b2..5aa112cf 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/reader/ReaderModeWatch.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/reader/ReaderModeWatch.kt @@ -7,8 +7,8 @@ package ca.gosyer.jui.domain.reader import ca.gosyer.jui.core.prefs.getAsFlow -import ca.gosyer.jui.data.reader.ReaderModePreferences -import ca.gosyer.jui.data.reader.ReaderPreferences +import ca.gosyer.jui.domain.reader.service.ReaderModePreferences +import ca.gosyer.jui.domain.reader.service.ReaderPreferences import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Job import kotlinx.coroutines.flow.MutableStateFlow diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/reader/model/DefaultReaderMode.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/reader/model/DefaultReaderMode.kt similarity index 95% rename from data/src/commonMain/kotlin/ca/gosyer/jui/data/reader/model/DefaultReaderMode.kt rename to domain/src/commonMain/kotlin/ca/gosyer/jui/domain/reader/model/DefaultReaderMode.kt index 5689af7a..ab0e1184 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/reader/model/DefaultReaderMode.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/reader/model/DefaultReaderMode.kt @@ -4,7 +4,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package ca.gosyer.jui.data.reader.model +package ca.gosyer.jui.domain.reader.model enum class DefaultReaderMode( val res: String, diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/reader/model/Direction.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/reader/model/Direction.kt similarity index 93% rename from data/src/commonMain/kotlin/ca/gosyer/jui/data/reader/model/Direction.kt rename to domain/src/commonMain/kotlin/ca/gosyer/jui/domain/reader/model/Direction.kt index 76eff29d..727084da 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/reader/model/Direction.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/reader/model/Direction.kt @@ -4,7 +4,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package ca.gosyer.jui.data.reader.model +package ca.gosyer.jui.domain.reader.model import ca.gosyer.jui.i18n.MR import dev.icerock.moko.resources.StringResource diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/reader/model/ImageScale.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/reader/model/ImageScale.kt similarity index 94% rename from data/src/commonMain/kotlin/ca/gosyer/jui/data/reader/model/ImageScale.kt rename to domain/src/commonMain/kotlin/ca/gosyer/jui/domain/reader/model/ImageScale.kt index f2aec8a7..2e6f0e7d 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/reader/model/ImageScale.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/reader/model/ImageScale.kt @@ -4,7 +4,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package ca.gosyer.jui.data.reader.model +package ca.gosyer.jui.domain.reader.model import ca.gosyer.jui.i18n.MR import dev.icerock.moko.resources.StringResource diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/reader/model/NavigationMode.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/reader/model/NavigationMode.kt similarity index 93% rename from data/src/commonMain/kotlin/ca/gosyer/jui/data/reader/model/NavigationMode.kt rename to domain/src/commonMain/kotlin/ca/gosyer/jui/domain/reader/model/NavigationMode.kt index 9d8941ab..6a80d0a7 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/reader/model/NavigationMode.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/reader/model/NavigationMode.kt @@ -4,7 +4,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package ca.gosyer.jui.data.reader.model +package ca.gosyer.jui.domain.reader.model import ca.gosyer.jui.i18n.MR import dev.icerock.moko.resources.StringResource diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/reader/model/TappingInvertMode.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/reader/model/TappingInvertMode.kt similarity index 93% rename from data/src/commonMain/kotlin/ca/gosyer/jui/data/reader/model/TappingInvertMode.kt rename to domain/src/commonMain/kotlin/ca/gosyer/jui/domain/reader/model/TappingInvertMode.kt index 2937e99d..7918dc74 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/reader/model/TappingInvertMode.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/reader/model/TappingInvertMode.kt @@ -4,7 +4,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package ca.gosyer.jui.data.reader.model +package ca.gosyer.jui.domain.reader.model import kotlinx.serialization.Serializable diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/reader/ReaderModePreferences.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/reader/service/ReaderModePreferences.kt similarity index 88% rename from data/src/commonMain/kotlin/ca/gosyer/jui/data/reader/ReaderModePreferences.kt rename to domain/src/commonMain/kotlin/ca/gosyer/jui/domain/reader/service/ReaderModePreferences.kt index 1f4fe4f2..1fa59871 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/reader/ReaderModePreferences.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/reader/service/ReaderModePreferences.kt @@ -4,14 +4,14 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package ca.gosyer.jui.data.reader +package ca.gosyer.jui.domain.reader.service import ca.gosyer.jui.core.prefs.Preference import ca.gosyer.jui.core.prefs.PreferenceStore -import ca.gosyer.jui.data.reader.model.DefaultReaderMode -import ca.gosyer.jui.data.reader.model.Direction -import ca.gosyer.jui.data.reader.model.ImageScale -import ca.gosyer.jui.data.reader.model.NavigationMode +import ca.gosyer.jui.domain.reader.model.DefaultReaderMode +import ca.gosyer.jui.domain.reader.model.Direction +import ca.gosyer.jui.domain.reader.model.ImageScale +import ca.gosyer.jui.domain.reader.model.NavigationMode class ReaderModePreferences(private val mode: String, private val preferenceStore: PreferenceStore) { constructor(mode: String, factory: (String) -> PreferenceStore) : diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/reader/ReaderPreferences.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/reader/service/ReaderPreferences.kt similarity index 91% rename from data/src/commonMain/kotlin/ca/gosyer/jui/data/reader/ReaderPreferences.kt rename to domain/src/commonMain/kotlin/ca/gosyer/jui/domain/reader/service/ReaderPreferences.kt index d029482b..9988ad12 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/reader/ReaderPreferences.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/reader/service/ReaderPreferences.kt @@ -4,11 +4,11 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package ca.gosyer.jui.data.reader +package ca.gosyer.jui.domain.reader.service import ca.gosyer.jui.core.prefs.Preference import ca.gosyer.jui.core.prefs.PreferenceStore -import ca.gosyer.jui.data.reader.model.DefaultReaderMode +import ca.gosyer.jui.domain.reader.model.DefaultReaderMode import kotlinx.serialization.builtins.ListSerializer import kotlinx.serialization.builtins.serializer diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/server/HttpClient.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/server/HttpClient.kt similarity index 94% rename from data/src/commonMain/kotlin/ca/gosyer/jui/data/server/HttpClient.kt rename to domain/src/commonMain/kotlin/ca/gosyer/jui/domain/server/HttpClient.kt index 4b9119f7..0b9a8fd9 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/server/HttpClient.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/server/HttpClient.kt @@ -4,11 +4,12 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package ca.gosyer.jui.data.server +package ca.gosyer.jui.domain.server -import ca.gosyer.jui.data.build.BuildKonfig -import ca.gosyer.jui.data.server.model.Auth -import ca.gosyer.jui.data.server.model.Proxy +import ca.gosyer.jui.domain.build.BuildKonfig +import ca.gosyer.jui.domain.server.model.Auth +import ca.gosyer.jui.domain.server.model.Proxy +import ca.gosyer.jui.domain.server.service.ServerPreferences import io.ktor.client.HttpClient import io.ktor.client.engine.HttpClientEngineConfig import io.ktor.client.engine.HttpClientEngineFactory diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/server/model/Auth.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/server/model/Auth.kt similarity index 88% rename from data/src/commonMain/kotlin/ca/gosyer/jui/data/server/model/Auth.kt rename to domain/src/commonMain/kotlin/ca/gosyer/jui/domain/server/model/Auth.kt index ef4546e4..4b8bf08d 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/server/model/Auth.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/server/model/Auth.kt @@ -4,7 +4,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package ca.gosyer.jui.data.server.model +package ca.gosyer.jui.domain.server.model import kotlinx.serialization.Serializable diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/server/model/Proxy.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/server/model/Proxy.kt similarity index 88% rename from data/src/commonMain/kotlin/ca/gosyer/jui/data/server/model/Proxy.kt rename to domain/src/commonMain/kotlin/ca/gosyer/jui/domain/server/model/Proxy.kt index 4cf80064..02c920cf 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/server/model/Proxy.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/server/model/Proxy.kt @@ -4,7 +4,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package ca.gosyer.jui.data.server.model +package ca.gosyer.jui.domain.server.model import kotlinx.serialization.Serializable diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/server/ServerUrlPreference.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/server/model/ServerUrlPreference.kt similarity index 98% rename from data/src/commonMain/kotlin/ca/gosyer/jui/data/server/ServerUrlPreference.kt rename to domain/src/commonMain/kotlin/ca/gosyer/jui/domain/server/model/ServerUrlPreference.kt index 898f76cb..f3b297b1 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/server/ServerUrlPreference.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/server/model/ServerUrlPreference.kt @@ -4,7 +4,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package ca.gosyer.jui.data.server +package ca.gosyer.jui.domain.server.model import ca.gosyer.jui.core.prefs.Preference import ca.gosyer.jui.core.prefs.getAsFlow diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/server/requests/Backup.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/server/model/requests/Backup.kt similarity index 91% rename from data/src/commonMain/kotlin/ca/gosyer/jui/data/server/requests/Backup.kt rename to domain/src/commonMain/kotlin/ca/gosyer/jui/domain/server/model/requests/Backup.kt index bed60203..e852d8ab 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/server/requests/Backup.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/server/model/requests/Backup.kt @@ -4,7 +4,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package ca.gosyer.jui.data.server.requests +package ca.gosyer.jui.domain.server.model.requests @Post fun backupImportRequest() = diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/server/requests/Category.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/server/model/requests/Category.kt similarity index 95% rename from data/src/commonMain/kotlin/ca/gosyer/jui/data/server/requests/Category.kt rename to domain/src/commonMain/kotlin/ca/gosyer/jui/domain/server/model/requests/Category.kt index 7b5aea01..409e3c72 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/server/requests/Category.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/server/model/requests/Category.kt @@ -4,7 +4,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package ca.gosyer.jui.data.server.requests +package ca.gosyer.jui.domain.server.model.requests @Get fun getMangaCategoriesQuery(mangaId: Long) = diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/server/requests/Chapters.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/server/model/requests/Chapters.kt similarity index 95% rename from data/src/commonMain/kotlin/ca/gosyer/jui/data/server/requests/Chapters.kt rename to domain/src/commonMain/kotlin/ca/gosyer/jui/domain/server/model/requests/Chapters.kt index a4761107..e02b858a 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/server/requests/Chapters.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/server/model/requests/Chapters.kt @@ -4,7 +4,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package ca.gosyer.jui.data.server.requests +package ca.gosyer.jui.domain.server.model.requests @Get fun getMangaChaptersQuery(mangaId: Long) = diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/server/requests/Downloads.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/server/model/requests/Downloads.kt similarity index 90% rename from data/src/commonMain/kotlin/ca/gosyer/jui/data/server/requests/Downloads.kt rename to domain/src/commonMain/kotlin/ca/gosyer/jui/domain/server/model/requests/Downloads.kt index e59195ec..927f3425 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/server/requests/Downloads.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/server/model/requests/Downloads.kt @@ -4,7 +4,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package ca.gosyer.jui.data.server.requests +package ca.gosyer.jui.domain.server.model.requests @WS fun downloadsQuery() = diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/server/requests/Extensions.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/server/model/requests/Extensions.kt similarity index 92% rename from data/src/commonMain/kotlin/ca/gosyer/jui/data/server/requests/Extensions.kt rename to domain/src/commonMain/kotlin/ca/gosyer/jui/domain/server/model/requests/Extensions.kt index b9606659..a252b3e7 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/server/requests/Extensions.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/server/model/requests/Extensions.kt @@ -4,7 +4,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package ca.gosyer.jui.data.server.requests +package ca.gosyer.jui.domain.server.model.requests @Get fun extensionListQuery() = diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/server/requests/Library.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/server/model/requests/Library.kt similarity index 88% rename from data/src/commonMain/kotlin/ca/gosyer/jui/data/server/requests/Library.kt rename to domain/src/commonMain/kotlin/ca/gosyer/jui/domain/server/model/requests/Library.kt index e37b25a0..2c871047 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/server/requests/Library.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/server/model/requests/Library.kt @@ -4,7 +4,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package ca.gosyer.jui.data.server.requests +package ca.gosyer.jui.domain.server.model.requests @Get fun addMangaToLibraryQuery(mangaId: Long) = diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/server/requests/Manga.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/server/model/requests/Manga.kt similarity index 89% rename from data/src/commonMain/kotlin/ca/gosyer/jui/data/server/requests/Manga.kt rename to domain/src/commonMain/kotlin/ca/gosyer/jui/domain/server/model/requests/Manga.kt index 54651721..5a572384 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/server/requests/Manga.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/server/model/requests/Manga.kt @@ -4,7 +4,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package ca.gosyer.jui.data.server.requests +package ca.gosyer.jui.domain.server.model.requests @Get fun mangaQuery(mangaId: Long) = diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/server/requests/RestRequests.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/server/model/requests/RestRequests.kt similarity index 86% rename from data/src/commonMain/kotlin/ca/gosyer/jui/data/server/requests/RestRequests.kt rename to domain/src/commonMain/kotlin/ca/gosyer/jui/domain/server/model/requests/RestRequests.kt index a76ecd2d..c3f98d71 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/server/requests/RestRequests.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/server/model/requests/RestRequests.kt @@ -4,7 +4,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package ca.gosyer.jui.data.server.requests +package ca.gosyer.jui.domain.server.model.requests annotation class Get diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/server/requests/Settings.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/server/model/requests/Settings.kt similarity index 86% rename from data/src/commonMain/kotlin/ca/gosyer/jui/data/server/requests/Settings.kt rename to domain/src/commonMain/kotlin/ca/gosyer/jui/domain/server/model/requests/Settings.kt index 6c615285..2b16a172 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/server/requests/Settings.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/server/model/requests/Settings.kt @@ -4,7 +4,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package ca.gosyer.jui.data.server.requests +package ca.gosyer.jui.domain.server.model.requests @Get fun aboutQuery() = diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/server/requests/Sources.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/server/model/requests/Sources.kt similarity index 95% rename from data/src/commonMain/kotlin/ca/gosyer/jui/data/server/requests/Sources.kt rename to domain/src/commonMain/kotlin/ca/gosyer/jui/domain/server/model/requests/Sources.kt index ce847623..11b13f1f 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/server/requests/Sources.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/server/model/requests/Sources.kt @@ -4,7 +4,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package ca.gosyer.jui.data.server.requests +package ca.gosyer.jui.domain.server.model.requests @Get fun sourceListQuery() = diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/server/requests/Updates.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/server/model/requests/Updates.kt similarity index 90% rename from data/src/commonMain/kotlin/ca/gosyer/jui/data/server/requests/Updates.kt rename to domain/src/commonMain/kotlin/ca/gosyer/jui/domain/server/model/requests/Updates.kt index bcafd026..d6360b26 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/server/requests/Updates.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/server/model/requests/Updates.kt @@ -4,7 +4,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package ca.gosyer.jui.data.server.requests +package ca.gosyer.jui.domain.server.model.requests @Get fun recentUpdatesQuery(pageNum: Int) = diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/server/ServerPreferences.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/server/service/ServerPreferences.kt similarity index 89% rename from data/src/commonMain/kotlin/ca/gosyer/jui/data/server/ServerPreferences.kt rename to domain/src/commonMain/kotlin/ca/gosyer/jui/domain/server/service/ServerPreferences.kt index 8efbe085..8ad4b6ff 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/server/ServerPreferences.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/server/service/ServerPreferences.kt @@ -4,12 +4,13 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package ca.gosyer.jui.data.server +package ca.gosyer.jui.domain.server.service import ca.gosyer.jui.core.prefs.Preference import ca.gosyer.jui.core.prefs.PreferenceStore -import ca.gosyer.jui.data.server.model.Auth -import ca.gosyer.jui.data.server.model.Proxy +import ca.gosyer.jui.domain.server.model.Auth +import ca.gosyer.jui.domain.server.model.Proxy +import ca.gosyer.jui.domain.server.model.ServerUrlPreference import io.ktor.http.Url class ServerPreferences(private val preferenceStore: PreferenceStore) { diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/models/About.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/settings/model/About.kt similarity index 92% rename from data/src/commonMain/kotlin/ca/gosyer/jui/data/models/About.kt rename to domain/src/commonMain/kotlin/ca/gosyer/jui/domain/settings/model/About.kt index d7e51cb8..25f43e3c 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/models/About.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/settings/model/About.kt @@ -4,7 +4,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package ca.gosyer.jui.data.models +package ca.gosyer.jui.domain.settings.model import kotlinx.serialization.Serializable diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/settings/service/SettingsRepository.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/settings/service/SettingsRepository.kt new file mode 100644 index 00000000..29e46f1c --- /dev/null +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/settings/service/SettingsRepository.kt @@ -0,0 +1,16 @@ +/* + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +package ca.gosyer.jui.domain.settings.service + +import ca.gosyer.jui.domain.settings.model.About +import io.ktor.client.statement.HttpResponse +import kotlinx.coroutines.flow.Flow + +interface SettingsRepository { + fun aboutServer(): Flow + fun checkUpdate(): Flow +} diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/models/MangaPage.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/MangaPage.kt similarity index 80% rename from data/src/commonMain/kotlin/ca/gosyer/jui/data/models/MangaPage.kt rename to domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/MangaPage.kt index 7efe4f1b..e58810b1 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/models/MangaPage.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/MangaPage.kt @@ -4,8 +4,9 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package ca.gosyer.jui.data.models +package ca.gosyer.jui.domain.source.model +import ca.gosyer.jui.domain.manga.model.Manga import kotlinx.serialization.Serializable @Serializable diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/models/Source.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/Source.kt similarity index 95% rename from data/src/commonMain/kotlin/ca/gosyer/jui/data/models/Source.kt rename to domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/Source.kt index 7697fb74..3f5285ea 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/models/Source.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/Source.kt @@ -4,7 +4,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package ca.gosyer.jui.data.models +package ca.gosyer.jui.domain.source.model import kotlinx.serialization.Serializable import ca.gosyer.jui.core.io.Serializable as JvmSerializable diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/models/sourcefilters/CheckBoxFilter.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcefilters/CheckBoxFilter.kt similarity index 90% rename from data/src/commonMain/kotlin/ca/gosyer/jui/data/models/sourcefilters/CheckBoxFilter.kt rename to domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcefilters/CheckBoxFilter.kt index 04776d97..a871cdce 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/models/sourcefilters/CheckBoxFilter.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcefilters/CheckBoxFilter.kt @@ -4,7 +4,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package ca.gosyer.jui.data.models.sourcefilters +package ca.gosyer.jui.domain.source.model.sourcefilters import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/models/sourcefilters/GroupFilter.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcefilters/GroupFilter.kt similarity index 91% rename from data/src/commonMain/kotlin/ca/gosyer/jui/data/models/sourcefilters/GroupFilter.kt rename to domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcefilters/GroupFilter.kt index 859b9f7f..aaf2d46b 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/models/sourcefilters/GroupFilter.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcefilters/GroupFilter.kt @@ -4,7 +4,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package ca.gosyer.jui.data.models.sourcefilters +package ca.gosyer.jui.domain.source.model.sourcefilters import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/models/sourcefilters/HeaderFilter.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcefilters/HeaderFilter.kt similarity index 91% rename from data/src/commonMain/kotlin/ca/gosyer/jui/data/models/sourcefilters/HeaderFilter.kt rename to domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcefilters/HeaderFilter.kt index 670588de..143ac688 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/models/sourcefilters/HeaderFilter.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcefilters/HeaderFilter.kt @@ -4,7 +4,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package ca.gosyer.jui.data.models.sourcefilters +package ca.gosyer.jui.domain.source.model.sourcefilters import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/models/sourcefilters/SelectFilter.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcefilters/SelectFilter.kt similarity index 92% rename from data/src/commonMain/kotlin/ca/gosyer/jui/data/models/sourcefilters/SelectFilter.kt rename to domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcefilters/SelectFilter.kt index 57c53e89..40b389cd 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/models/sourcefilters/SelectFilter.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcefilters/SelectFilter.kt @@ -4,7 +4,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package ca.gosyer.jui.data.models.sourcefilters +package ca.gosyer.jui.domain.source.model.sourcefilters import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/models/sourcefilters/SeparatorFilter.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcefilters/SeparatorFilter.kt similarity index 91% rename from data/src/commonMain/kotlin/ca/gosyer/jui/data/models/sourcefilters/SeparatorFilter.kt rename to domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcefilters/SeparatorFilter.kt index dbdd859a..b0479a87 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/models/sourcefilters/SeparatorFilter.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcefilters/SeparatorFilter.kt @@ -4,7 +4,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package ca.gosyer.jui.data.models.sourcefilters +package ca.gosyer.jui.domain.source.model.sourcefilters import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/models/sourcefilters/SortFilter.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcefilters/SortFilter.kt similarity index 92% rename from data/src/commonMain/kotlin/ca/gosyer/jui/data/models/sourcefilters/SortFilter.kt rename to domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcefilters/SortFilter.kt index 982c71e7..a617cb30 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/models/sourcefilters/SortFilter.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcefilters/SortFilter.kt @@ -4,7 +4,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package ca.gosyer.jui.data.models.sourcefilters +package ca.gosyer.jui.domain.source.model.sourcefilters import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/models/sourcefilters/SourceFilter.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcefilters/SourceFilter.kt similarity index 87% rename from data/src/commonMain/kotlin/ca/gosyer/jui/data/models/sourcefilters/SourceFilter.kt rename to domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcefilters/SourceFilter.kt index 933ffff4..a708c2bb 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/models/sourcefilters/SourceFilter.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcefilters/SourceFilter.kt @@ -4,7 +4,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package ca.gosyer.jui.data.models.sourcefilters +package ca.gosyer.jui.domain.source.model.sourcefilters import kotlinx.serialization.Serializable diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/models/sourcefilters/SourceFilterChange.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcefilters/SourceFilterChange.kt similarity index 91% rename from data/src/commonMain/kotlin/ca/gosyer/jui/data/models/sourcefilters/SourceFilterChange.kt rename to domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcefilters/SourceFilterChange.kt index fd7c1265..31d9e742 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/models/sourcefilters/SourceFilterChange.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcefilters/SourceFilterChange.kt @@ -4,7 +4,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package ca.gosyer.jui.data.models.sourcefilters +package ca.gosyer.jui.domain.source.model.sourcefilters import kotlinx.serialization.Serializable import kotlinx.serialization.encodeToString diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/models/sourcefilters/TextFilter.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcefilters/TextFilter.kt similarity index 90% rename from data/src/commonMain/kotlin/ca/gosyer/jui/data/models/sourcefilters/TextFilter.kt rename to domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcefilters/TextFilter.kt index 52093452..ad39d655 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/models/sourcefilters/TextFilter.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcefilters/TextFilter.kt @@ -4,7 +4,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package ca.gosyer.jui.data.models.sourcefilters +package ca.gosyer.jui.domain.source.model.sourcefilters import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/models/sourcefilters/TriStateFilter.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcefilters/TriStateFilter.kt similarity index 90% rename from data/src/commonMain/kotlin/ca/gosyer/jui/data/models/sourcefilters/TriStateFilter.kt rename to domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcefilters/TriStateFilter.kt index f88e55a2..16f7ea1c 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/models/sourcefilters/TriStateFilter.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcefilters/TriStateFilter.kt @@ -4,7 +4,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package ca.gosyer.jui.data.models.sourcefilters +package ca.gosyer.jui.domain.source.model.sourcefilters import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/models/sourcepreference/CheckBoxPreference.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcepreference/CheckBoxPreference.kt similarity index 88% rename from data/src/commonMain/kotlin/ca/gosyer/jui/data/models/sourcepreference/CheckBoxPreference.kt rename to domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcepreference/CheckBoxPreference.kt index e22bbad8..621832a6 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/models/sourcepreference/CheckBoxPreference.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcepreference/CheckBoxPreference.kt @@ -4,7 +4,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package ca.gosyer.jui.data.models.sourcepreference +package ca.gosyer.jui.domain.source.model.sourcepreference import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/models/sourcepreference/EditTextPreference.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcepreference/EditTextPreference.kt similarity index 93% rename from data/src/commonMain/kotlin/ca/gosyer/jui/data/models/sourcepreference/EditTextPreference.kt rename to domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcepreference/EditTextPreference.kt index ffa7ae7b..7f5fc964 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/models/sourcepreference/EditTextPreference.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcepreference/EditTextPreference.kt @@ -4,7 +4,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package ca.gosyer.jui.data.models.sourcepreference +package ca.gosyer.jui.domain.source.model.sourcepreference import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/models/sourcepreference/ListPreference.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcepreference/ListPreference.kt similarity index 93% rename from data/src/commonMain/kotlin/ca/gosyer/jui/data/models/sourcepreference/ListPreference.kt rename to domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcepreference/ListPreference.kt index 7b9b5326..f5e25c6d 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/models/sourcepreference/ListPreference.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcepreference/ListPreference.kt @@ -4,7 +4,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package ca.gosyer.jui.data.models.sourcepreference +package ca.gosyer.jui.domain.source.model.sourcepreference import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/models/sourcepreference/MultiSelectListPreference.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcepreference/MultiSelectListPreference.kt similarity index 94% rename from data/src/commonMain/kotlin/ca/gosyer/jui/data/models/sourcepreference/MultiSelectListPreference.kt rename to domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcepreference/MultiSelectListPreference.kt index 389f223a..a465f1f1 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/models/sourcepreference/MultiSelectListPreference.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcepreference/MultiSelectListPreference.kt @@ -4,7 +4,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package ca.gosyer.jui.data.models.sourcepreference +package ca.gosyer.jui.domain.source.model.sourcepreference import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/models/sourcepreference/SourcePreference.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcepreference/SourcePreference.kt similarity index 89% rename from data/src/commonMain/kotlin/ca/gosyer/jui/data/models/sourcepreference/SourcePreference.kt rename to domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcepreference/SourcePreference.kt index ac09814c..ba31221b 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/models/sourcepreference/SourcePreference.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcepreference/SourcePreference.kt @@ -4,7 +4,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package ca.gosyer.jui.data.models.sourcepreference +package ca.gosyer.jui.domain.source.model.sourcepreference import kotlinx.serialization.Serializable diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/models/sourcepreference/SourcePreferenceChange.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcepreference/SourcePreferenceChange.kt similarity index 91% rename from data/src/commonMain/kotlin/ca/gosyer/jui/data/models/sourcepreference/SourcePreferenceChange.kt rename to domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcepreference/SourcePreferenceChange.kt index afb029a2..99411cf2 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/models/sourcepreference/SourcePreferenceChange.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcepreference/SourcePreferenceChange.kt @@ -4,7 +4,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package ca.gosyer.jui.data.models.sourcepreference +package ca.gosyer.jui.domain.source.model.sourcepreference import kotlinx.serialization.Serializable import kotlinx.serialization.encodeToString diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/models/sourcepreference/SwitchPreference.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcepreference/SwitchPreference.kt similarity index 88% rename from data/src/commonMain/kotlin/ca/gosyer/jui/data/models/sourcepreference/SwitchPreference.kt rename to domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcepreference/SwitchPreference.kt index ba887f0c..b2751cd7 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/models/sourcepreference/SwitchPreference.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcepreference/SwitchPreference.kt @@ -4,7 +4,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package ca.gosyer.jui.data.models.sourcepreference +package ca.gosyer.jui.domain.source.model.sourcepreference import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/models/sourcepreference/TwoStateProps.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcepreference/TwoStateProps.kt similarity index 90% rename from data/src/commonMain/kotlin/ca/gosyer/jui/data/models/sourcepreference/TwoStateProps.kt rename to domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcepreference/TwoStateProps.kt index a4a4cff6..aa58b5eb 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/models/sourcepreference/TwoStateProps.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcepreference/TwoStateProps.kt @@ -4,7 +4,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package ca.gosyer.jui.data.models.sourcepreference +package ca.gosyer.jui.domain.source.model.sourcepreference import kotlinx.serialization.Serializable diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/catalog/CatalogPreferences.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/service/CatalogPreferences.kt similarity index 88% rename from data/src/commonMain/kotlin/ca/gosyer/jui/data/catalog/CatalogPreferences.kt rename to domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/service/CatalogPreferences.kt index 7311a758..79aabd0a 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/catalog/CatalogPreferences.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/service/CatalogPreferences.kt @@ -4,12 +4,12 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package ca.gosyer.jui.data.catalog +package ca.gosyer.jui.domain.source.service import androidx.compose.ui.text.intl.Locale import ca.gosyer.jui.core.prefs.Preference import ca.gosyer.jui.core.prefs.PreferenceStore -import ca.gosyer.jui.data.library.model.DisplayMode +import ca.gosyer.jui.domain.library.model.DisplayMode class CatalogPreferences(private val preferenceStore: PreferenceStore) { fun languages(): Preference> { 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 new file mode 100644 index 00000000..371e3b2d --- /dev/null +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/service/SourceRepository.kt @@ -0,0 +1,31 @@ +/* + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +package ca.gosyer.jui.domain.source.service + +import ca.gosyer.jui.domain.source.model.MangaPage +import ca.gosyer.jui.domain.source.model.Source +import ca.gosyer.jui.domain.source.model.sourcefilters.SourceFilter +import ca.gosyer.jui.domain.source.model.sourcefilters.SourceFilterChange +import ca.gosyer.jui.domain.source.model.sourcepreference.SourcePreference +import ca.gosyer.jui.domain.source.model.sourcepreference.SourcePreferenceChange +import io.ktor.client.statement.HttpResponse +import kotlinx.coroutines.flow.Flow + +interface SourceRepository { + fun getSourceList(): Flow> + fun getSourceInfo(sourceId: Long): Flow + fun getPopularManga(sourceId: Long, pageNum: Int): Flow + fun getLatestManga(sourceId: Long, pageNum: Int): Flow + fun getSearchResults(sourceId: Long, searchTerm: String, pageNum: Int): Flow + fun getFilterList(sourceId: Long, reset: Boolean = false): Flow> + fun setFilter(sourceId: Long, sourceFilter: SourceFilterChange): Flow + fun setFilter(sourceId: Long, position: Int, value: Any): Flow + fun setFilter(sourceId: Long, parentPosition: Int, childPosition: Int, value: Any): Flow + fun getSourceSettings(sourceId: Long): Flow> + fun setSourceSetting(sourceId: Long, sourcePreference: SourcePreferenceChange): Flow + fun setSourceSetting(sourceId: Long, position: Int, value: Any): Flow +} diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/ui/model/StartScreen.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/ui/model/StartScreen.kt similarity index 90% rename from data/src/commonMain/kotlin/ca/gosyer/jui/data/ui/model/StartScreen.kt rename to domain/src/commonMain/kotlin/ca/gosyer/jui/domain/ui/model/StartScreen.kt index 853c37a8..ceb5450c 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/ui/model/StartScreen.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/ui/model/StartScreen.kt @@ -4,7 +4,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package ca.gosyer.jui.data.ui.model +package ca.gosyer.jui.domain.ui.model import kotlinx.serialization.Serializable diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/ui/model/ThemeMode.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/ui/model/ThemeMode.kt similarity index 89% rename from data/src/commonMain/kotlin/ca/gosyer/jui/data/ui/model/ThemeMode.kt rename to domain/src/commonMain/kotlin/ca/gosyer/jui/domain/ui/model/ThemeMode.kt index f74867f2..6d0508a0 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/ui/model/ThemeMode.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/ui/model/ThemeMode.kt @@ -4,7 +4,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package ca.gosyer.jui.data.ui.model +package ca.gosyer.jui.domain.ui.model import kotlinx.serialization.Serializable diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/ui/model/WindowSettings.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/ui/model/WindowSettings.kt similarity index 92% rename from data/src/commonMain/kotlin/ca/gosyer/jui/data/ui/model/WindowSettings.kt rename to domain/src/commonMain/kotlin/ca/gosyer/jui/domain/ui/model/WindowSettings.kt index ba88253b..d3db2e48 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/ui/model/WindowSettings.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/ui/model/WindowSettings.kt @@ -4,7 +4,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package ca.gosyer.jui.data.ui.model +package ca.gosyer.jui.domain.ui.model import kotlinx.serialization.Serializable diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/ui/UiPreferences.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/ui/service/UiPreferences.kt similarity index 91% rename from data/src/commonMain/kotlin/ca/gosyer/jui/data/ui/UiPreferences.kt rename to domain/src/commonMain/kotlin/ca/gosyer/jui/domain/ui/service/UiPreferences.kt index c895d39c..f6297bd6 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/ui/UiPreferences.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/ui/service/UiPreferences.kt @@ -4,13 +4,13 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package ca.gosyer.jui.data.ui +package ca.gosyer.jui.domain.ui.service import ca.gosyer.jui.core.prefs.Preference import ca.gosyer.jui.core.prefs.PreferenceStore -import ca.gosyer.jui.data.ui.model.StartScreen -import ca.gosyer.jui.data.ui.model.ThemeMode -import ca.gosyer.jui.data.ui.model.WindowSettings +import ca.gosyer.jui.domain.ui.model.StartScreen +import ca.gosyer.jui.domain.ui.model.ThemeMode +import ca.gosyer.jui.domain.ui.model.WindowSettings class UiPreferences(private val preferenceStore: PreferenceStore) { diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/update/UpdateChecker.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/updates/interactor/UpdateChecker.kt similarity index 92% rename from domain/src/commonMain/kotlin/ca/gosyer/jui/domain/update/UpdateChecker.kt rename to domain/src/commonMain/kotlin/ca/gosyer/jui/domain/updates/interactor/UpdateChecker.kt index 5e7d9e1f..13023ae0 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/update/UpdateChecker.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/updates/interactor/UpdateChecker.kt @@ -4,13 +4,13 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package ca.gosyer.jui.domain.update +package ca.gosyer.jui.domain.updates.interactor import ca.gosyer.jui.core.lang.IO -import ca.gosyer.jui.data.server.Http -import ca.gosyer.jui.data.update.UpdatePreferences -import ca.gosyer.jui.data.update.model.GithubRelease import ca.gosyer.jui.domain.build.BuildKonfig +import ca.gosyer.jui.domain.server.Http +import ca.gosyer.jui.domain.updates.model.GithubRelease +import ca.gosyer.jui.domain.updates.service.UpdatePreferences import io.ktor.client.call.body import io.ktor.client.request.get import kotlinx.coroutines.Dispatchers diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/update/model/GithubRelease.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/updates/model/GithubRelease.kt similarity index 91% rename from data/src/commonMain/kotlin/ca/gosyer/jui/data/update/model/GithubRelease.kt rename to domain/src/commonMain/kotlin/ca/gosyer/jui/domain/updates/model/GithubRelease.kt index 1d4ab2a9..250a0f58 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/update/model/GithubRelease.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/updates/model/GithubRelease.kt @@ -4,7 +4,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package ca.gosyer.jui.data.update.model +package ca.gosyer.jui.domain.updates.model import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/models/MangaAndChapter.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/updates/model/MangaAndChapter.kt similarity index 71% rename from data/src/commonMain/kotlin/ca/gosyer/jui/data/models/MangaAndChapter.kt rename to domain/src/commonMain/kotlin/ca/gosyer/jui/domain/updates/model/MangaAndChapter.kt index 46e4010b..19873634 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/models/MangaAndChapter.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/updates/model/MangaAndChapter.kt @@ -4,8 +4,10 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package ca.gosyer.jui.data.models +package ca.gosyer.jui.domain.updates.model +import ca.gosyer.jui.domain.chapter.model.Chapter +import ca.gosyer.jui.domain.manga.model.Manga import kotlinx.serialization.Serializable @Serializable diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/models/Updates.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/updates/model/Updates.kt similarity index 89% rename from data/src/commonMain/kotlin/ca/gosyer/jui/data/models/Updates.kt rename to domain/src/commonMain/kotlin/ca/gosyer/jui/domain/updates/model/Updates.kt index b3424d49..9c0ab5b7 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/models/Updates.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/updates/model/Updates.kt @@ -4,7 +4,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package ca.gosyer.jui.data.models +package ca.gosyer.jui.domain.updates.model import kotlinx.serialization.Serializable diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/update/UpdatePreferences.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/updates/service/UpdatePreferences.kt similarity index 91% rename from data/src/commonMain/kotlin/ca/gosyer/jui/data/update/UpdatePreferences.kt rename to domain/src/commonMain/kotlin/ca/gosyer/jui/domain/updates/service/UpdatePreferences.kt index f39374d7..f5d1dd95 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/update/UpdatePreferences.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/updates/service/UpdatePreferences.kt @@ -4,7 +4,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package ca.gosyer.jui.data.update +package ca.gosyer.jui.domain.updates.service import ca.gosyer.jui.core.prefs.Preference import ca.gosyer.jui.core.prefs.PreferenceStore 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 new file mode 100644 index 00000000..24e27023 --- /dev/null +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/updates/service/UpdatesRepository.kt @@ -0,0 +1,17 @@ +/* + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +package ca.gosyer.jui.domain.updates.service + +import ca.gosyer.jui.domain.updates.model.Updates +import io.ktor.client.statement.HttpResponse +import kotlinx.coroutines.flow.Flow + +interface UpdatesRepository { + fun getRecentUpdates(pageNum: Int): Flow + fun updateLibrary(): Flow + fun updateCategory(categoryId: Long): Flow +} diff --git a/domain/src/desktopMain/kotlin/ca/gosyer/jui/domain/DomainComponent.kt b/domain/src/desktopMain/kotlin/ca/gosyer/jui/domain/DomainComponent.kt index 35cf5a69..278872ee 100644 --- a/domain/src/desktopMain/kotlin/ca/gosyer/jui/domain/DomainComponent.kt +++ b/domain/src/desktopMain/kotlin/ca/gosyer/jui/domain/DomainComponent.kt @@ -6,27 +6,114 @@ package ca.gosyer.jui.domain +import ca.gosyer.jui.core.CoreComponent import ca.gosyer.jui.core.di.AppScope -import ca.gosyer.jui.data.DataComponent -import ca.gosyer.jui.domain.download.DownloadService -import ca.gosyer.jui.domain.library.LibraryUpdateService -import ca.gosyer.jui.domain.migration.RunMigrations -import ca.gosyer.jui.domain.server.ServerService -import ca.gosyer.jui.domain.update.UpdateChecker +import ca.gosyer.jui.domain.download.service.DownloadService +import ca.gosyer.jui.domain.extension.service.ExtensionPreferences +import ca.gosyer.jui.domain.library.service.LibraryPreferences +import ca.gosyer.jui.domain.library.service.LibraryUpdateService +import ca.gosyer.jui.domain.migration.interactor.RunMigrations +import ca.gosyer.jui.domain.migration.service.MigrationPreferences +import ca.gosyer.jui.domain.reader.service.ReaderPreferences +import ca.gosyer.jui.domain.server.Http +import ca.gosyer.jui.domain.server.HttpProvider +import ca.gosyer.jui.domain.server.service.ServerHostPreferences +import ca.gosyer.jui.domain.server.service.ServerPreferences +import ca.gosyer.jui.domain.server.service.ServerService +import ca.gosyer.jui.domain.source.service.CatalogPreferences +import ca.gosyer.jui.domain.ui.service.UiPreferences +import ca.gosyer.jui.domain.updates.interactor.UpdateChecker +import ca.gosyer.jui.domain.updates.service.UpdatePreferences import me.tatarka.inject.annotations.Provides -actual interface DomainComponent : DataComponent { +actual interface DomainComponent : CoreComponent { - val downloadService: DownloadService - - val libraryUpdateService: LibraryUpdateService + // Providers + val httpProvider: HttpProvider + // Factories val migrations: RunMigrations val updateChecker: UpdateChecker + // Singletons + val downloadService: DownloadService + + val libraryUpdateService: LibraryUpdateService + val serverService: ServerService + val http: Http + + val serverHostPreferences: ServerHostPreferences + + val serverPreferences: ServerPreferences + + val extensionPreferences: ExtensionPreferences + + val catalogPreferences: CatalogPreferences + + val libraryPreferences: LibraryPreferences + + val readerPreferences: ReaderPreferences + + val uiPreferences: UiPreferences + + val migrationPreferences: MigrationPreferences + + val updatePreferences: UpdatePreferences + + @get:AppScope + @get:Provides + val serverHostPreferencesFactory: ServerHostPreferences + get() = ServerHostPreferences(preferenceFactory.create("host")) + + @get:AppScope + @get:Provides + val serverPreferencesFactory: ServerPreferences + get() = ServerPreferences(preferenceFactory.create("server")) + + @get:AppScope + @get:Provides + val extensionPreferencesFactory: ExtensionPreferences + get() = ExtensionPreferences(preferenceFactory.create("extension")) + + @get:AppScope + @get:Provides + val catalogPreferencesFactory: CatalogPreferences + get() = CatalogPreferences(preferenceFactory.create("catalog")) + + @get:AppScope + @get:Provides + val libraryPreferencesFactory: LibraryPreferences + get() = LibraryPreferences(preferenceFactory.create("library")) + + @get:AppScope + @get:Provides + val readerPreferencesFactory: ReaderPreferences + get() = ReaderPreferences(preferenceFactory.create("reader")) { name -> + preferenceFactory.create("reader", name) + } + + @get:AppScope + @get:Provides + val uiPreferencesFactory: UiPreferences + get() = UiPreferences(preferenceFactory.create("ui")) + + @get:AppScope + @get:Provides + val migrationPreferencesFactory: MigrationPreferences + get() = MigrationPreferences(preferenceFactory.create("migration")) + + @get:AppScope + @get:Provides + val updatePreferencesFactory: UpdatePreferences + get() = UpdatePreferences(preferenceFactory.create("update")) + + @get:AppScope + @get:Provides + val httpFactory: Http + get() = httpProvider.get(serverPreferences) @get:AppScope @get:Provides @@ -43,13 +130,5 @@ actual interface DomainComponent : DataComponent { val downloadServiceFactory: DownloadService get() = DownloadService(serverPreferences, http) - @get:AppScope - @get:Provides - val migrationsFactory: RunMigrations - get() = RunMigrations(migrationPreferences, readerPreferences) - - @get:AppScope - @get:Provides - val updateCheckerFactory: UpdateChecker - get() = UpdateChecker(updatePreferences, http) -} \ No newline at end of file + companion object +} diff --git a/data/src/desktopMain/kotlin/ca/gosyer/jui/data/server/ServerHostPreferences.kt b/domain/src/desktopMain/kotlin/ca/gosyer/jui/domain/server/service/ServerHostPreferences.kt similarity index 96% rename from data/src/desktopMain/kotlin/ca/gosyer/jui/data/server/ServerHostPreferences.kt rename to domain/src/desktopMain/kotlin/ca/gosyer/jui/domain/server/service/ServerHostPreferences.kt index 22256cb0..247fb1c6 100644 --- a/data/src/desktopMain/kotlin/ca/gosyer/jui/data/server/ServerHostPreferences.kt +++ b/domain/src/desktopMain/kotlin/ca/gosyer/jui/domain/server/service/ServerHostPreferences.kt @@ -4,11 +4,11 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package ca.gosyer.jui.data.server +package ca.gosyer.jui.domain.server.service import ca.gosyer.jui.core.prefs.Preference import ca.gosyer.jui.core.prefs.PreferenceStore -import ca.gosyer.jui.data.server.host.ServerHostPreference +import ca.gosyer.jui.domain.server.service.host.ServerHostPreference class ServerHostPreferences(private val preferenceStore: PreferenceStore) { diff --git a/domain/src/desktopMain/kotlin/ca/gosyer/jui/domain/server/ServerService.kt b/domain/src/desktopMain/kotlin/ca/gosyer/jui/domain/server/service/ServerService.kt similarity index 98% rename from domain/src/desktopMain/kotlin/ca/gosyer/jui/domain/server/ServerService.kt rename to domain/src/desktopMain/kotlin/ca/gosyer/jui/domain/server/service/ServerService.kt index 3df71ae2..26fbfc43 100644 --- a/domain/src/desktopMain/kotlin/ca/gosyer/jui/domain/server/ServerService.kt +++ b/domain/src/desktopMain/kotlin/ca/gosyer/jui/domain/server/service/ServerService.kt @@ -4,12 +4,11 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package ca.gosyer.jui.domain.server +package ca.gosyer.jui.domain.server.service import ca.gosyer.jui.core.io.copyTo import ca.gosyer.jui.core.io.userDataDir import ca.gosyer.jui.core.lang.withIOContext -import ca.gosyer.jui.data.server.ServerHostPreferences import ca.gosyer.jui.domain.build.BuildKonfig import kotlinx.coroutines.CoroutineExceptionHandler import kotlinx.coroutines.CoroutineScope diff --git a/data/src/desktopMain/kotlin/ca/gosyer/jui/data/server/host/ServerHostPreference.kt b/domain/src/desktopMain/kotlin/ca/gosyer/jui/domain/server/service/host/ServerHostPreference.kt similarity index 98% rename from data/src/desktopMain/kotlin/ca/gosyer/jui/data/server/host/ServerHostPreference.kt rename to domain/src/desktopMain/kotlin/ca/gosyer/jui/domain/server/service/host/ServerHostPreference.kt index 778d3002..2889861c 100644 --- a/data/src/desktopMain/kotlin/ca/gosyer/jui/data/server/host/ServerHostPreference.kt +++ b/domain/src/desktopMain/kotlin/ca/gosyer/jui/domain/server/service/host/ServerHostPreference.kt @@ -4,7 +4,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package ca.gosyer.jui.data.server.host +package ca.gosyer.jui.domain.server.service.host import ca.gosyer.jui.core.prefs.Preference import ca.gosyer.jui.core.prefs.PreferenceStore diff --git a/data/src/jvmMain/kotlin/ca/gosyer/jui/data/server/Engine.kt b/domain/src/jvmMain/kotlin/ca/gosyer/jui/domain/server/Engine.kt similarity index 92% rename from data/src/jvmMain/kotlin/ca/gosyer/jui/data/server/Engine.kt rename to domain/src/jvmMain/kotlin/ca/gosyer/jui/domain/server/Engine.kt index 1fc2fa4e..156e1d18 100644 --- a/data/src/jvmMain/kotlin/ca/gosyer/jui/data/server/Engine.kt +++ b/domain/src/jvmMain/kotlin/ca/gosyer/jui/domain/server/Engine.kt @@ -4,7 +4,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package ca.gosyer.jui.data.server +package ca.gosyer.jui.domain.server import io.ktor.client.engine.HttpClientEngineConfig import io.ktor.client.engine.HttpClientEngineFactory diff --git a/presentation/build.gradle.kts b/presentation/build.gradle.kts index c83bf7c4..16d6c374 100644 --- a/presentation/build.gradle.kts +++ b/presentation/build.gradle.kts @@ -56,8 +56,8 @@ kotlin { api(libs.aboutLibraries.ui) api(projects.core) api(projects.i18n) - api(projects.data) api(projects.domain) + api(projects.data) api(projects.uiCore) api(compose.desktop.currentOs) api(compose("org.jetbrains.compose.ui:ui-util")) diff --git a/presentation/src/androidMain/kotlin/ca/gosyer/jui/ui/downloads/AndroidDownloadService.kt b/presentation/src/androidMain/kotlin/ca/gosyer/jui/ui/downloads/AndroidDownloadService.kt index affcc426..efd5471c 100644 --- a/presentation/src/androidMain/kotlin/ca/gosyer/jui/ui/downloads/AndroidDownloadService.kt +++ b/presentation/src/androidMain/kotlin/ca/gosyer/jui/ui/downloads/AndroidDownloadService.kt @@ -9,7 +9,7 @@ package ca.gosyer.jui.ui.downloads import android.content.Intent import androidx.core.content.ContextCompat import ca.gosyer.jui.domain.base.WebsocketService -import ca.gosyer.jui.domain.download.DownloadService +import ca.gosyer.jui.domain.download.service.DownloadService import ca.gosyer.jui.uicore.vm.ContextWrapper internal actual fun startDownloadService( diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/base/chapter/ChapterDownloadButtons.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/base/chapter/ChapterDownloadButtons.kt index 5e43fb91..72279e0c 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/base/chapter/ChapterDownloadButtons.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/base/chapter/ChapterDownloadButtons.kt @@ -31,11 +31,11 @@ import androidx.compose.runtime.getValue import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.unit.dp -import ca.gosyer.jui.data.download.model.DownloadChapter -import ca.gosyer.jui.data.download.model.DownloadState -import ca.gosyer.jui.data.models.Chapter -import ca.gosyer.jui.data.models.Manga -import ca.gosyer.jui.data.server.interactions.ChapterInteractionHandler +import ca.gosyer.jui.data.chapter.ChapterRepositoryImpl +import ca.gosyer.jui.domain.chapter.model.Chapter +import ca.gosyer.jui.domain.download.model.DownloadChapter +import ca.gosyer.jui.domain.download.model.DownloadState +import ca.gosyer.jui.domain.manga.model.Manga import ca.gosyer.jui.i18n.MR import ca.gosyer.jui.uicore.components.DropdownIconButton import ca.gosyer.jui.uicore.components.DropdownMenuItem @@ -74,15 +74,15 @@ data class ChapterDownloadItem( _downloadChapterFlow.value = downloadingChapter } - fun deleteDownload(chapterHandler: ChapterInteractionHandler): Flow { - return chapterHandler.deleteChapterDownload(chapter) + fun deleteDownload(chapterHandler: ChapterRepositoryImpl): Flow { + return chapterHandler.deleteChapterDownload(chapter.mangaId, chapter.index) .onEach { _downloadState.value = ChapterDownloadState.NotDownloaded } } - fun stopDownloading(chapterHandler: ChapterInteractionHandler): Flow { - return chapterHandler.stopChapterDownload(chapter) + fun stopDownloading(chapterHandler: ChapterRepositoryImpl): Flow { + return chapterHandler.stopChapterDownload(chapter.mangaId, chapter.index) .onEach { _downloadState.value = ChapterDownloadState.NotDownloaded } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/base/image/KamelConfigProvider.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/base/image/KamelConfigProvider.kt index bece628d..d2f58751 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/base/image/KamelConfigProvider.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/base/image/KamelConfigProvider.kt @@ -6,11 +6,11 @@ package ca.gosyer.jui.ui.base.image -import ca.gosyer.jui.data.models.Extension -import ca.gosyer.jui.data.models.Manga -import ca.gosyer.jui.data.models.Source -import ca.gosyer.jui.data.server.Http -import ca.gosyer.jui.data.server.ServerPreferences +import ca.gosyer.jui.domain.extension.model.Extension +import ca.gosyer.jui.domain.manga.model.Manga +import ca.gosyer.jui.domain.server.Http +import ca.gosyer.jui.domain.server.service.ServerPreferences +import ca.gosyer.jui.domain.source.model.Source import io.kamel.core.DataSource import io.kamel.core.Resource import io.kamel.core.config.DefaultCacheSize diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/base/theme/AppColorsPreference.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/base/theme/AppColorsPreference.kt index 71516629..be3f4b9f 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/base/theme/AppColorsPreference.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/base/theme/AppColorsPreference.kt @@ -8,7 +8,7 @@ package ca.gosyer.jui.ui.base.theme import androidx.compose.ui.graphics.Color import ca.gosyer.jui.core.prefs.Preference -import ca.gosyer.jui.data.ui.UiPreferences +import ca.gosyer.jui.domain.ui.service.UiPreferences import ca.gosyer.jui.uicore.prefs.PreferenceMutableStateFlow import ca.gosyer.jui.uicore.prefs.asColor import ca.gosyer.jui.uicore.prefs.asStateIn diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/base/theme/AppTheme.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/base/theme/AppTheme.kt index 69c553b7..bf94d0b2 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/base/theme/AppTheme.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/base/theme/AppTheme.kt @@ -18,8 +18,8 @@ import androidx.compose.runtime.remember import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.luminance import androidx.compose.ui.graphics.takeOrElse -import ca.gosyer.jui.data.ui.UiPreferences -import ca.gosyer.jui.data.ui.model.ThemeMode +import ca.gosyer.jui.domain.ui.model.ThemeMode +import ca.gosyer.jui.domain.ui.service.UiPreferences import ca.gosyer.jui.ui.base.theme.ThemeScrollbarStyle.getScrollbarStyle import ca.gosyer.jui.uicore.components.LocalScrollbarStyle import ca.gosyer.jui.uicore.theme.Theme diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/categories/CategoriesScreenViewModel.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/categories/CategoriesScreenViewModel.kt index 3eaa9286..2bba1226 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/categories/CategoriesScreenViewModel.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/categories/CategoriesScreenViewModel.kt @@ -6,8 +6,8 @@ package ca.gosyer.jui.ui.categories -import ca.gosyer.jui.data.models.Category -import ca.gosyer.jui.data.server.interactions.CategoryInteractionHandler +import ca.gosyer.jui.data.category.CategoryRepositoryImpl +import ca.gosyer.jui.domain.category.model.Category import ca.gosyer.jui.uicore.vm.ContextWrapper import ca.gosyer.jui.uicore.vm.ViewModel import kotlinx.coroutines.flow.MutableStateFlow @@ -21,7 +21,7 @@ import me.tatarka.inject.annotations.Inject import org.lighthousegames.logging.logging class CategoriesScreenViewModel @Inject constructor( - private val categoryHandler: CategoryInteractionHandler, + private val categoryHandler: CategoryRepositoryImpl, contextWrapper: ContextWrapper ) : ViewModel(contextWrapper) { private var originalCategories = emptyList() @@ -66,13 +66,13 @@ class CategoriesScreenViewModel @Inject constructor( originalCategories.forEach { originalCategory -> val category = categories.find { it.id == originalCategory.id } if (category == null) { - categoryHandler.deleteCategory(originalCategory) + categoryHandler.deleteCategory(originalCategory.id) .catch { log.warn(it) { "Error deleting category $originalCategory" } } .collect() } else if (category.name != originalCategory.name) { - categoryHandler.modifyCategory(originalCategory, category.name) + categoryHandler.modifyCategory(originalCategory.id, category.name) .catch { log.warn(it) { "Error modifying category $category" } } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/downloads/DownloadService.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/downloads/DownloadService.kt index de490262..f7ef0fca 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/downloads/DownloadService.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/downloads/DownloadService.kt @@ -7,7 +7,7 @@ package ca.gosyer.jui.ui.downloads import ca.gosyer.jui.domain.base.WebsocketService -import ca.gosyer.jui.domain.download.DownloadService +import ca.gosyer.jui.domain.download.service.DownloadService import ca.gosyer.jui.uicore.vm.ContextWrapper internal expect fun startDownloadService( diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/downloads/DownloadsScreenViewModel.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/downloads/DownloadsScreenViewModel.kt index ca1ff819..3056f8a8 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/downloads/DownloadsScreenViewModel.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/downloads/DownloadsScreenViewModel.kt @@ -6,11 +6,11 @@ package ca.gosyer.jui.ui.downloads -import ca.gosyer.jui.data.models.Chapter -import ca.gosyer.jui.data.server.interactions.ChapterInteractionHandler -import ca.gosyer.jui.data.server.interactions.DownloadInteractionHandler +import ca.gosyer.jui.data.chapter.ChapterRepositoryImpl +import ca.gosyer.jui.data.download.DownloadRepositoryImpl import ca.gosyer.jui.domain.base.WebsocketService.Actions -import ca.gosyer.jui.domain.download.DownloadService +import ca.gosyer.jui.domain.chapter.model.Chapter +import ca.gosyer.jui.domain.download.service.DownloadService import ca.gosyer.jui.uicore.vm.ContextWrapper import ca.gosyer.jui.uicore.vm.ViewModel import kotlinx.coroutines.CoroutineScope @@ -26,8 +26,8 @@ import org.lighthousegames.logging.logging class DownloadsScreenViewModel @Inject constructor( private val downloadService: DownloadService, - private val downloadsHandler: DownloadInteractionHandler, - private val chapterHandler: ChapterInteractionHandler, + private val downloadsHandler: DownloadRepositoryImpl, + private val chapterHandler: ChapterRepositoryImpl, private val contextWrapper: ContextWrapper, standalone: Boolean ) : ViewModel(contextWrapper) { @@ -67,7 +67,7 @@ class DownloadsScreenViewModel @Inject constructor( } fun stopDownload(chapter: Chapter) { - chapterHandler.stopChapterDownload(chapter) + chapterHandler.stopChapterDownload(chapter.mangaId, chapter.index) .catch { log.warn(it) { "Error stop chapter download" } } @@ -75,9 +75,9 @@ class DownloadsScreenViewModel @Inject constructor( } fun moveToBottom(chapter: Chapter) { - chapterHandler.stopChapterDownload(chapter) + chapterHandler.stopChapterDownload(chapter.mangaId, chapter.index) .onEach { - chapterHandler.queueChapterDownload(chapter) + chapterHandler.queueChapterDownload(chapter.mangaId, chapter.index) .catch { log.warn(it) { "Error adding download" } } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/downloads/components/DownloadsScreenContent.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/downloads/components/DownloadsScreenContent.kt index e5a65280..84c0fb28 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/downloads/components/DownloadsScreenContent.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/downloads/components/DownloadsScreenContent.kt @@ -40,9 +40,9 @@ import androidx.compose.ui.draw.clip import androidx.compose.ui.graphics.FilterQuality import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.unit.dp -import ca.gosyer.jui.data.download.model.DownloadChapter -import ca.gosyer.jui.data.download.model.DownloaderStatus -import ca.gosyer.jui.data.models.Chapter +import ca.gosyer.jui.domain.chapter.model.Chapter +import ca.gosyer.jui.domain.download.model.DownloadChapter +import ca.gosyer.jui.domain.download.model.DownloaderStatus import ca.gosyer.jui.i18n.MR import ca.gosyer.jui.ui.base.navigation.ActionItem import ca.gosyer.jui.ui.base.navigation.Toolbar diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/extensions/ExtensionsScreenViewModel.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/extensions/ExtensionsScreenViewModel.kt index 793bc720..593b4aa6 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/extensions/ExtensionsScreenViewModel.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/extensions/ExtensionsScreenViewModel.kt @@ -8,9 +8,9 @@ package ca.gosyer.jui.ui.extensions import androidx.compose.ui.text.intl.Locale import ca.gosyer.jui.core.lang.displayName -import ca.gosyer.jui.data.extension.ExtensionPreferences -import ca.gosyer.jui.data.models.Extension -import ca.gosyer.jui.data.server.interactions.ExtensionInteractionHandler +import ca.gosyer.jui.data.extension.ExtensionRepositoryImpl +import ca.gosyer.jui.domain.extension.model.Extension +import ca.gosyer.jui.domain.extension.service.ExtensionPreferences import ca.gosyer.jui.i18n.MR import ca.gosyer.jui.uicore.vm.ContextWrapper import ca.gosyer.jui.uicore.vm.ViewModel @@ -28,7 +28,7 @@ import me.tatarka.inject.annotations.Inject import org.lighthousegames.logging.logging class ExtensionsScreenViewModel @Inject constructor( - private val extensionHandler: ExtensionInteractionHandler, + private val extensionHandler: ExtensionRepositoryImpl, extensionPreferences: ExtensionPreferences, contextWrapper: ContextWrapper ) : ViewModel(contextWrapper) { diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/extensions/components/ExtensionsScreenContent.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/extensions/components/ExtensionsScreenContent.kt index 3c4aedb4..a2056788 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/extensions/components/ExtensionsScreenContent.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/extensions/components/ExtensionsScreenContent.kt @@ -44,7 +44,7 @@ import androidx.compose.ui.text.withStyle import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import ca.gosyer.jui.core.lang.getDisplayName -import ca.gosyer.jui.data.models.Extension +import ca.gosyer.jui.domain.extension.model.Extension import ca.gosyer.jui.i18n.MR import ca.gosyer.jui.presentation.build.BuildKonfig import ca.gosyer.jui.ui.base.dialog.getMaterialDialogProperties diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/LibraryScreenViewModel.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/LibraryScreenViewModel.kt index 70b4f3b7..c1bc07dd 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/LibraryScreenViewModel.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/LibraryScreenViewModel.kt @@ -10,15 +10,15 @@ import androidx.compose.ui.text.intl.Locale import androidx.compose.ui.text.toLowerCase import ca.gosyer.jui.core.lang.withDefaultContext import ca.gosyer.jui.core.prefs.getAsFlow -import ca.gosyer.jui.data.library.LibraryPreferences -import ca.gosyer.jui.data.library.model.FilterState -import ca.gosyer.jui.data.library.model.Sort -import ca.gosyer.jui.data.models.Category -import ca.gosyer.jui.data.models.Manga -import ca.gosyer.jui.data.models.MangaStatus -import ca.gosyer.jui.data.server.interactions.CategoryInteractionHandler -import ca.gosyer.jui.data.server.interactions.LibraryInteractionHandler -import ca.gosyer.jui.data.server.interactions.UpdatesInteractionHandler +import ca.gosyer.jui.data.category.CategoryRepositoryImpl +import ca.gosyer.jui.data.library.LibraryRepositoryImpl +import ca.gosyer.jui.data.updates.UpdatesRepositoryImpl +import ca.gosyer.jui.domain.category.model.Category +import ca.gosyer.jui.domain.library.model.FilterState +import ca.gosyer.jui.domain.library.model.Sort +import ca.gosyer.jui.domain.library.service.LibraryPreferences +import ca.gosyer.jui.domain.manga.model.Manga +import ca.gosyer.jui.domain.manga.model.MangaStatus import ca.gosyer.jui.i18n.MR import ca.gosyer.jui.ui.util.lang.Collator import ca.gosyer.jui.uicore.vm.ContextWrapper @@ -74,9 +74,9 @@ private fun LibraryMap.setManga(id: Long, manga: List, getItemsFlow: (Sta } class LibraryScreenViewModel @Inject constructor( - private val categoryHandler: CategoryInteractionHandler, - private val libraryHandler: LibraryInteractionHandler, - private val updatesHandler: UpdatesInteractionHandler, + private val categoryHandler: CategoryRepositoryImpl, + private val libraryHandler: LibraryRepositoryImpl, + private val updatesHandler: UpdatesRepositoryImpl, libraryPreferences: LibraryPreferences, contextWrapper: ContextWrapper ) : ViewModel(contextWrapper) { @@ -237,7 +237,7 @@ class LibraryScreenViewModel @Inject constructor( withDefaultContext { categories.map { category -> async { - categoryHandler.getMangaFromCategory(category) + categoryHandler.getMangaFromCategory(category.id) .onEach { library.mangaMap.setManga( id = category.id, @@ -287,7 +287,7 @@ class LibraryScreenViewModel @Inject constructor( } fun updateCategory(category: Category) { - updatesHandler.updateCategory(category) + updatesHandler.updateCategory(category.id) .catch { log.warn(it) { "Error updating category" } } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/components/LibraryMangaBadges.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/components/LibraryMangaBadges.kt index 1fa81528..46de6724 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/components/LibraryMangaBadges.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/components/LibraryMangaBadges.kt @@ -20,8 +20,8 @@ import androidx.compose.ui.draw.clip import androidx.compose.ui.text.intl.Locale import androidx.compose.ui.text.toUpperCase import androidx.compose.ui.unit.dp -import ca.gosyer.jui.data.models.Manga -import ca.gosyer.jui.data.models.Source +import ca.gosyer.jui.domain.manga.model.Manga +import ca.gosyer.jui.domain.source.model.Source import ca.gosyer.jui.i18n.MR import ca.gosyer.jui.uicore.resources.stringResource diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/components/LibraryMangaList.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/components/LibraryMangaList.kt index d3cff743..22c8a976 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/components/LibraryMangaList.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/components/LibraryMangaList.kt @@ -24,7 +24,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip import androidx.compose.ui.graphics.FilterQuality import androidx.compose.ui.unit.dp -import ca.gosyer.jui.data.models.Manga +import ca.gosyer.jui.domain.manga.model.Manga import ca.gosyer.jui.uicore.components.MangaListItem import ca.gosyer.jui.uicore.components.MangaListItemImage import ca.gosyer.jui.uicore.components.MangaListItemTitle diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/components/LibraryPager.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/components/LibraryPager.kt index 1fdc0ee8..060b7785 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/components/LibraryPager.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/components/LibraryPager.kt @@ -11,8 +11,8 @@ import androidx.compose.runtime.Composable import androidx.compose.runtime.State import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue -import ca.gosyer.jui.data.library.model.DisplayMode -import ca.gosyer.jui.data.models.Category +import ca.gosyer.jui.domain.category.model.Category +import ca.gosyer.jui.domain.library.model.DisplayMode import ca.gosyer.jui.ui.library.CategoryState import ca.gosyer.jui.uicore.components.ErrorScreen import ca.gosyer.jui.uicore.components.LoadingScreen diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/components/LibraryScreenContent.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/components/LibraryScreenContent.kt index 56217935..45d0c9f2 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/components/LibraryScreenContent.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/components/LibraryScreenContent.kt @@ -32,8 +32,8 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.input.pointer.pointerInput import androidx.compose.ui.unit.dp -import ca.gosyer.jui.data.library.model.DisplayMode -import ca.gosyer.jui.data.models.Category +import ca.gosyer.jui.domain.category.model.Category +import ca.gosyer.jui.domain.library.model.DisplayMode import ca.gosyer.jui.i18n.MR import ca.gosyer.jui.ui.base.navigation.ActionItem import ca.gosyer.jui.ui.base.navigation.BackHandler diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/components/LibraryTabs.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/components/LibraryTabs.kt index 2a6dd6c9..9d863620 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/components/LibraryTabs.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/components/LibraryTabs.kt @@ -18,7 +18,7 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp import androidx.compose.ui.util.fastForEachIndexed -import ca.gosyer.jui.data.models.Category +import ca.gosyer.jui.domain.category.model.Category import com.google.accompanist.pager.PagerState import com.google.accompanist.pager.pagerTabIndicatorOffset diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/components/MangaComfortableGrid.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/components/MangaComfortableGrid.kt index e744bcbe..15acd382 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/components/MangaComfortableGrid.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/components/MangaComfortableGrid.kt @@ -30,7 +30,7 @@ import androidx.compose.ui.text.TextStyle import androidx.compose.ui.text.font.FontFamily import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp -import ca.gosyer.jui.data.models.Manga +import ca.gosyer.jui.domain.manga.model.Manga import ca.gosyer.jui.uicore.components.VerticalScrollbar import ca.gosyer.jui.uicore.components.mangaAspectRatio import ca.gosyer.jui.uicore.components.rememberScrollbarAdapter diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/components/MangaCompactGrid.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/components/MangaCompactGrid.kt index 1bf5ec97..90714cb2 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/components/MangaCompactGrid.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/components/MangaCompactGrid.kt @@ -33,7 +33,7 @@ import androidx.compose.ui.text.TextStyle import androidx.compose.ui.text.font.FontFamily import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp -import ca.gosyer.jui.data.models.Manga +import ca.gosyer.jui.domain.manga.model.Manga import ca.gosyer.jui.uicore.components.VerticalScrollbar import ca.gosyer.jui.uicore.components.mangaAspectRatio import ca.gosyer.jui.uicore.components.rememberScrollbarAdapter diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/components/MangaCoverOnlyGrid.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/components/MangaCoverOnlyGrid.kt index 3f5eefc4..e67e26eb 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/components/MangaCoverOnlyGrid.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/components/MangaCoverOnlyGrid.kt @@ -24,7 +24,7 @@ import androidx.compose.ui.draw.clip import androidx.compose.ui.graphics.FilterQuality import androidx.compose.ui.layout.ContentScale import androidx.compose.ui.unit.dp -import ca.gosyer.jui.data.models.Manga +import ca.gosyer.jui.domain.manga.model.Manga import ca.gosyer.jui.uicore.components.VerticalScrollbar import ca.gosyer.jui.uicore.components.mangaAspectRatio import ca.gosyer.jui.uicore.components.rememberScrollbarAdapter diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/settings/LibraryDisplay.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/settings/LibraryDisplay.kt index 4d76389b..fad737c1 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/settings/LibraryDisplay.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/settings/LibraryDisplay.kt @@ -19,7 +19,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.unit.dp import androidx.compose.ui.util.fastForEach -import ca.gosyer.jui.data.library.model.DisplayMode +import ca.gosyer.jui.domain.library.model.DisplayMode import ca.gosyer.jui.i18n.MR import ca.gosyer.jui.ui.sources.browse.filter.SourceFilterAction import ca.gosyer.jui.uicore.resources.stringResource diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/settings/LibraryFilters.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/settings/LibraryFilters.kt index 589f4eac..4e5452d2 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/settings/LibraryFilters.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/settings/LibraryFilters.kt @@ -14,7 +14,7 @@ import androidx.compose.runtime.collectAsState import androidx.compose.runtime.remember import androidx.compose.ui.Modifier import androidx.compose.ui.state.ToggleableState -import ca.gosyer.jui.data.library.model.FilterState +import ca.gosyer.jui.domain.library.model.FilterState import ca.gosyer.jui.i18n.MR import ca.gosyer.jui.ui.sources.browse.filter.SourceFilterAction import ca.gosyer.jui.uicore.resources.stringResource diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/settings/LibrarySettingsViewModel.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/settings/LibrarySettingsViewModel.kt index 5c35533c..a3fab8a6 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/settings/LibrarySettingsViewModel.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/settings/LibrarySettingsViewModel.kt @@ -6,7 +6,7 @@ package ca.gosyer.jui.ui.library.settings -import ca.gosyer.jui.data.library.LibraryPreferences +import ca.gosyer.jui.domain.library.service.LibraryPreferences import ca.gosyer.jui.uicore.vm.ContextWrapper import ca.gosyer.jui.uicore.vm.ViewModel import me.tatarka.inject.annotations.Inject diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/settings/LibrarySort.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/settings/LibrarySort.kt index 6f4589b3..c5c6004d 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/settings/LibrarySort.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/settings/LibrarySort.kt @@ -21,7 +21,7 @@ import androidx.compose.runtime.remember import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp import androidx.compose.ui.util.fastForEach -import ca.gosyer.jui.data.library.model.Sort +import ca.gosyer.jui.domain.library.model.Sort import ca.gosyer.jui.ui.sources.browse.filter.SourceFilterAction import ca.gosyer.jui.uicore.resources.stringResource diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/main/MainViewModel.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/main/MainViewModel.kt index 8378b06d..98153628 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/main/MainViewModel.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/main/MainViewModel.kt @@ -6,7 +6,7 @@ package ca.gosyer.jui.ui.main -import ca.gosyer.jui.data.ui.UiPreferences +import ca.gosyer.jui.domain.ui.service.UiPreferences import ca.gosyer.jui.i18n.MR import ca.gosyer.jui.uicore.vm.ContextWrapper import ca.gosyer.jui.uicore.vm.Length diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/main/Routes.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/main/Routes.kt index a1bfee59..4efc4756 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/main/Routes.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/main/Routes.kt @@ -6,7 +6,7 @@ package ca.gosyer.jui.ui.main -import ca.gosyer.jui.data.ui.model.StartScreen +import ca.gosyer.jui.domain.ui.model.StartScreen import ca.gosyer.jui.ui.extensions.ExtensionsScreen import ca.gosyer.jui.ui.library.LibraryScreen import ca.gosyer.jui.ui.sources.SourcesScreen diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/main/about/AboutViewModel.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/main/about/AboutViewModel.kt index e2c5b27c..9506bb56 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/main/about/AboutViewModel.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/main/about/AboutViewModel.kt @@ -7,10 +7,10 @@ package ca.gosyer.jui.ui.main.about import ca.gosyer.jui.data.base.DateHandler -import ca.gosyer.jui.data.models.About -import ca.gosyer.jui.data.server.interactions.SettingsInteractionHandler -import ca.gosyer.jui.domain.update.UpdateChecker -import ca.gosyer.jui.domain.update.UpdateChecker.Update +import ca.gosyer.jui.data.settings.SettingsRepositoryImpl +import ca.gosyer.jui.domain.settings.model.About +import ca.gosyer.jui.domain.updates.interactor.UpdateChecker +import ca.gosyer.jui.domain.updates.interactor.UpdateChecker.Update import ca.gosyer.jui.uicore.vm.ContextWrapper import ca.gosyer.jui.uicore.vm.ViewModel import kotlinx.coroutines.flow.MutableSharedFlow @@ -30,7 +30,7 @@ import org.lighthousegames.logging.logging class AboutViewModel @Inject constructor( private val dateHandler: DateHandler, - private val settingsHandler: SettingsInteractionHandler, + private val settingsHandler: SettingsRepositoryImpl, private val updateChecker: UpdateChecker, contextWrapper: ContextWrapper ) : ViewModel(contextWrapper) { diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/main/about/components/AboutContent.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/main/about/components/AboutContent.kt index 0cd68d45..d4fd4f3e 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/main/about/components/AboutContent.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/main/about/components/AboutContent.kt @@ -31,8 +31,8 @@ import androidx.compose.ui.platform.LocalUriHandler import androidx.compose.ui.text.buildAnnotatedString import androidx.compose.ui.unit.dp import androidx.compose.ui.util.fastForEach -import ca.gosyer.jui.data.models.About -import ca.gosyer.jui.domain.update.UpdateChecker +import ca.gosyer.jui.domain.settings.model.About +import ca.gosyer.jui.domain.updates.interactor.UpdateChecker import ca.gosyer.jui.i18n.MR import ca.gosyer.jui.presentation.build.BuildKonfig import ca.gosyer.jui.ui.base.navigation.Toolbar diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/main/components/DownloadsExtraInfo.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/main/components/DownloadsExtraInfo.kt index 77a8b450..8e9002d5 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/main/components/DownloadsExtraInfo.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/main/components/DownloadsExtraInfo.kt @@ -19,8 +19,8 @@ import androidx.compose.runtime.getValue import androidx.compose.runtime.remember import androidx.compose.ui.graphics.Color import androidx.compose.ui.unit.dp -import ca.gosyer.jui.data.download.model.DownloaderStatus import ca.gosyer.jui.domain.base.WebsocketService +import ca.gosyer.jui.domain.download.model.DownloaderStatus import ca.gosyer.jui.i18n.MR import ca.gosyer.jui.ui.downloads.DownloadsScreenViewModel import ca.gosyer.jui.uicore.resources.stringResource diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/manga/MangaScreenViewModel.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/manga/MangaScreenViewModel.kt index 6a779dcd..77e2b405 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/manga/MangaScreenViewModel.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/manga/MangaScreenViewModel.kt @@ -8,15 +8,15 @@ package ca.gosyer.jui.ui.manga import ca.gosyer.jui.core.lang.withIOContext import ca.gosyer.jui.data.base.DateHandler -import ca.gosyer.jui.data.models.Category -import ca.gosyer.jui.data.models.Chapter -import ca.gosyer.jui.data.models.Manga -import ca.gosyer.jui.data.server.interactions.CategoryInteractionHandler -import ca.gosyer.jui.data.server.interactions.ChapterInteractionHandler -import ca.gosyer.jui.data.server.interactions.LibraryInteractionHandler -import ca.gosyer.jui.data.server.interactions.MangaInteractionHandler -import ca.gosyer.jui.data.ui.UiPreferences -import ca.gosyer.jui.domain.download.DownloadService +import ca.gosyer.jui.data.category.CategoryRepositoryImpl +import ca.gosyer.jui.data.chapter.ChapterRepositoryImpl +import ca.gosyer.jui.data.library.LibraryRepositoryImpl +import ca.gosyer.jui.data.manga.MangaRepositoryImpl +import ca.gosyer.jui.domain.category.model.Category +import ca.gosyer.jui.domain.chapter.model.Chapter +import ca.gosyer.jui.domain.download.service.DownloadService +import ca.gosyer.jui.domain.manga.model.Manga +import ca.gosyer.jui.domain.ui.service.UiPreferences import ca.gosyer.jui.ui.base.chapter.ChapterDownloadItem import ca.gosyer.jui.uicore.vm.ContextWrapper import ca.gosyer.jui.uicore.vm.ViewModel @@ -39,10 +39,10 @@ import org.lighthousegames.logging.logging class MangaScreenViewModel @Inject constructor( private val dateHandler: DateHandler, - private val mangaHandler: MangaInteractionHandler, - private val chapterHandler: ChapterInteractionHandler, - private val categoryHandler: CategoryInteractionHandler, - private val libraryHandler: LibraryInteractionHandler, + private val mangaHandler: MangaRepositoryImpl, + private val chapterHandler: ChapterRepositoryImpl, + private val categoryHandler: CategoryRepositoryImpl, + private val libraryHandler: LibraryRepositoryImpl, uiPreferences: UiPreferences, contextWrapper: ContextWrapper, private val params: Params, @@ -165,7 +165,7 @@ class MangaScreenViewModel @Inject constructor( scope.launch { manga.value?.let { manga -> if (manga.inLibrary) { - libraryHandler.removeMangaFromLibrary(manga) + libraryHandler.removeMangaFromLibrary(manga.id) .catch { log.warn(it) { "Error toggling favorite" } } @@ -187,21 +187,21 @@ class MangaScreenViewModel @Inject constructor( manga.value?.let { manga -> if (manga.inLibrary) { oldCategories.filterNot { it in categories }.forEach { - categoryHandler.removeMangaFromCategory(manga, it) + categoryHandler.removeMangaFromCategory(manga.id, it.id) .catch { log.warn(it) { "Error removing manga from category" } } .collect() } } else { - libraryHandler.addMangaToLibrary(manga) + libraryHandler.addMangaToLibrary(manga.id) .catch { log.warn(it) { "Error Adding manga to library" } } .collect() } categories.filterNot { it in oldCategories }.forEach { - categoryHandler.addMangaToCategory(manga, it) + categoryHandler.addMangaToCategory(manga.id, it.id) .catch { log.warn(it) { "Error adding manga to category" } } @@ -216,7 +216,7 @@ class MangaScreenViewModel @Inject constructor( scope.launch { manga.value?.let { manga -> chapterHandler.updateChapter( - manga, + manga.id, index, read = !_chapters.value.first { it.chapter.index == index }.chapter.read ) @@ -224,7 +224,7 @@ class MangaScreenViewModel @Inject constructor( log.warn(it) { "Error toggling read" } } .collect() - _chapters.value = chapterHandler.getChapters(manga) + _chapters.value = chapterHandler.getChapters(manga.id) .catch { log.warn(it) { "Error getting new chapters after toggling read" } emit(emptyList()) @@ -239,7 +239,7 @@ class MangaScreenViewModel @Inject constructor( scope.launch { manga.value?.let { manga -> chapterHandler.updateChapter( - manga, + manga.id, index, bookmarked = !_chapters.value.first { it.chapter.index == index }.chapter.bookmarked ) @@ -247,7 +247,7 @@ class MangaScreenViewModel @Inject constructor( log.warn(it) { "Error toggling bookmarked" } } .collect() - _chapters.value = chapterHandler.getChapters(manga) + _chapters.value = chapterHandler.getChapters(manga.id) .catch { log.warn(it) { "Error getting new chapters after toggling bookmarked" } emit(emptyList()) @@ -261,12 +261,12 @@ class MangaScreenViewModel @Inject constructor( fun markPreviousRead(index: Int) { scope.launch { manga.value?.let { manga -> - chapterHandler.updateChapter(manga, index, markPreviousRead = true) + chapterHandler.updateChapter(manga.id, index, markPreviousRead = true) .catch { log.warn(it) { "Error marking previous as read" } } .collect() - _chapters.value = chapterHandler.getChapters(manga) + _chapters.value = chapterHandler.getChapters(manga.id) .catch { log.warn(it) { "Error getting new chapters after marking previous as read" } emit(emptyList()) @@ -279,7 +279,7 @@ class MangaScreenViewModel @Inject constructor( fun downloadChapter(index: Int) { manga.value?.let { manga -> - chapterHandler.queueChapterDownload(manga, index) + chapterHandler.queueChapterDownload(manga.id, index) .catch { log.warn(it) { "Error downloading chapter" } } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/manga/components/MangaMenu.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/manga/components/MangaMenu.kt index 95b3af85..2369b515 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/manga/components/MangaMenu.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/manga/components/MangaMenu.kt @@ -33,8 +33,8 @@ import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import androidx.compose.ui.util.fastForEach -import ca.gosyer.jui.data.models.Category -import ca.gosyer.jui.data.models.Manga +import ca.gosyer.jui.domain.category.model.Category +import ca.gosyer.jui.domain.manga.model.Manga import ca.gosyer.jui.i18n.MR import ca.gosyer.jui.ui.base.dialog.getMaterialDialogProperties import ca.gosyer.jui.uicore.components.VerticalScrollbar diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/manga/components/MangaScreenContent.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/manga/components/MangaScreenContent.kt index 0d64099b..fb02153a 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/manga/components/MangaScreenContent.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/manga/components/MangaScreenContent.kt @@ -28,8 +28,8 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalUriHandler import androidx.compose.ui.unit.dp -import ca.gosyer.jui.data.models.Category -import ca.gosyer.jui.data.models.Manga +import ca.gosyer.jui.domain.category.model.Category +import ca.gosyer.jui.domain.manga.model.Manga import ca.gosyer.jui.i18n.MR import ca.gosyer.jui.ui.base.chapter.ChapterDownloadItem import ca.gosyer.jui.ui.base.navigation.ActionItem diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/ChapterLoader.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/ChapterLoader.kt index adc93721..35003a01 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/ChapterLoader.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/ChapterLoader.kt @@ -6,8 +6,8 @@ package ca.gosyer.jui.ui.reader -import ca.gosyer.jui.data.reader.ReaderPreferences -import ca.gosyer.jui.data.server.interactions.ChapterInteractionHandler +import ca.gosyer.jui.data.chapter.ChapterRepositoryImpl +import ca.gosyer.jui.domain.reader.service.ReaderPreferences import ca.gosyer.jui.ui.reader.loader.TachideskPageLoader import ca.gosyer.jui.ui.reader.model.ReaderChapter import ca.gosyer.jui.ui.reader.model.ReaderPage @@ -20,7 +20,7 @@ import org.lighthousegames.logging.logging class ChapterLoader( private val readerPreferences: ReaderPreferences, - private val chapterHandler: ChapterInteractionHandler + private val chapterHandler: ChapterRepositoryImpl ) { fun loadChapter(chapter: ReaderChapter): StateFlow> { if (chapterIsReady(chapter)) { diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/ReaderMenu.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/ReaderMenu.kt index 3aabd8ee..0ab591bb 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/ReaderMenu.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/ReaderMenu.kt @@ -51,9 +51,9 @@ import androidx.compose.ui.input.key.KeyEvent import androidx.compose.ui.input.key.key import androidx.compose.ui.layout.ContentScale import androidx.compose.ui.unit.dp -import ca.gosyer.jui.data.reader.model.Direction -import ca.gosyer.jui.data.reader.model.ImageScale -import ca.gosyer.jui.data.reader.model.NavigationMode +import ca.gosyer.jui.domain.reader.model.Direction +import ca.gosyer.jui.domain.reader.model.ImageScale +import ca.gosyer.jui.domain.reader.model.NavigationMode import ca.gosyer.jui.i18n.MR import ca.gosyer.jui.ui.base.navigation.ActionItem import ca.gosyer.jui.ui.base.navigation.BackHandler 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 826e687b..bcf02144 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 @@ -8,14 +8,16 @@ package ca.gosyer.jui.ui.reader import ca.gosyer.jui.core.lang.launchDefault import ca.gosyer.jui.core.prefs.getAsFlow -import ca.gosyer.jui.data.models.Chapter -import ca.gosyer.jui.data.models.Manga -import ca.gosyer.jui.data.models.MangaMeta -import ca.gosyer.jui.data.reader.ReaderPreferences -import ca.gosyer.jui.data.reader.model.Direction -import ca.gosyer.jui.data.server.interactions.ChapterInteractionHandler -import ca.gosyer.jui.data.server.interactions.MangaInteractionHandler +import ca.gosyer.jui.data.chapter.ChapterRepositoryImpl +import ca.gosyer.jui.data.manga.MangaRepositoryImpl +import ca.gosyer.jui.domain.chapter.interactor.UpdateChapterMeta +import ca.gosyer.jui.domain.chapter.model.Chapter +import ca.gosyer.jui.domain.manga.interactor.UpdateMangaMeta +import ca.gosyer.jui.domain.manga.model.Manga +import ca.gosyer.jui.domain.manga.model.MangaMeta import ca.gosyer.jui.domain.reader.ReaderModeWatch +import ca.gosyer.jui.domain.reader.model.Direction +import ca.gosyer.jui.domain.reader.service.ReaderPreferences import ca.gosyer.jui.ui.reader.model.MoveTo import ca.gosyer.jui.ui.reader.model.Navigation import ca.gosyer.jui.ui.reader.model.PageMove @@ -48,8 +50,10 @@ import org.lighthousegames.logging.logging class ReaderMenuViewModel @Inject constructor( private val readerPreferences: ReaderPreferences, - private val mangaHandler: MangaInteractionHandler, - private val chapterHandler: ChapterInteractionHandler, + private val mangaHandler: MangaRepositoryImpl, + private val chapterHandler: ChapterRepositoryImpl, + private val updateMangaMeta: UpdateMangaMeta, + private val updateChapterMeta: UpdateChapterMeta, contextWrapper: ContextWrapper, private val params: Params, ) : ViewModel(contextWrapper) { @@ -161,15 +165,13 @@ class ReaderMenuViewModel @Inject constructor( fun setMangaReaderMode(mode: String) { scope.launchDefault { - _manga.value - ?.updateRemote( - mangaHandler, - mode - ) - ?.catch { - log.warn(it) { "Error updating manga reader mode" } - } - ?.collect() + _manga.value?.let { + updateMangaMeta.subscribe(it, mode) + .catch { + log.warn(it) { "Error updating manga reader mode" } + } + .collect() + } initManga(params.mangaId) } } @@ -306,7 +308,7 @@ class ReaderMenuViewModel @Inject constructor( @OptIn(DelicateCoroutinesApi::class) private fun updateLastPageReadOffset(chapter: Chapter, offset: Int) { - chapter.updateRemote(chapterHandler, offset) + updateChapterMeta.subscribe(chapter, offset) .catch { log.warn(it) { "Error updating chapter offset" } } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/ReaderSideMenu.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/ReaderSideMenu.kt index d591f451..c2abb8bd 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/ReaderSideMenu.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/ReaderSideMenu.kt @@ -52,8 +52,8 @@ import androidx.compose.ui.draw.rotate import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import ca.gosyer.jui.core.util.replace -import ca.gosyer.jui.data.models.MangaMeta -import ca.gosyer.jui.data.reader.model.Direction +import ca.gosyer.jui.domain.manga.model.MangaMeta +import ca.gosyer.jui.domain.reader.model.Direction import ca.gosyer.jui.i18n.MR import ca.gosyer.jui.ui.reader.model.ReaderChapter import ca.gosyer.jui.uicore.components.AroundLayout diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/loader/TachideskPageLoader.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/loader/TachideskPageLoader.kt index 60fec50f..ea6bb52b 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/loader/TachideskPageLoader.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/loader/TachideskPageLoader.kt @@ -8,8 +8,8 @@ package ca.gosyer.jui.ui.reader.loader import ca.gosyer.jui.core.lang.IO import ca.gosyer.jui.core.lang.throwIfCancellation -import ca.gosyer.jui.data.reader.ReaderPreferences -import ca.gosyer.jui.data.server.interactions.ChapterInteractionHandler +import ca.gosyer.jui.data.chapter.ChapterRepositoryImpl +import ca.gosyer.jui.domain.reader.service.ReaderPreferences import ca.gosyer.jui.ui.reader.model.ReaderChapter import ca.gosyer.jui.ui.reader.model.ReaderPage import ca.gosyer.jui.ui.util.compose.toImageBitmap @@ -33,7 +33,7 @@ import org.lighthousegames.logging.logging class TachideskPageLoader( val chapter: ReaderChapter, readerPreferences: ReaderPreferences, - chapterHandler: ChapterInteractionHandler + chapterHandler: ChapterRepositoryImpl ) : PageLoader() { val scope = CoroutineScope(SupervisorJob() + Dispatchers.Default) @@ -64,7 +64,7 @@ class TachideskPageLoader( log.debug { "Loading page ${page.index}" } if (page.status.value == ReaderPage.Status.QUEUE) { chapterHandler - .getPage(chapter.chapter, page.index) { + .getPage(chapter.chapter.mangaId, chapter.chapter.index, page.index) { onDownload { bytesSentTotal, contentLength -> page.progress.value = (bytesSentTotal.toFloat() / contentLength).coerceAtMost(1.0F) } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/model/ReaderChapter.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/model/ReaderChapter.kt index 584cf976..7990a226 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/model/ReaderChapter.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/model/ReaderChapter.kt @@ -6,7 +6,7 @@ package ca.gosyer.jui.ui.reader.model -import ca.gosyer.jui.data.models.Chapter +import ca.gosyer.jui.domain.chapter.model.Chapter import ca.gosyer.jui.ui.reader.loader.PageLoader import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/navigation/ViewerNavigation.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/navigation/ViewerNavigation.kt index d563f3a0..8ecc184c 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/navigation/ViewerNavigation.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/navigation/ViewerNavigation.kt @@ -9,7 +9,7 @@ package ca.gosyer.jui.ui.reader.navigation import androidx.compose.ui.geometry.Offset import androidx.compose.ui.geometry.Size import androidx.compose.ui.unit.IntOffset -import ca.gosyer.jui.data.reader.model.TappingInvertMode +import ca.gosyer.jui.domain.reader.model.TappingInvertMode import ca.gosyer.jui.ui.reader.model.Navigation abstract class ViewerNavigation { diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/viewer/Continuous.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/viewer/Continuous.kt index ea1479f7..1f193521 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/viewer/Continuous.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/viewer/Continuous.kt @@ -31,7 +31,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.layout.ContentScale import androidx.compose.ui.platform.LocalDensity import androidx.compose.ui.unit.dp -import ca.gosyer.jui.data.reader.model.Direction +import ca.gosyer.jui.domain.reader.model.Direction import ca.gosyer.jui.ui.reader.ChapterSeparator import ca.gosyer.jui.ui.reader.ReaderImage import ca.gosyer.jui.ui.reader.model.MoveTo diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/viewer/Pager.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/viewer/Pager.kt index b77d200e..bf89f0f7 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/viewer/Pager.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/viewer/Pager.kt @@ -12,7 +12,7 @@ import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.collectAsState import androidx.compose.ui.Modifier import androidx.compose.ui.layout.ContentScale -import ca.gosyer.jui.data.reader.model.Direction +import ca.gosyer.jui.domain.reader.model.Direction import ca.gosyer.jui.ui.reader.ChapterSeparator import ca.gosyer.jui.ui.reader.ReaderImage import ca.gosyer.jui.ui.reader.model.MoveTo diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/settings/SettingsAdvancedScreen.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/settings/SettingsAdvancedScreen.kt index 9462b89f..01ad711e 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/settings/SettingsAdvancedScreen.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/settings/SettingsAdvancedScreen.kt @@ -16,7 +16,7 @@ import androidx.compose.material.Scaffold import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier -import ca.gosyer.jui.data.update.UpdatePreferences +import ca.gosyer.jui.domain.updates.service.UpdatePreferences import ca.gosyer.jui.i18n.MR import ca.gosyer.jui.ui.base.navigation.Toolbar import ca.gosyer.jui.ui.base.prefs.SwitchPreference diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/settings/SettingsAppearanceScreen.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/settings/SettingsAppearanceScreen.kt index 94d1c044..10297c77 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/settings/SettingsAppearanceScreen.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/settings/SettingsAppearanceScreen.kt @@ -33,8 +33,8 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp -import ca.gosyer.jui.data.ui.UiPreferences -import ca.gosyer.jui.data.ui.model.ThemeMode +import ca.gosyer.jui.domain.ui.model.ThemeMode +import ca.gosyer.jui.domain.ui.service.UiPreferences import ca.gosyer.jui.i18n.MR import ca.gosyer.jui.ui.base.navigation.Toolbar import ca.gosyer.jui.ui.base.prefs.ChoicePreference diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/settings/SettingsBackupScreen.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/settings/SettingsBackupScreen.kt index 2de127fd..614734ad 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/settings/SettingsBackupScreen.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/settings/SettingsBackupScreen.kt @@ -35,7 +35,7 @@ import ca.gosyer.jui.core.io.copyTo import ca.gosyer.jui.core.io.saveTo import ca.gosyer.jui.core.lang.IO import ca.gosyer.jui.core.lang.throwIfCancellation -import ca.gosyer.jui.data.server.interactions.BackupInteractionHandler +import ca.gosyer.jui.data.backup.BackupRepositoryImpl import ca.gosyer.jui.i18n.MR import ca.gosyer.jui.ui.base.dialog.getMaterialDialogProperties import ca.gosyer.jui.ui.base.file.rememberFileChooser @@ -108,7 +108,7 @@ class SettingsBackupScreen : Screen { } class SettingsBackupViewModel @Inject constructor( - private val backupHandler: BackupInteractionHandler, + private val backupHandler: BackupRepositoryImpl, contextWrapper: ContextWrapper ) : ViewModel(contextWrapper) { private val _restoring = MutableStateFlow(false) diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/settings/SettingsGeneralScreen.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/settings/SettingsGeneralScreen.kt index 5e24d4c6..70f1433e 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/settings/SettingsGeneralScreen.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/settings/SettingsGeneralScreen.kt @@ -23,8 +23,8 @@ import androidx.compose.ui.text.intl.Locale import ca.gosyer.jui.core.lang.getDisplayName import ca.gosyer.jui.core.lang.withIOContext import ca.gosyer.jui.data.base.DateHandler -import ca.gosyer.jui.data.ui.UiPreferences -import ca.gosyer.jui.data.ui.model.StartScreen +import ca.gosyer.jui.domain.ui.model.StartScreen +import ca.gosyer.jui.domain.ui.service.UiPreferences import ca.gosyer.jui.i18n.MR import ca.gosyer.jui.ui.base.navigation.Toolbar import ca.gosyer.jui.ui.base.prefs.ChoicePreference diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/settings/SettingsLibraryScreen.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/settings/SettingsLibraryScreen.kt index 1bb7fccf..665aa634 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/settings/SettingsLibraryScreen.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/settings/SettingsLibraryScreen.kt @@ -33,9 +33,9 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp -import ca.gosyer.jui.data.library.LibraryPreferences -import ca.gosyer.jui.data.library.model.DisplayMode -import ca.gosyer.jui.data.server.interactions.CategoryInteractionHandler +import ca.gosyer.jui.data.category.CategoryRepositoryImpl +import ca.gosyer.jui.domain.library.model.DisplayMode +import ca.gosyer.jui.domain.library.service.LibraryPreferences import ca.gosyer.jui.i18n.MR import ca.gosyer.jui.ui.base.dialog.getMaterialDialogProperties import ca.gosyer.jui.ui.base.navigation.Toolbar @@ -88,7 +88,7 @@ class SettingsLibraryScreen : Screen { class SettingsLibraryViewModel @Inject constructor( libraryPreferences: LibraryPreferences, - private val categoryHandler: CategoryInteractionHandler, + private val categoryHandler: CategoryRepositoryImpl, contextWrapper: ContextWrapper ) : ViewModel(contextWrapper) { diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/settings/SettingsReaderScreen.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/settings/SettingsReaderScreen.kt index a2f17e06..984a1c18 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/settings/SettingsReaderScreen.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/settings/SettingsReaderScreen.kt @@ -20,11 +20,11 @@ import androidx.compose.runtime.getValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.util.fastForEach -import ca.gosyer.jui.data.reader.ReaderModePreferences -import ca.gosyer.jui.data.reader.ReaderPreferences -import ca.gosyer.jui.data.reader.model.Direction -import ca.gosyer.jui.data.reader.model.ImageScale -import ca.gosyer.jui.data.reader.model.NavigationMode +import ca.gosyer.jui.domain.reader.model.Direction +import ca.gosyer.jui.domain.reader.model.ImageScale +import ca.gosyer.jui.domain.reader.model.NavigationMode +import ca.gosyer.jui.domain.reader.service.ReaderModePreferences +import ca.gosyer.jui.domain.reader.service.ReaderPreferences import ca.gosyer.jui.i18n.MR import ca.gosyer.jui.ui.base.navigation.Toolbar import ca.gosyer.jui.ui.base.prefs.ChoicePreference diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/settings/SettingsServerScreen.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/settings/SettingsServerScreen.kt index 69ec4293..7ec2c047 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/settings/SettingsServerScreen.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/settings/SettingsServerScreen.kt @@ -21,9 +21,9 @@ import androidx.compose.runtime.collectAsState import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.text.input.PasswordVisualTransformation -import ca.gosyer.jui.data.server.ServerPreferences -import ca.gosyer.jui.data.server.model.Auth -import ca.gosyer.jui.data.server.model.Proxy +import ca.gosyer.jui.domain.server.model.Auth +import ca.gosyer.jui.domain.server.model.Proxy +import ca.gosyer.jui.domain.server.service.ServerPreferences import ca.gosyer.jui.i18n.MR import ca.gosyer.jui.ui.base.navigation.Toolbar import ca.gosyer.jui.ui.base.prefs.ChoicePreference 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 0b5741cf..833742ea 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 @@ -8,7 +8,7 @@ package ca.gosyer.jui.ui.sources.browse import androidx.compose.runtime.Composable import androidx.compose.runtime.collectAsState -import ca.gosyer.jui.data.models.Source +import ca.gosyer.jui.domain.source.model.Source import ca.gosyer.jui.ui.manga.MangaScreen import ca.gosyer.jui.ui.sources.browse.components.SourceScreenContent import ca.gosyer.jui.ui.sources.browse.filter.SourceFiltersViewModel 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 223511b0..77a3b0ae 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 @@ -6,13 +6,13 @@ package ca.gosyer.jui.ui.sources.browse -import ca.gosyer.jui.data.catalog.CatalogPreferences -import ca.gosyer.jui.data.library.LibraryPreferences -import ca.gosyer.jui.data.library.model.DisplayMode -import ca.gosyer.jui.data.models.Manga -import ca.gosyer.jui.data.models.MangaPage -import ca.gosyer.jui.data.models.Source -import ca.gosyer.jui.data.server.interactions.SourceInteractionHandler +import ca.gosyer.jui.data.source.SourceRepositoryImpl +import ca.gosyer.jui.domain.library.model.DisplayMode +import ca.gosyer.jui.domain.library.service.LibraryPreferences +import ca.gosyer.jui.domain.manga.model.Manga +import ca.gosyer.jui.domain.source.model.MangaPage +import ca.gosyer.jui.domain.source.model.Source +import ca.gosyer.jui.domain.source.service.CatalogPreferences import ca.gosyer.jui.uicore.vm.ContextWrapper import ca.gosyer.jui.uicore.vm.ViewModel import kotlinx.coroutines.flow.MutableStateFlow @@ -26,7 +26,7 @@ import org.lighthousegames.logging.logging class SourceScreenViewModel( private val source: Source, - private val sourceHandler: SourceInteractionHandler, + private val sourceHandler: SourceRepositoryImpl, private val catalogPreferences: CatalogPreferences, private val libraryPreferences: LibraryPreferences, contextWrapper: ContextWrapper, @@ -34,7 +34,7 @@ class SourceScreenViewModel( ) : ViewModel(contextWrapper) { @Inject constructor( - sourceHandler: SourceInteractionHandler, + sourceHandler: SourceRepositoryImpl, catalogPreferences: CatalogPreferences, libraryPreferences: LibraryPreferences, contextWrapper: ContextWrapper, @@ -121,9 +121,9 @@ class SourceScreenViewModel( private suspend fun getPage(): MangaPage? { return when { - isLatest.value -> sourceHandler.getLatestManga(source, pageNum.value) - _query.value != null || _usingFilters.value -> sourceHandler.getSearchResults(source, _query.value.orEmpty(), pageNum.value) - else -> sourceHandler.getPopularManga(source, pageNum.value) + isLatest.value -> sourceHandler.getLatestManga(source.id, pageNum.value) + _query.value != null || _usingFilters.value -> sourceHandler.getSearchResults(source.id, _query.value.orEmpty(), pageNum.value) + else -> sourceHandler.getPopularManga(source.id, pageNum.value) } .catch { log.warn(it) { "Error getting source page" } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/browse/components/SourceMangaComfortableGrid.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/browse/components/SourceMangaComfortableGrid.kt index 5c4e155e..fc284708 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/browse/components/SourceMangaComfortableGrid.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/browse/components/SourceMangaComfortableGrid.kt @@ -32,7 +32,7 @@ import androidx.compose.ui.text.TextStyle import androidx.compose.ui.text.font.FontFamily import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp -import ca.gosyer.jui.data.models.Manga +import ca.gosyer.jui.domain.manga.model.Manga import ca.gosyer.jui.uicore.components.VerticalScrollbar import ca.gosyer.jui.uicore.components.mangaAspectRatio import ca.gosyer.jui.uicore.components.rememberScrollbarAdapter diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/browse/components/SourceMangaCompactGrid.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/browse/components/SourceMangaCompactGrid.kt index 8367974e..b5e1b58b 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/browse/components/SourceMangaCompactGrid.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/browse/components/SourceMangaCompactGrid.kt @@ -35,7 +35,7 @@ import androidx.compose.ui.text.TextStyle import androidx.compose.ui.text.font.FontFamily import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp -import ca.gosyer.jui.data.models.Manga +import ca.gosyer.jui.domain.manga.model.Manga import ca.gosyer.jui.uicore.components.VerticalScrollbar import ca.gosyer.jui.uicore.components.mangaAspectRatio import ca.gosyer.jui.uicore.components.rememberScrollbarAdapter diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/browse/components/SourceMangaList.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/browse/components/SourceMangaList.kt index 265ed7e0..45c33455 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/browse/components/SourceMangaList.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/browse/components/SourceMangaList.kt @@ -24,7 +24,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip import androidx.compose.ui.graphics.FilterQuality import androidx.compose.ui.unit.dp -import ca.gosyer.jui.data.models.Manga +import ca.gosyer.jui.domain.manga.model.Manga import ca.gosyer.jui.uicore.components.MangaListItem import ca.gosyer.jui.uicore.components.MangaListItemImage import ca.gosyer.jui.uicore.components.MangaListItemTitle diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/browse/components/SourceScreenContent.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/browse/components/SourceScreenContent.kt index 501fa2e7..de618b73 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/browse/components/SourceScreenContent.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/browse/components/SourceScreenContent.kt @@ -43,9 +43,9 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.input.pointer.pointerInput import androidx.compose.ui.unit.dp import androidx.compose.ui.util.fastForEach -import ca.gosyer.jui.data.library.model.DisplayMode -import ca.gosyer.jui.data.models.Manga -import ca.gosyer.jui.data.models.Source +import ca.gosyer.jui.domain.library.model.DisplayMode +import ca.gosyer.jui.domain.manga.model.Manga +import ca.gosyer.jui.domain.source.model.Source import ca.gosyer.jui.i18n.MR import ca.gosyer.jui.ui.base.navigation.ActionItem import ca.gosyer.jui.ui.base.navigation.BackHandler diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/browse/filter/SourceFiltersMenu.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/browse/filter/SourceFiltersMenu.kt index ab1186bc..f255fcc7 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/browse/filter/SourceFiltersMenu.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/browse/filter/SourceFiltersMenu.kt @@ -58,7 +58,7 @@ import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.dp import androidx.compose.ui.util.fastForEach import androidx.compose.ui.util.fastForEachIndexed -import ca.gosyer.jui.data.models.sourcefilters.SortFilter +import ca.gosyer.jui.domain.source.model.sourcefilters.SortFilter import ca.gosyer.jui.i18n.MR import ca.gosyer.jui.ui.base.prefs.ExpandablePreference import ca.gosyer.jui.ui.sources.browse.filter.model.SourceFiltersView diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/browse/filter/SourceFiltersViewModel.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/browse/filter/SourceFiltersViewModel.kt index 8c0b159e..0c926205 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/browse/filter/SourceFiltersViewModel.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/browse/filter/SourceFiltersViewModel.kt @@ -6,8 +6,8 @@ package ca.gosyer.jui.ui.sources.browse.filter -import ca.gosyer.jui.data.models.sourcefilters.SourceFilter -import ca.gosyer.jui.data.server.interactions.SourceInteractionHandler +import ca.gosyer.jui.data.source.SourceRepositoryImpl +import ca.gosyer.jui.domain.source.model.sourcefilters.SourceFilter import ca.gosyer.jui.ui.sources.browse.filter.model.SourceFiltersView import ca.gosyer.jui.uicore.vm.ContextWrapper import ca.gosyer.jui.uicore.vm.ViewModel @@ -26,11 +26,11 @@ import org.lighthousegames.logging.logging class SourceFiltersViewModel( private val sourceId: Long, - private val sourceHandler: SourceInteractionHandler, + private val sourceHandler: SourceRepositoryImpl, contextWrapper: ContextWrapper ) : ViewModel(contextWrapper) { @Inject constructor( - sourceHandler: SourceInteractionHandler, + sourceHandler: SourceRepositoryImpl, contextWrapper: ContextWrapper, params: Params, ) : this( diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/browse/filter/model/SourceFiltersView.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/browse/filter/model/SourceFiltersView.kt index b20ac134..c64f98bf 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/browse/filter/model/SourceFiltersView.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/browse/filter/model/SourceFiltersView.kt @@ -6,15 +6,15 @@ package ca.gosyer.jui.ui.sources.browse.filter.model -import ca.gosyer.jui.data.models.sourcefilters.CheckBoxFilter -import ca.gosyer.jui.data.models.sourcefilters.GroupFilter -import ca.gosyer.jui.data.models.sourcefilters.HeaderFilter -import ca.gosyer.jui.data.models.sourcefilters.SelectFilter -import ca.gosyer.jui.data.models.sourcefilters.SeparatorFilter -import ca.gosyer.jui.data.models.sourcefilters.SortFilter -import ca.gosyer.jui.data.models.sourcefilters.SourceFilter -import ca.gosyer.jui.data.models.sourcefilters.TextFilter -import ca.gosyer.jui.data.models.sourcefilters.TriStateFilter +import ca.gosyer.jui.domain.source.model.sourcefilters.CheckBoxFilter +import ca.gosyer.jui.domain.source.model.sourcefilters.GroupFilter +import ca.gosyer.jui.domain.source.model.sourcefilters.HeaderFilter +import ca.gosyer.jui.domain.source.model.sourcefilters.SelectFilter +import ca.gosyer.jui.domain.source.model.sourcefilters.SeparatorFilter +import ca.gosyer.jui.domain.source.model.sourcefilters.SortFilter +import ca.gosyer.jui.domain.source.model.sourcefilters.SourceFilter +import ca.gosyer.jui.domain.source.model.sourcefilters.TextFilter +import ca.gosyer.jui.domain.source.model.sourcefilters.TriStateFilter import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.asStateFlow diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/components/SourcesNavigator.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/components/SourcesNavigator.kt index fa012ce5..e4fd0a6a 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/components/SourcesNavigator.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/components/SourcesNavigator.kt @@ -18,7 +18,7 @@ import androidx.compose.runtime.saveable.mapSaver import androidx.compose.runtime.saveable.rememberSaveable import androidx.compose.runtime.snapshots.SnapshotStateMap import androidx.compose.runtime.staticCompositionLocalOf -import ca.gosyer.jui.data.models.Source +import ca.gosyer.jui.domain.source.model.Source import ca.gosyer.jui.ui.sources.browse.SourceScreen import ca.gosyer.jui.ui.sources.globalsearch.GlobalSearchScreen import ca.gosyer.jui.ui.sources.home.SourceHomeScreen diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/globalsearch/GlobalSearchViewModel.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/globalsearch/GlobalSearchViewModel.kt index c3c9cf65..29e0efbb 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/globalsearch/GlobalSearchViewModel.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/globalsearch/GlobalSearchViewModel.kt @@ -8,10 +8,10 @@ package ca.gosyer.jui.ui.sources.globalsearch import androidx.compose.runtime.snapshots.SnapshotStateMap import ca.gosyer.jui.core.lang.IO -import ca.gosyer.jui.data.catalog.CatalogPreferences -import ca.gosyer.jui.data.models.MangaPage -import ca.gosyer.jui.data.models.Source -import ca.gosyer.jui.data.server.interactions.SourceInteractionHandler +import ca.gosyer.jui.data.source.SourceRepositoryImpl +import ca.gosyer.jui.domain.source.model.MangaPage +import ca.gosyer.jui.domain.source.model.Source +import ca.gosyer.jui.domain.source.service.CatalogPreferences import ca.gosyer.jui.i18n.MR import ca.gosyer.jui.uicore.vm.ContextWrapper import ca.gosyer.jui.uicore.vm.ViewModel @@ -37,7 +37,7 @@ import me.tatarka.inject.annotations.Inject import org.lighthousegames.logging.logging class GlobalSearchViewModel @Inject constructor( - private val sourceHandler: SourceInteractionHandler, + private val sourceHandler: SourceRepositoryImpl, catalogPreferences: CatalogPreferences, contextWrapper: ContextWrapper, params: Params @@ -100,7 +100,7 @@ class GlobalSearchViewModel @Inject constructor( async { semaphore.withPermit { sourceHandler - .getSearchResults(source, query, 1) + .getSearchResults(source.id, query, 1) .map { if (it.mangaList.isEmpty()) { Search.Failure(MR.strings.no_results_found.toPlatformString()) diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/globalsearch/components/GlobalSearchMangaComfortableGrid.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/globalsearch/components/GlobalSearchMangaComfortableGrid.kt index 208b97a4..c07635ec 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/globalsearch/components/GlobalSearchMangaComfortableGrid.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/globalsearch/components/GlobalSearchMangaComfortableGrid.kt @@ -25,7 +25,7 @@ import androidx.compose.ui.text.font.FontFamily import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import androidx.compose.ui.unit.times -import ca.gosyer.jui.data.models.Manga +import ca.gosyer.jui.domain.manga.model.Manga import ca.gosyer.jui.ui.sources.browse.components.SourceMangaBadges import ca.gosyer.jui.uicore.components.mangaAspectRatio import ca.gosyer.jui.uicore.image.KamelImage diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/globalsearch/components/GlobalSearchMangaCompactGrid.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/globalsearch/components/GlobalSearchMangaCompactGrid.kt index a631ad30..40d5122e 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/globalsearch/components/GlobalSearchMangaCompactGrid.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/globalsearch/components/GlobalSearchMangaCompactGrid.kt @@ -28,7 +28,7 @@ import androidx.compose.ui.text.TextStyle import androidx.compose.ui.text.font.FontFamily import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp -import ca.gosyer.jui.data.models.Manga +import ca.gosyer.jui.domain.manga.model.Manga import ca.gosyer.jui.ui.sources.browse.components.SourceMangaBadges import ca.gosyer.jui.uicore.components.mangaAspectRatio import ca.gosyer.jui.uicore.image.KamelImage diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/globalsearch/components/GlobalSearchScreenContent.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/globalsearch/components/GlobalSearchScreenContent.kt index 33c375d7..10c51234 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/globalsearch/components/GlobalSearchScreenContent.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/globalsearch/components/GlobalSearchScreenContent.kt @@ -33,9 +33,9 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp -import ca.gosyer.jui.data.library.model.DisplayMode -import ca.gosyer.jui.data.models.Manga -import ca.gosyer.jui.data.models.Source +import ca.gosyer.jui.domain.library.model.DisplayMode +import ca.gosyer.jui.domain.manga.model.Manga +import ca.gosyer.jui.domain.source.model.Source import ca.gosyer.jui.i18n.MR import ca.gosyer.jui.ui.base.components.localeToString import ca.gosyer.jui.ui.base.navigation.Toolbar diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/home/SourceHomeScreenViewModel.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/home/SourceHomeScreenViewModel.kt index 0acb0aa0..d1f4cef0 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/home/SourceHomeScreenViewModel.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/home/SourceHomeScreenViewModel.kt @@ -6,9 +6,9 @@ package ca.gosyer.jui.ui.sources.home -import ca.gosyer.jui.data.catalog.CatalogPreferences -import ca.gosyer.jui.data.models.Source -import ca.gosyer.jui.data.server.interactions.SourceInteractionHandler +import ca.gosyer.jui.data.source.SourceRepositoryImpl +import ca.gosyer.jui.domain.source.model.Source +import ca.gosyer.jui.domain.source.service.CatalogPreferences import ca.gosyer.jui.uicore.vm.ContextWrapper import ca.gosyer.jui.uicore.vm.ViewModel import kotlinx.coroutines.flow.MutableStateFlow @@ -24,7 +24,7 @@ import me.tatarka.inject.annotations.Inject import org.lighthousegames.logging.logging class SourceHomeScreenViewModel @Inject constructor( - private val sourceHandler: SourceInteractionHandler, + private val sourceHandler: SourceRepositoryImpl, catalogPreferences: CatalogPreferences, contextWrapper: ContextWrapper ) : ViewModel(contextWrapper) { diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/home/components/SourceHomeScreenContent.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/home/components/SourceHomeScreenContent.kt index 8468afe4..f79f9631 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/home/components/SourceHomeScreenContent.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/home/components/SourceHomeScreenContent.kt @@ -44,7 +44,7 @@ import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.text.toUpperCase import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp -import ca.gosyer.jui.data.models.Source +import ca.gosyer.jui.domain.source.model.Source import ca.gosyer.jui.i18n.MR import ca.gosyer.jui.ui.base.components.TooltipArea import ca.gosyer.jui.ui.base.components.localeToString diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/settings/SourceSettingsScreenViewModel.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/settings/SourceSettingsScreenViewModel.kt index 4a1550e9..aab14cdb 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/settings/SourceSettingsScreenViewModel.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/settings/SourceSettingsScreenViewModel.kt @@ -6,8 +6,8 @@ package ca.gosyer.jui.ui.sources.settings -import ca.gosyer.jui.data.models.sourcepreference.SourcePreference -import ca.gosyer.jui.data.server.interactions.SourceInteractionHandler +import ca.gosyer.jui.data.source.SourceRepositoryImpl +import ca.gosyer.jui.domain.source.model.sourcepreference.SourcePreference import ca.gosyer.jui.ui.sources.settings.model.SourceSettingsView import ca.gosyer.jui.uicore.vm.ContextWrapper import ca.gosyer.jui.uicore.vm.ViewModel @@ -25,7 +25,7 @@ import me.tatarka.inject.annotations.Inject import org.lighthousegames.logging.logging class SourceSettingsScreenViewModel @Inject constructor( - private val sourceHandler: SourceInteractionHandler, + private val sourceHandler: SourceRepositoryImpl, contextWrapper: ContextWrapper, private val params: Params ) : ViewModel(contextWrapper) { diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/settings/model/SourceSettingsView.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/settings/model/SourceSettingsView.kt index 552f0590..26bda3df 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/settings/model/SourceSettingsView.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/settings/model/SourceSettingsView.kt @@ -6,13 +6,13 @@ package ca.gosyer.jui.ui.sources.settings.model -import ca.gosyer.jui.data.models.sourcepreference.CheckBoxPreference -import ca.gosyer.jui.data.models.sourcepreference.EditTextPreference -import ca.gosyer.jui.data.models.sourcepreference.ListPreference -import ca.gosyer.jui.data.models.sourcepreference.MultiSelectListPreference -import ca.gosyer.jui.data.models.sourcepreference.SourcePreference -import ca.gosyer.jui.data.models.sourcepreference.SwitchPreference -import ca.gosyer.jui.data.models.sourcepreference.TwoStateProps +import ca.gosyer.jui.domain.source.model.sourcepreference.CheckBoxPreference +import ca.gosyer.jui.domain.source.model.sourcepreference.EditTextPreference +import ca.gosyer.jui.domain.source.model.sourcepreference.ListPreference +import ca.gosyer.jui.domain.source.model.sourcepreference.MultiSelectListPreference +import ca.gosyer.jui.domain.source.model.sourcepreference.SourcePreference +import ca.gosyer.jui.domain.source.model.sourcepreference.SwitchPreference +import ca.gosyer.jui.domain.source.model.sourcepreference.TwoStateProps import ca.gosyer.jui.ui.util.lang.stringFormat import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.StateFlow diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/updates/UpdatesScreenViewModel.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/updates/UpdatesScreenViewModel.kt index c09769d7..0971109c 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/updates/UpdatesScreenViewModel.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/updates/UpdatesScreenViewModel.kt @@ -10,10 +10,10 @@ import androidx.compose.runtime.mutableStateListOf import androidx.compose.runtime.mutableStateMapOf import androidx.compose.runtime.snapshotFlow import androidx.compose.runtime.snapshots.SnapshotStateList -import ca.gosyer.jui.data.models.Chapter -import ca.gosyer.jui.data.server.interactions.ChapterInteractionHandler -import ca.gosyer.jui.data.server.interactions.UpdatesInteractionHandler -import ca.gosyer.jui.domain.download.DownloadService +import ca.gosyer.jui.data.chapter.ChapterRepositoryImpl +import ca.gosyer.jui.data.updates.UpdatesRepositoryImpl +import ca.gosyer.jui.domain.chapter.model.Chapter +import ca.gosyer.jui.domain.download.service.DownloadService import ca.gosyer.jui.ui.base.chapter.ChapterDownloadItem import ca.gosyer.jui.uicore.vm.ContextWrapper import ca.gosyer.jui.uicore.vm.ViewModel @@ -37,8 +37,8 @@ import me.tatarka.inject.annotations.Inject import org.lighthousegames.logging.logging class UpdatesScreenViewModel @Inject constructor( - private val chapterHandler: ChapterInteractionHandler, - private val updatesHandler: UpdatesInteractionHandler, + private val chapterHandler: ChapterRepositoryImpl, + private val updatesHandler: UpdatesRepositoryImpl, contextWrapper: ContextWrapper ) : ViewModel(contextWrapper) { @@ -117,7 +117,7 @@ class UpdatesScreenViewModel @Inject constructor( } fun downloadChapter(chapter: Chapter) { - chapterHandler.queueChapterDownload(chapter) + chapterHandler.queueChapterDownload(chapter.mangaId, chapter.index) .catch { log.warn(it) { "Error queueing chapter" } } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/updates/components/UpdatesScreenContent.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/updates/components/UpdatesScreenContent.kt index b248969c..4dfdb149 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/updates/components/UpdatesScreenContent.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/updates/components/UpdatesScreenContent.kt @@ -29,7 +29,7 @@ import androidx.compose.ui.draw.clip import androidx.compose.ui.graphics.FilterQuality import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.unit.dp -import ca.gosyer.jui.data.models.Chapter +import ca.gosyer.jui.domain.chapter.model.Chapter import ca.gosyer.jui.i18n.MR import ca.gosyer.jui.ui.base.chapter.ChapterDownloadIcon import ca.gosyer.jui.ui.base.chapter.ChapterDownloadItem diff --git a/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/downloads/DesktopDownloadService.kt b/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/downloads/DesktopDownloadService.kt index 46958e02..ff4bc794 100644 --- a/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/downloads/DesktopDownloadService.kt +++ b/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/downloads/DesktopDownloadService.kt @@ -7,7 +7,7 @@ package ca.gosyer.jui.ui.downloads import ca.gosyer.jui.domain.base.WebsocketService -import ca.gosyer.jui.domain.download.DownloadService +import ca.gosyer.jui.domain.download.service.DownloadService import ca.gosyer.jui.uicore.vm.ContextWrapper internal actual fun startDownloadService( diff --git a/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/main/components/TrayViewModel.kt b/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/main/components/TrayViewModel.kt index 3183a136..3d6cc923 100644 --- a/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/main/components/TrayViewModel.kt +++ b/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/main/components/TrayViewModel.kt @@ -6,7 +6,7 @@ package ca.gosyer.jui.ui.main.components -import ca.gosyer.jui.data.update.UpdateChecker +import ca.gosyer.jui.domain.updates.interactor.UpdateChecker import ca.gosyer.jui.uicore.vm.ContextWrapper import ca.gosyer.jui.uicore.vm.ViewModel import kotlinx.coroutines.MainScope diff --git a/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/settings/DesktopSettingsServerScreen.kt b/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/settings/DesktopSettingsServerScreen.kt index 3c9c5ad2..648f3d9a 100644 --- a/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/settings/DesktopSettingsServerScreen.kt +++ b/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/settings/DesktopSettingsServerScreen.kt @@ -15,10 +15,10 @@ import androidx.compose.runtime.DisposableEffect import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue import androidx.compose.ui.text.input.PasswordVisualTransformation -import ca.gosyer.jui.data.server.ServerHostPreferences -import ca.gosyer.jui.data.server.ServerPreferences -import ca.gosyer.jui.data.server.ServerService -import ca.gosyer.jui.data.server.model.Auth +import ca.gosyer.jui.domain.server.model.Auth +import ca.gosyer.jui.domain.server.service.ServerHostPreferences +import ca.gosyer.jui.domain.server.service.ServerPreferences +import ca.gosyer.jui.domain.server.service.ServerService import ca.gosyer.jui.i18n.MR import ca.gosyer.jui.ui.base.prefs.EditTextPreference import ca.gosyer.jui.ui.base.prefs.PreferenceRow diff --git a/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/util/compose/Image.kt b/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/util/compose/Image.kt index 66103575..4fc6fd7c 100644 --- a/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/util/compose/Image.kt +++ b/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/util/compose/Image.kt @@ -8,7 +8,7 @@ package ca.gosyer.jui.ui.util.compose import androidx.compose.ui.graphics.ImageBitmap import androidx.compose.ui.graphics.toComposeImageBitmap -import ca.gosyer.jui.data.server.Http +import ca.gosyer.jui.domain.server.Http import io.ktor.client.call.body import io.ktor.client.plugins.expectSuccess import io.ktor.client.request.HttpRequestBuilder diff --git a/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/util/compose/WindowGet.kt b/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/util/compose/WindowGet.kt index 45af5028..fdac856c 100644 --- a/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/util/compose/WindowGet.kt +++ b/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/util/compose/WindowGet.kt @@ -10,7 +10,7 @@ import androidx.compose.ui.unit.DpSize import androidx.compose.ui.unit.dp import androidx.compose.ui.window.WindowPlacement import androidx.compose.ui.window.WindowPosition -import ca.gosyer.jui.data.ui.model.WindowSettings +import ca.gosyer.jui.domain.ui.model.WindowSettings data class WindowGet( val offset: WindowPosition,