mirror of
https://github.com/Suwayomi/TachideskJUI.git
synced 2025-12-16 09:42:03 +01:00
Simple domain module
This commit is contained in:
@@ -14,6 +14,7 @@ dependencies {
|
|||||||
implementation(projects.core)
|
implementation(projects.core)
|
||||||
implementation(projects.i18n)
|
implementation(projects.i18n)
|
||||||
implementation(projects.data)
|
implementation(projects.data)
|
||||||
|
implementation(projects.domain)
|
||||||
implementation(projects.uiCore)
|
implementation(projects.uiCore)
|
||||||
implementation(projects.presentation)
|
implementation(projects.presentation)
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ package ca.gosyer.jui.android
|
|||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import ca.gosyer.jui.core.di.AppScope
|
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 ca.gosyer.jui.ui.base.UiComponent
|
||||||
import me.tatarka.inject.annotations.Component
|
import me.tatarka.inject.annotations.Component
|
||||||
import me.tatarka.inject.annotations.Provides
|
import me.tatarka.inject.annotations.Provides
|
||||||
@@ -20,7 +20,7 @@ abstract class AppComponent(
|
|||||||
@get:AppScope
|
@get:AppScope
|
||||||
@get:Provides
|
@get:Provides
|
||||||
val context: Context
|
val context: Context
|
||||||
) : DataComponent, UiComponent {
|
) : DomainComponent, UiComponent {
|
||||||
|
|
||||||
abstract val appMigrations: AppMigrations
|
abstract val appMigrations: AppMigrations
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import androidx.activity.compose.setContent
|
|||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import androidx.compose.runtime.CompositionLocalProvider
|
import androidx.compose.runtime.CompositionLocalProvider
|
||||||
import ca.gosyer.jui.android.data.download.AndroidDownloadService
|
import ca.gosyer.jui.android.data.download.AndroidDownloadService
|
||||||
import ca.gosyer.jui.data.base.WebsocketService.Actions
|
import ca.gosyer.jui.domain.base.WebsocketService.Actions
|
||||||
import ca.gosyer.jui.ui.base.theme.AppTheme
|
import ca.gosyer.jui.ui.base.theme.AppTheme
|
||||||
import ca.gosyer.jui.ui.main.MainMenu
|
import ca.gosyer.jui.ui.main.MainMenu
|
||||||
|
|
||||||
|
|||||||
@@ -20,13 +20,13 @@ import ca.gosyer.jui.android.util.notificationManager
|
|||||||
import ca.gosyer.jui.core.lang.chop
|
import ca.gosyer.jui.core.lang.chop
|
||||||
import ca.gosyer.jui.core.lang.throwIfCancellation
|
import ca.gosyer.jui.core.lang.throwIfCancellation
|
||||||
import ca.gosyer.jui.core.prefs.getAsFlow
|
import ca.gosyer.jui.core.prefs.getAsFlow
|
||||||
import ca.gosyer.jui.data.base.WebsocketService.Actions
|
|
||||||
import ca.gosyer.jui.data.base.WebsocketService.Status
|
|
||||||
import ca.gosyer.jui.data.download.DownloadService
|
|
||||||
import ca.gosyer.jui.data.download.DownloadService.Companion.status
|
|
||||||
import ca.gosyer.jui.data.download.model.DownloadState
|
import ca.gosyer.jui.data.download.model.DownloadState
|
||||||
import ca.gosyer.jui.data.download.model.DownloadStatus
|
import ca.gosyer.jui.data.download.model.DownloadStatus
|
||||||
import ca.gosyer.jui.data.server.requests.downloadsQuery
|
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.i18n.MR
|
import ca.gosyer.jui.i18n.MR
|
||||||
import dev.icerock.moko.resources.desc.desc
|
import dev.icerock.moko.resources.desc.desc
|
||||||
import dev.icerock.moko.resources.format
|
import dev.icerock.moko.resources.format
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import ca.gosyer.jui.android.AppComponent
|
|||||||
import ca.gosyer.jui.android.data.notification.Notifications
|
import ca.gosyer.jui.android.data.notification.Notifications
|
||||||
import ca.gosyer.jui.android.util.notificationBuilder
|
import ca.gosyer.jui.android.util.notificationBuilder
|
||||||
import ca.gosyer.jui.android.util.notificationManager
|
import ca.gosyer.jui.android.util.notificationManager
|
||||||
import ca.gosyer.jui.data.update.UpdateChecker.Update
|
import ca.gosyer.jui.domain.update.UpdateChecker.Update
|
||||||
import ca.gosyer.jui.i18n.MR
|
import ca.gosyer.jui.i18n.MR
|
||||||
import dev.icerock.moko.resources.desc.desc
|
import dev.icerock.moko.resources.desc.desc
|
||||||
import kotlinx.coroutines.flow.singleOrNull
|
import kotlinx.coroutines.flow.singleOrNull
|
||||||
|
|||||||
@@ -9,18 +9,14 @@ package ca.gosyer.jui.data
|
|||||||
import ca.gosyer.jui.core.di.AppScope
|
import ca.gosyer.jui.core.di.AppScope
|
||||||
import ca.gosyer.jui.core.prefs.PreferenceStoreFactory
|
import ca.gosyer.jui.core.prefs.PreferenceStoreFactory
|
||||||
import ca.gosyer.jui.data.catalog.CatalogPreferences
|
import ca.gosyer.jui.data.catalog.CatalogPreferences
|
||||||
import ca.gosyer.jui.data.download.DownloadService
|
|
||||||
import ca.gosyer.jui.data.extension.ExtensionPreferences
|
import ca.gosyer.jui.data.extension.ExtensionPreferences
|
||||||
import ca.gosyer.jui.data.library.LibraryPreferences
|
import ca.gosyer.jui.data.library.LibraryPreferences
|
||||||
import ca.gosyer.jui.data.library.LibraryUpdateService
|
|
||||||
import ca.gosyer.jui.data.migration.MigrationPreferences
|
import ca.gosyer.jui.data.migration.MigrationPreferences
|
||||||
import ca.gosyer.jui.data.migration.Migrations
|
|
||||||
import ca.gosyer.jui.data.reader.ReaderPreferences
|
import ca.gosyer.jui.data.reader.ReaderPreferences
|
||||||
import ca.gosyer.jui.data.server.Http
|
import ca.gosyer.jui.data.server.Http
|
||||||
import ca.gosyer.jui.data.server.HttpProvider
|
import ca.gosyer.jui.data.server.HttpProvider
|
||||||
import ca.gosyer.jui.data.server.ServerPreferences
|
import ca.gosyer.jui.data.server.ServerPreferences
|
||||||
import ca.gosyer.jui.data.ui.UiPreferences
|
import ca.gosyer.jui.data.ui.UiPreferences
|
||||||
import ca.gosyer.jui.data.update.UpdateChecker
|
|
||||||
import ca.gosyer.jui.data.update.UpdatePreferences
|
import ca.gosyer.jui.data.update.UpdatePreferences
|
||||||
import me.tatarka.inject.annotations.Provides
|
import me.tatarka.inject.annotations.Provides
|
||||||
|
|
||||||
@@ -29,14 +25,6 @@ actual interface DataComponent {
|
|||||||
|
|
||||||
val httpProvider: HttpProvider
|
val httpProvider: HttpProvider
|
||||||
|
|
||||||
val downloadService: DownloadService
|
|
||||||
|
|
||||||
val libraryUpdateService: LibraryUpdateService
|
|
||||||
|
|
||||||
val migrations: Migrations
|
|
||||||
|
|
||||||
val updateChecker: UpdateChecker
|
|
||||||
|
|
||||||
val http: Http
|
val http: Http
|
||||||
|
|
||||||
val serverPreferences: ServerPreferences
|
val serverPreferences: ServerPreferences
|
||||||
@@ -102,25 +90,5 @@ actual interface DataComponent {
|
|||||||
val httpFactory: Http
|
val httpFactory: Http
|
||||||
get() = httpProvider.get(serverPreferences)
|
get() = httpProvider.get(serverPreferences)
|
||||||
|
|
||||||
@get:AppScope
|
|
||||||
@get:Provides
|
|
||||||
val libraryUpdateServiceFactory: LibraryUpdateService
|
|
||||||
get() = LibraryUpdateService(serverPreferences, http)
|
|
||||||
|
|
||||||
@get:AppScope
|
|
||||||
@get:Provides
|
|
||||||
val downloadServiceFactory: DownloadService
|
|
||||||
get() = DownloadService(serverPreferences, http)
|
|
||||||
|
|
||||||
@get:AppScope
|
|
||||||
@get:Provides
|
|
||||||
val migrationsFactory: Migrations
|
|
||||||
get() = Migrations(migrationPreferences, readerPreferences)
|
|
||||||
|
|
||||||
@get:AppScope
|
|
||||||
@get:Provides
|
|
||||||
val updateCheckerFactory: UpdateChecker
|
|
||||||
get() = UpdateChecker(updatePreferences, http)
|
|
||||||
|
|
||||||
companion object
|
companion object
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,20 +9,15 @@ package ca.gosyer.jui.data
|
|||||||
import ca.gosyer.jui.core.di.AppScope
|
import ca.gosyer.jui.core.di.AppScope
|
||||||
import ca.gosyer.jui.core.prefs.PreferenceStoreFactory
|
import ca.gosyer.jui.core.prefs.PreferenceStoreFactory
|
||||||
import ca.gosyer.jui.data.catalog.CatalogPreferences
|
import ca.gosyer.jui.data.catalog.CatalogPreferences
|
||||||
import ca.gosyer.jui.data.download.DownloadService
|
|
||||||
import ca.gosyer.jui.data.extension.ExtensionPreferences
|
import ca.gosyer.jui.data.extension.ExtensionPreferences
|
||||||
import ca.gosyer.jui.data.library.LibraryPreferences
|
import ca.gosyer.jui.data.library.LibraryPreferences
|
||||||
import ca.gosyer.jui.data.library.LibraryUpdateService
|
|
||||||
import ca.gosyer.jui.data.migration.MigrationPreferences
|
import ca.gosyer.jui.data.migration.MigrationPreferences
|
||||||
import ca.gosyer.jui.data.migration.Migrations
|
|
||||||
import ca.gosyer.jui.data.reader.ReaderPreferences
|
import ca.gosyer.jui.data.reader.ReaderPreferences
|
||||||
import ca.gosyer.jui.data.server.Http
|
import ca.gosyer.jui.data.server.Http
|
||||||
import ca.gosyer.jui.data.server.HttpProvider
|
import ca.gosyer.jui.data.server.HttpProvider
|
||||||
import ca.gosyer.jui.data.server.ServerHostPreferences
|
import ca.gosyer.jui.data.server.ServerHostPreferences
|
||||||
import ca.gosyer.jui.data.server.ServerPreferences
|
import ca.gosyer.jui.data.server.ServerPreferences
|
||||||
import ca.gosyer.jui.data.server.ServerService
|
|
||||||
import ca.gosyer.jui.data.ui.UiPreferences
|
import ca.gosyer.jui.data.ui.UiPreferences
|
||||||
import ca.gosyer.jui.data.update.UpdateChecker
|
|
||||||
import ca.gosyer.jui.data.update.UpdatePreferences
|
import ca.gosyer.jui.data.update.UpdatePreferences
|
||||||
import me.tatarka.inject.annotations.Provides
|
import me.tatarka.inject.annotations.Provides
|
||||||
|
|
||||||
@@ -31,16 +26,6 @@ actual interface DataComponent {
|
|||||||
|
|
||||||
val httpProvider: HttpProvider
|
val httpProvider: HttpProvider
|
||||||
|
|
||||||
val downloadService: DownloadService
|
|
||||||
|
|
||||||
val libraryUpdateService: LibraryUpdateService
|
|
||||||
|
|
||||||
val migrations: Migrations
|
|
||||||
|
|
||||||
val updateChecker: UpdateChecker
|
|
||||||
|
|
||||||
val serverService: ServerService
|
|
||||||
|
|
||||||
val http: Http
|
val http: Http
|
||||||
|
|
||||||
val serverHostPreferences: ServerHostPreferences
|
val serverHostPreferences: ServerHostPreferences
|
||||||
@@ -113,30 +98,5 @@ actual interface DataComponent {
|
|||||||
val httpFactory: Http
|
val httpFactory: Http
|
||||||
get() = httpProvider.get(serverPreferences)
|
get() = httpProvider.get(serverPreferences)
|
||||||
|
|
||||||
@get:AppScope
|
|
||||||
@get:Provides
|
|
||||||
val serverServiceFactory: ServerService
|
|
||||||
get() = ServerService(serverHostPreferences)
|
|
||||||
|
|
||||||
@get:AppScope
|
|
||||||
@get:Provides
|
|
||||||
val libraryUpdateServiceFactory: LibraryUpdateService
|
|
||||||
get() = LibraryUpdateService(serverPreferences, http)
|
|
||||||
|
|
||||||
@get:AppScope
|
|
||||||
@get:Provides
|
|
||||||
val downloadServiceFactory: DownloadService
|
|
||||||
get() = DownloadService(serverPreferences, http)
|
|
||||||
|
|
||||||
@get:AppScope
|
|
||||||
@get:Provides
|
|
||||||
val migrationsFactory: Migrations
|
|
||||||
get() = Migrations(migrationPreferences, readerPreferences)
|
|
||||||
|
|
||||||
@get:AppScope
|
|
||||||
@get:Provides
|
|
||||||
val updateCheckerFactory: UpdateChecker
|
|
||||||
get() = UpdateChecker(updatePreferences, http)
|
|
||||||
|
|
||||||
companion object
|
companion object
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ dependencies {
|
|||||||
implementation(projects.core)
|
implementation(projects.core)
|
||||||
implementation(projects.i18n)
|
implementation(projects.i18n)
|
||||||
implementation(projects.data)
|
implementation(projects.data)
|
||||||
|
implementation(projects.domain)
|
||||||
implementation(projects.uiCore)
|
implementation(projects.uiCore)
|
||||||
implementation(projects.presentation)
|
implementation(projects.presentation)
|
||||||
|
|
||||||
|
|||||||
@@ -7,14 +7,14 @@
|
|||||||
package ca.gosyer.jui.desktop
|
package ca.gosyer.jui.desktop
|
||||||
|
|
||||||
import ca.gosyer.jui.core.di.AppScope
|
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 ca.gosyer.jui.ui.base.UiComponent
|
||||||
import me.tatarka.inject.annotations.Component
|
import me.tatarka.inject.annotations.Component
|
||||||
import me.tatarka.inject.annotations.Provides
|
import me.tatarka.inject.annotations.Provides
|
||||||
|
|
||||||
@AppScope
|
@AppScope
|
||||||
@Component
|
@Component
|
||||||
abstract class AppComponent : DataComponent, UiComponent {
|
abstract class AppComponent : DomainComponent, UiComponent {
|
||||||
|
|
||||||
abstract val appMigrations: AppMigrations
|
abstract val appMigrations: AppMigrations
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,81 @@
|
|||||||
|
@Suppress("DSL_SCOPE_VIOLATION")
|
||||||
|
plugins {
|
||||||
|
id(libs.plugins.kotlin.multiplatform.get().pluginId)
|
||||||
|
id(libs.plugins.kotlin.serialization.get().pluginId)
|
||||||
|
id(libs.plugins.android.library.get().pluginId)
|
||||||
|
id(libs.plugins.ksp.get().pluginId)
|
||||||
|
id(libs.plugins.buildkonfig.get().pluginId)
|
||||||
|
id(libs.plugins.kotlinter.get().pluginId)
|
||||||
|
}
|
||||||
|
|
||||||
|
kotlin {
|
||||||
|
android {
|
||||||
|
compilations {
|
||||||
|
all {
|
||||||
|
kotlinOptions.jvmTarget = Config.androidJvmTarget.toString()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
jvm("desktop") {
|
||||||
|
compilations {
|
||||||
|
all {
|
||||||
|
kotlinOptions.jvmTarget = Config.desktopJvmTarget.toString()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sourceSets {
|
||||||
|
all {
|
||||||
|
languageSettings {
|
||||||
|
optIn("kotlin.RequiresOptIn")
|
||||||
|
optIn("kotlinx.coroutines.ExperimentalCoroutinesApi")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
val commonMain by getting {
|
||||||
|
dependencies {
|
||||||
|
api(kotlin("stdlib-common"))
|
||||||
|
api(libs.coroutines.core)
|
||||||
|
api(libs.serialization.json)
|
||||||
|
api(libs.kotlinInject.runtime)
|
||||||
|
api(libs.ktor.core)
|
||||||
|
api(libs.ktor.websockets)
|
||||||
|
api(libs.okio)
|
||||||
|
api(libs.dateTime)
|
||||||
|
api(projects.core)
|
||||||
|
api(projects.i18n)
|
||||||
|
api(projects.data)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
val commonTest by getting {
|
||||||
|
dependencies {
|
||||||
|
implementation(kotlin("test-common"))
|
||||||
|
implementation(kotlin("test-annotations-common"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
val desktopMain by getting {
|
||||||
|
dependencies {
|
||||||
|
api(kotlin("stdlib-jdk8"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
val desktopTest by getting {
|
||||||
|
}
|
||||||
|
|
||||||
|
val androidMain by getting {
|
||||||
|
dependencies {
|
||||||
|
api(kotlin("stdlib-jdk8"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
val androidTest by getting {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
add("kspDesktop", libs.kotlinInject.compiler)
|
||||||
|
add("kspAndroid", libs.kotlinInject.compiler)
|
||||||
|
}
|
||||||
|
|
||||||
|
buildkonfig {
|
||||||
|
packageName = "ca.gosyer.jui.domain.build"
|
||||||
|
}
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<manifest package="ca.gosyer.jui.domain"/>
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
/*
|
||||||
|
* 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
|
||||||
|
|
||||||
|
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 me.tatarka.inject.annotations.Provides
|
||||||
|
|
||||||
|
actual interface DomainComponent : DataComponent {
|
||||||
|
|
||||||
|
val downloadService: DownloadService
|
||||||
|
|
||||||
|
val libraryUpdateService: LibraryUpdateService
|
||||||
|
|
||||||
|
val migrations: RunMigrations
|
||||||
|
|
||||||
|
val updateChecker: UpdateChecker
|
||||||
|
|
||||||
|
@get:AppScope
|
||||||
|
@get:Provides
|
||||||
|
val libraryUpdateServiceFactory: LibraryUpdateService
|
||||||
|
get() = LibraryUpdateService(serverPreferences, http)
|
||||||
|
|
||||||
|
@get:AppScope
|
||||||
|
@get:Provides
|
||||||
|
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)
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
/*
|
||||||
|
* 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
|
||||||
|
|
||||||
|
expect interface DomainComponent
|
||||||
@@ -4,7 +4,7 @@
|
|||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package ca.gosyer.jui.data.base
|
package ca.gosyer.jui.domain.base
|
||||||
|
|
||||||
import ca.gosyer.jui.core.lang.throwIfCancellation
|
import ca.gosyer.jui.core.lang.throwIfCancellation
|
||||||
import ca.gosyer.jui.data.server.Http
|
import ca.gosyer.jui.data.server.Http
|
||||||
@@ -4,15 +4,15 @@
|
|||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package ca.gosyer.jui.data.download
|
package ca.gosyer.jui.domain.download
|
||||||
|
|
||||||
import ca.gosyer.jui.data.base.WebsocketService
|
|
||||||
import ca.gosyer.jui.data.download.model.DownloadChapter
|
import ca.gosyer.jui.data.download.model.DownloadChapter
|
||||||
import ca.gosyer.jui.data.download.model.DownloadStatus
|
import ca.gosyer.jui.data.download.model.DownloadStatus
|
||||||
import ca.gosyer.jui.data.download.model.DownloaderStatus
|
import ca.gosyer.jui.data.download.model.DownloaderStatus
|
||||||
import ca.gosyer.jui.data.server.Http
|
import ca.gosyer.jui.data.server.Http
|
||||||
import ca.gosyer.jui.data.server.ServerPreferences
|
import ca.gosyer.jui.data.server.ServerPreferences
|
||||||
import ca.gosyer.jui.data.server.requests.downloadsQuery
|
import ca.gosyer.jui.data.server.requests.downloadsQuery
|
||||||
|
import ca.gosyer.jui.domain.base.WebsocketService
|
||||||
import io.ktor.websocket.Frame
|
import io.ktor.websocket.Frame
|
||||||
import io.ktor.websocket.readText
|
import io.ktor.websocket.readText
|
||||||
import kotlinx.coroutines.flow.MutableStateFlow
|
import kotlinx.coroutines.flow.MutableStateFlow
|
||||||
@@ -4,13 +4,13 @@
|
|||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package ca.gosyer.jui.data.library
|
package ca.gosyer.jui.domain.library
|
||||||
|
|
||||||
import ca.gosyer.jui.data.base.WebsocketService
|
|
||||||
import ca.gosyer.jui.data.library.model.UpdateStatus
|
import ca.gosyer.jui.data.library.model.UpdateStatus
|
||||||
import ca.gosyer.jui.data.server.Http
|
import ca.gosyer.jui.data.server.Http
|
||||||
import ca.gosyer.jui.data.server.ServerPreferences
|
import ca.gosyer.jui.data.server.ServerPreferences
|
||||||
import ca.gosyer.jui.data.server.requests.updatesQuery
|
import ca.gosyer.jui.data.server.requests.updatesQuery
|
||||||
|
import ca.gosyer.jui.domain.base.WebsocketService
|
||||||
import io.ktor.websocket.Frame
|
import io.ktor.websocket.Frame
|
||||||
import io.ktor.websocket.readText
|
import io.ktor.websocket.readText
|
||||||
import kotlinx.coroutines.flow.MutableStateFlow
|
import kotlinx.coroutines.flow.MutableStateFlow
|
||||||
@@ -4,13 +4,14 @@
|
|||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package ca.gosyer.jui.data.migration
|
package ca.gosyer.jui.domain.migration
|
||||||
|
|
||||||
import ca.gosyer.jui.data.build.BuildKonfig
|
import ca.gosyer.jui.data.migration.MigrationPreferences
|
||||||
import ca.gosyer.jui.data.reader.ReaderPreferences
|
import ca.gosyer.jui.data.reader.ReaderPreferences
|
||||||
|
import ca.gosyer.jui.domain.build.BuildKonfig
|
||||||
import me.tatarka.inject.annotations.Inject
|
import me.tatarka.inject.annotations.Inject
|
||||||
|
|
||||||
class Migrations @Inject constructor(
|
class RunMigrations @Inject constructor(
|
||||||
private val migrationPreferences: MigrationPreferences,
|
private val migrationPreferences: MigrationPreferences,
|
||||||
private val readerPreferences: ReaderPreferences
|
private val readerPreferences: ReaderPreferences
|
||||||
) {
|
) {
|
||||||
@@ -4,9 +4,11 @@
|
|||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package ca.gosyer.jui.data.reader
|
package ca.gosyer.jui.domain.reader
|
||||||
|
|
||||||
import ca.gosyer.jui.core.prefs.getAsFlow
|
import ca.gosyer.jui.core.prefs.getAsFlow
|
||||||
|
import ca.gosyer.jui.data.reader.ReaderModePreferences
|
||||||
|
import ca.gosyer.jui.data.reader.ReaderPreferences
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.Job
|
import kotlinx.coroutines.Job
|
||||||
import kotlinx.coroutines.flow.MutableStateFlow
|
import kotlinx.coroutines.flow.MutableStateFlow
|
||||||
@@ -4,12 +4,13 @@
|
|||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package ca.gosyer.jui.data.update
|
package ca.gosyer.jui.domain.update
|
||||||
|
|
||||||
import ca.gosyer.jui.core.lang.IO
|
import ca.gosyer.jui.core.lang.IO
|
||||||
import ca.gosyer.jui.data.build.BuildKonfig
|
|
||||||
import ca.gosyer.jui.data.server.Http
|
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.data.update.model.GithubRelease
|
||||||
|
import ca.gosyer.jui.domain.build.BuildKonfig
|
||||||
import io.ktor.client.call.body
|
import io.ktor.client.call.body
|
||||||
import io.ktor.client.request.get
|
import io.ktor.client.request.get
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
/*
|
||||||
|
* 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
|
||||||
|
|
||||||
|
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 me.tatarka.inject.annotations.Provides
|
||||||
|
|
||||||
|
actual interface DomainComponent : DataComponent {
|
||||||
|
|
||||||
|
val downloadService: DownloadService
|
||||||
|
|
||||||
|
val libraryUpdateService: LibraryUpdateService
|
||||||
|
|
||||||
|
val migrations: RunMigrations
|
||||||
|
|
||||||
|
val updateChecker: UpdateChecker
|
||||||
|
|
||||||
|
val serverService: ServerService
|
||||||
|
|
||||||
|
|
||||||
|
@get:AppScope
|
||||||
|
@get:Provides
|
||||||
|
val serverServiceFactory: ServerService
|
||||||
|
get() = ServerService(serverHostPreferences)
|
||||||
|
|
||||||
|
@get:AppScope
|
||||||
|
@get:Provides
|
||||||
|
val libraryUpdateServiceFactory: LibraryUpdateService
|
||||||
|
get() = LibraryUpdateService(serverPreferences, http)
|
||||||
|
|
||||||
|
@get:AppScope
|
||||||
|
@get:Provides
|
||||||
|
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)
|
||||||
|
}
|
||||||
@@ -4,12 +4,13 @@
|
|||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
* 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.core.io.copyTo
|
import ca.gosyer.jui.core.io.copyTo
|
||||||
import ca.gosyer.jui.core.io.userDataDir
|
import ca.gosyer.jui.core.io.userDataDir
|
||||||
import ca.gosyer.jui.core.lang.withIOContext
|
import ca.gosyer.jui.core.lang.withIOContext
|
||||||
import ca.gosyer.jui.data.build.BuildKonfig
|
import ca.gosyer.jui.data.server.ServerHostPreferences
|
||||||
|
import ca.gosyer.jui.domain.build.BuildKonfig
|
||||||
import kotlinx.coroutines.CoroutineExceptionHandler
|
import kotlinx.coroutines.CoroutineExceptionHandler
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.DelicateCoroutinesApi
|
import kotlinx.coroutines.DelicateCoroutinesApi
|
||||||
@@ -57,6 +57,7 @@ kotlin {
|
|||||||
api(projects.core)
|
api(projects.core)
|
||||||
api(projects.i18n)
|
api(projects.i18n)
|
||||||
api(projects.data)
|
api(projects.data)
|
||||||
|
api(projects.domain)
|
||||||
api(projects.uiCore)
|
api(projects.uiCore)
|
||||||
api(compose.desktop.currentOs)
|
api(compose.desktop.currentOs)
|
||||||
api(compose("org.jetbrains.compose.ui:ui-util"))
|
api(compose("org.jetbrains.compose.ui:ui-util"))
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ package ca.gosyer.jui.ui.downloads
|
|||||||
|
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
import ca.gosyer.jui.data.base.WebsocketService
|
import ca.gosyer.jui.domain.base.WebsocketService
|
||||||
import ca.gosyer.jui.data.download.DownloadService
|
import ca.gosyer.jui.domain.download.DownloadService
|
||||||
import ca.gosyer.jui.uicore.vm.ContextWrapper
|
import ca.gosyer.jui.uicore.vm.ContextWrapper
|
||||||
|
|
||||||
internal actual fun startDownloadService(
|
internal actual fun startDownloadService(
|
||||||
|
|||||||
@@ -6,8 +6,8 @@
|
|||||||
|
|
||||||
package ca.gosyer.jui.ui.downloads
|
package ca.gosyer.jui.ui.downloads
|
||||||
|
|
||||||
import ca.gosyer.jui.data.base.WebsocketService
|
import ca.gosyer.jui.domain.base.WebsocketService
|
||||||
import ca.gosyer.jui.data.download.DownloadService
|
import ca.gosyer.jui.domain.download.DownloadService
|
||||||
import ca.gosyer.jui.uicore.vm.ContextWrapper
|
import ca.gosyer.jui.uicore.vm.ContextWrapper
|
||||||
|
|
||||||
internal expect fun startDownloadService(
|
internal expect fun startDownloadService(
|
||||||
|
|||||||
@@ -6,11 +6,11 @@
|
|||||||
|
|
||||||
package ca.gosyer.jui.ui.downloads
|
package ca.gosyer.jui.ui.downloads
|
||||||
|
|
||||||
import ca.gosyer.jui.data.base.WebsocketService.Actions
|
|
||||||
import ca.gosyer.jui.data.download.DownloadService
|
|
||||||
import ca.gosyer.jui.data.models.Chapter
|
import ca.gosyer.jui.data.models.Chapter
|
||||||
import ca.gosyer.jui.data.server.interactions.ChapterInteractionHandler
|
import ca.gosyer.jui.data.server.interactions.ChapterInteractionHandler
|
||||||
import ca.gosyer.jui.data.server.interactions.DownloadInteractionHandler
|
import ca.gosyer.jui.data.server.interactions.DownloadInteractionHandler
|
||||||
|
import ca.gosyer.jui.domain.base.WebsocketService.Actions
|
||||||
|
import ca.gosyer.jui.domain.download.DownloadService
|
||||||
import ca.gosyer.jui.uicore.vm.ContextWrapper
|
import ca.gosyer.jui.uicore.vm.ContextWrapper
|
||||||
import ca.gosyer.jui.uicore.vm.ViewModel
|
import ca.gosyer.jui.uicore.vm.ViewModel
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ package ca.gosyer.jui.ui.main.about
|
|||||||
import ca.gosyer.jui.data.base.DateHandler
|
import ca.gosyer.jui.data.base.DateHandler
|
||||||
import ca.gosyer.jui.data.models.About
|
import ca.gosyer.jui.data.models.About
|
||||||
import ca.gosyer.jui.data.server.interactions.SettingsInteractionHandler
|
import ca.gosyer.jui.data.server.interactions.SettingsInteractionHandler
|
||||||
import ca.gosyer.jui.data.update.UpdateChecker
|
import ca.gosyer.jui.domain.update.UpdateChecker
|
||||||
import ca.gosyer.jui.data.update.UpdateChecker.Update
|
import ca.gosyer.jui.domain.update.UpdateChecker.Update
|
||||||
import ca.gosyer.jui.uicore.vm.ContextWrapper
|
import ca.gosyer.jui.uicore.vm.ContextWrapper
|
||||||
import ca.gosyer.jui.uicore.vm.ViewModel
|
import ca.gosyer.jui.uicore.vm.ViewModel
|
||||||
import kotlinx.coroutines.flow.MutableSharedFlow
|
import kotlinx.coroutines.flow.MutableSharedFlow
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ import androidx.compose.ui.text.buildAnnotatedString
|
|||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.compose.ui.util.fastForEach
|
import androidx.compose.ui.util.fastForEach
|
||||||
import ca.gosyer.jui.data.models.About
|
import ca.gosyer.jui.data.models.About
|
||||||
import ca.gosyer.jui.data.update.UpdateChecker
|
import ca.gosyer.jui.domain.update.UpdateChecker
|
||||||
import ca.gosyer.jui.i18n.MR
|
import ca.gosyer.jui.i18n.MR
|
||||||
import ca.gosyer.jui.presentation.build.BuildKonfig
|
import ca.gosyer.jui.presentation.build.BuildKonfig
|
||||||
import ca.gosyer.jui.ui.base.navigation.Toolbar
|
import ca.gosyer.jui.ui.base.navigation.Toolbar
|
||||||
|
|||||||
@@ -19,8 +19,8 @@ import androidx.compose.runtime.getValue
|
|||||||
import androidx.compose.runtime.remember
|
import androidx.compose.runtime.remember
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import ca.gosyer.jui.data.base.WebsocketService
|
|
||||||
import ca.gosyer.jui.data.download.model.DownloaderStatus
|
import ca.gosyer.jui.data.download.model.DownloaderStatus
|
||||||
|
import ca.gosyer.jui.domain.base.WebsocketService
|
||||||
import ca.gosyer.jui.i18n.MR
|
import ca.gosyer.jui.i18n.MR
|
||||||
import ca.gosyer.jui.ui.downloads.DownloadsScreenViewModel
|
import ca.gosyer.jui.ui.downloads.DownloadsScreenViewModel
|
||||||
import ca.gosyer.jui.uicore.resources.stringResource
|
import ca.gosyer.jui.uicore.resources.stringResource
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ package ca.gosyer.jui.ui.manga
|
|||||||
|
|
||||||
import ca.gosyer.jui.core.lang.withIOContext
|
import ca.gosyer.jui.core.lang.withIOContext
|
||||||
import ca.gosyer.jui.data.base.DateHandler
|
import ca.gosyer.jui.data.base.DateHandler
|
||||||
import ca.gosyer.jui.data.download.DownloadService
|
|
||||||
import ca.gosyer.jui.data.models.Category
|
import ca.gosyer.jui.data.models.Category
|
||||||
import ca.gosyer.jui.data.models.Chapter
|
import ca.gosyer.jui.data.models.Chapter
|
||||||
import ca.gosyer.jui.data.models.Manga
|
import ca.gosyer.jui.data.models.Manga
|
||||||
@@ -17,6 +16,7 @@ import ca.gosyer.jui.data.server.interactions.ChapterInteractionHandler
|
|||||||
import ca.gosyer.jui.data.server.interactions.LibraryInteractionHandler
|
import ca.gosyer.jui.data.server.interactions.LibraryInteractionHandler
|
||||||
import ca.gosyer.jui.data.server.interactions.MangaInteractionHandler
|
import ca.gosyer.jui.data.server.interactions.MangaInteractionHandler
|
||||||
import ca.gosyer.jui.data.ui.UiPreferences
|
import ca.gosyer.jui.data.ui.UiPreferences
|
||||||
|
import ca.gosyer.jui.domain.download.DownloadService
|
||||||
import ca.gosyer.jui.ui.base.chapter.ChapterDownloadItem
|
import ca.gosyer.jui.ui.base.chapter.ChapterDownloadItem
|
||||||
import ca.gosyer.jui.uicore.vm.ContextWrapper
|
import ca.gosyer.jui.uicore.vm.ContextWrapper
|
||||||
import ca.gosyer.jui.uicore.vm.ViewModel
|
import ca.gosyer.jui.uicore.vm.ViewModel
|
||||||
|
|||||||
@@ -11,11 +11,11 @@ import ca.gosyer.jui.core.prefs.getAsFlow
|
|||||||
import ca.gosyer.jui.data.models.Chapter
|
import ca.gosyer.jui.data.models.Chapter
|
||||||
import ca.gosyer.jui.data.models.Manga
|
import ca.gosyer.jui.data.models.Manga
|
||||||
import ca.gosyer.jui.data.models.MangaMeta
|
import ca.gosyer.jui.data.models.MangaMeta
|
||||||
import ca.gosyer.jui.data.reader.ReaderModeWatch
|
|
||||||
import ca.gosyer.jui.data.reader.ReaderPreferences
|
import ca.gosyer.jui.data.reader.ReaderPreferences
|
||||||
import ca.gosyer.jui.data.reader.model.Direction
|
import ca.gosyer.jui.data.reader.model.Direction
|
||||||
import ca.gosyer.jui.data.server.interactions.ChapterInteractionHandler
|
import ca.gosyer.jui.data.server.interactions.ChapterInteractionHandler
|
||||||
import ca.gosyer.jui.data.server.interactions.MangaInteractionHandler
|
import ca.gosyer.jui.data.server.interactions.MangaInteractionHandler
|
||||||
|
import ca.gosyer.jui.domain.reader.ReaderModeWatch
|
||||||
import ca.gosyer.jui.ui.reader.model.MoveTo
|
import ca.gosyer.jui.ui.reader.model.MoveTo
|
||||||
import ca.gosyer.jui.ui.reader.model.Navigation
|
import ca.gosyer.jui.ui.reader.model.Navigation
|
||||||
import ca.gosyer.jui.ui.reader.model.PageMove
|
import ca.gosyer.jui.ui.reader.model.PageMove
|
||||||
|
|||||||
@@ -10,10 +10,10 @@ import androidx.compose.runtime.mutableStateListOf
|
|||||||
import androidx.compose.runtime.mutableStateMapOf
|
import androidx.compose.runtime.mutableStateMapOf
|
||||||
import androidx.compose.runtime.snapshotFlow
|
import androidx.compose.runtime.snapshotFlow
|
||||||
import androidx.compose.runtime.snapshots.SnapshotStateList
|
import androidx.compose.runtime.snapshots.SnapshotStateList
|
||||||
import ca.gosyer.jui.data.download.DownloadService
|
|
||||||
import ca.gosyer.jui.data.models.Chapter
|
import ca.gosyer.jui.data.models.Chapter
|
||||||
import ca.gosyer.jui.data.server.interactions.ChapterInteractionHandler
|
import ca.gosyer.jui.data.server.interactions.ChapterInteractionHandler
|
||||||
import ca.gosyer.jui.data.server.interactions.UpdatesInteractionHandler
|
import ca.gosyer.jui.data.server.interactions.UpdatesInteractionHandler
|
||||||
|
import ca.gosyer.jui.domain.download.DownloadService
|
||||||
import ca.gosyer.jui.ui.base.chapter.ChapterDownloadItem
|
import ca.gosyer.jui.ui.base.chapter.ChapterDownloadItem
|
||||||
import ca.gosyer.jui.uicore.vm.ContextWrapper
|
import ca.gosyer.jui.uicore.vm.ContextWrapper
|
||||||
import ca.gosyer.jui.uicore.vm.ViewModel
|
import ca.gosyer.jui.uicore.vm.ViewModel
|
||||||
|
|||||||
@@ -6,8 +6,8 @@
|
|||||||
|
|
||||||
package ca.gosyer.jui.ui.downloads
|
package ca.gosyer.jui.ui.downloads
|
||||||
|
|
||||||
import ca.gosyer.jui.data.base.WebsocketService
|
import ca.gosyer.jui.domain.base.WebsocketService
|
||||||
import ca.gosyer.jui.data.download.DownloadService
|
import ca.gosyer.jui.domain.download.DownloadService
|
||||||
import ca.gosyer.jui.uicore.vm.ContextWrapper
|
import ca.gosyer.jui.uicore.vm.ContextWrapper
|
||||||
|
|
||||||
internal actual fun startDownloadService(
|
internal actual fun startDownloadService(
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ include("desktop")
|
|||||||
include("core")
|
include("core")
|
||||||
include("i18n")
|
include("i18n")
|
||||||
include("data")
|
include("data")
|
||||||
|
include("domain")
|
||||||
include("ui-core")
|
include("ui-core")
|
||||||
include("presentation")
|
include("presentation")
|
||||||
include("android")
|
include("android")
|
||||||
|
|||||||
Reference in New Issue
Block a user