Lots of updates

This commit is contained in:
Syer10
2024-09-02 01:04:40 -04:00
parent ff36f712e1
commit 0384c77d1e
85 changed files with 357 additions and 182 deletions

View File

@@ -62,11 +62,11 @@ jobs:
run: | run: |
mkdir -p build mkdir -p build
jq 'del(.metadata)' --sort-keys desktop/build/aboutlibraries.json > build/json1.json jq 'del(.metadata)' --sort-keys desktop/build/aboutlibraries.json > build/json1.json
jq 'del(.metadata)' --sort-keys i18n/src/commonMain/resources/MR/files/aboutlibraries.json > build/json2.json jq 'del(.metadata)' --sort-keys i18n/src/commonMain/moko-resources/files/aboutlibraries.json > build/json2.json
if cmp --silent build/json1.json build/json2.json; then if cmp --silent build/json1.json build/json2.json; then
echo "Libraries didn't change" echo "Libraries didn't change"
else else
mv desktop/build/aboutlibraries.json i18n/src/commonMain/resources/MR/files/aboutlibraries.json -f mv desktop/build/aboutlibraries.json i18n/src/commonMain/moko-resources/files/aboutlibraries.json -f
echo "Moved file" echo "Moved file"
fi fi

1
.gitignore vendored
View File

@@ -8,6 +8,7 @@ build/
tmp/ tmp/
Tachidesk.jar Tachidesk.jar
/wix311 /wix311
.kotlin
# Eclipse # Eclipse
.classpath .classpath

View File

@@ -1,8 +1,8 @@
import Config.migrationCode import Config.migrationCode
@Suppress("DSL_SCOPE_VIOLATION")
plugins { plugins {
id(libs.plugins.kotlin.android.get().pluginId) id(libs.plugins.kotlin.android.get().pluginId)
id(libs.plugins.kotlin.compose.get().pluginId)
id(libs.plugins.android.application.get().pluginId) id(libs.plugins.android.application.get().pluginId)
id(libs.plugins.ksp.get().pluginId) id(libs.plugins.ksp.get().pluginId)
id(libs.plugins.compose.get().pluginId) id(libs.plugins.compose.get().pluginId)
@@ -142,6 +142,6 @@ android {
kotlin { kotlin {
jvmToolchain { jvmToolchain {
languageVersion.set(JavaLanguageVersion.of(Config.androidJvmTarget.majorVersion)) languageVersion.set(JavaLanguageVersion.of(Config.androidJvmTarget.target))
} }
} }

View File

@@ -2,17 +2,15 @@ import Config.migrationCode
import Config.serverCode import Config.serverCode
import Config.tachideskVersion import Config.tachideskVersion
import com.codingfeline.buildkonfig.compiler.FieldSpec.Type import com.codingfeline.buildkonfig.compiler.FieldSpec.Type
import de.jensklingenberg.ktorfit.gradle.ErrorCheckingMode
import org.jetbrains.compose.ComposeExtension import org.jetbrains.compose.ComposeExtension
import org.jetbrains.compose.ComposePlugin import org.jetbrains.compose.ComposePlugin
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile
@Suppress("DSL_SCOPE_VIOLATION")
plugins { plugins {
alias(libs.plugins.kotlin.multiplatform) apply false
alias(libs.plugins.kotlin.serialization) apply false alias(libs.plugins.kotlin.serialization) apply false
alias(libs.plugins.android.library) apply false alias(libs.plugins.kotlin.compose) apply false
alias(libs.plugins.android.application) apply false
alias(libs.plugins.compose) apply false alias(libs.plugins.compose) apply false
alias(libs.plugins.ksp) apply false alias(libs.plugins.ksp) apply false
alias(libs.plugins.buildconfig) apply false alias(libs.plugins.buildconfig) apply false
@@ -47,14 +45,14 @@ tasks.withType<com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask
subprojects { subprojects {
tasks.withType<KotlinJvmCompile> { tasks.withType<KotlinJvmCompile> {
kotlinOptions { compilerOptions {
if (name.contains("android", true)) { if (name.contains("android", true)) {
jvmTarget = Config.androidJvmTarget.toString() jvmTarget = Config.androidJvmTarget
} }
freeCompilerArgs += listOf("-Xexpect-actual-classes") freeCompilerArgs.add("-Xexpect-actual-classes")
if (project.hasProperty("generateComposeCompilerMetrics")) { if (project.hasProperty("generateComposeCompilerMetrics")) {
freeCompilerArgs = freeCompilerArgs + listOf( freeCompilerArgs.addAll(
"-P", "-P",
"plugin:androidx.compose.compiler.plugins.kotlin:reportsDestination=" + "plugin:androidx.compose.compiler.plugins.kotlin:reportsDestination=" +
project.layout.buildDirectory.dir("compose_metrics").get().asFile.absolutePath, project.layout.buildDirectory.dir("compose_metrics").get().asFile.absolutePath,
@@ -87,8 +85,8 @@ subprojects {
} }
compileOptions { compileOptions {
isCoreLibraryDesugaringEnabled = true isCoreLibraryDesugaringEnabled = true
sourceCompatibility(Config.androidJvmTarget) sourceCompatibility(Config.androidJvmTarget.target)
targetCompatibility(Config.androidJvmTarget) targetCompatibility(Config.androidJvmTarget.target)
} }
dependencies { dependencies {
add("coreLibraryDesugaring", libs.desugarJdkLibs) add("coreLibraryDesugaring", libs.desugarJdkLibs)
@@ -131,7 +129,7 @@ subprojects {
plugins.withType<de.jensklingenberg.ktorfit.gradle.KtorfitGradlePlugin> { plugins.withType<de.jensklingenberg.ktorfit.gradle.KtorfitGradlePlugin> {
configure<de.jensklingenberg.ktorfit.gradle.KtorfitGradleConfiguration> { configure<de.jensklingenberg.ktorfit.gradle.KtorfitGradleConfiguration> {
logging = project.hasProperty("debugApp") errorCheckingMode = ErrorCheckingMode.WARNING
} }
} }

View File

@@ -5,6 +5,7 @@ plugins {
repositories { repositories {
mavenCentral() mavenCentral()
google()
maven("https://plugins.gradle.org/m2/") maven("https://plugins.gradle.org/m2/")
} }
@@ -13,4 +14,6 @@ dependencies {
implementation(gradleApi()) implementation(gradleApi())
implementation(localGroovy()) implementation(localGroovy())
implementation(libs.gradle.download.task) implementation(libs.gradle.download.task)
implementation(libs.gradle.kotlin)
implementation(libs.gradle.android)
} }

View File

@@ -1,4 +1,4 @@
import org.gradle.api.JavaVersion import org.jetbrains.kotlin.gradle.dsl.JvmTarget
object Config { object Config {
const val migrationCode = 5 const val migrationCode = 5
@@ -10,6 +10,6 @@ object Config {
const val preview = false const val preview = false
const val previewCommit = "54df9d634a1e83143a6cacf6206b6504721b6ca8" const val previewCommit = "54df9d634a1e83143a6cacf6206b6504721b6ca8"
val desktopJvmTarget = JavaVersion.VERSION_17 val desktopJvmTarget = JvmTarget.JVM_17
val androidJvmTarget = JavaVersion.VERSION_11 val androidJvmTarget = JvmTarget.JVM_17
} }

View File

@@ -8,13 +8,13 @@ fun TaskContainerScope.registerLocalizationTask(project: Project) {
with(project) { with(project) {
register("generateLocales") { register("generateLocales") {
doFirst { doFirst {
val langs = listOf("en") + file("src/commonMain/resources/MR/values").listFiles()?.map { it.name } val langs = listOf("en") + file("src/commonMain/moko-resources/values").listFiles()?.map { it.name }
?.minus("base") ?.minus("base")
?.map { it.replace("-r", "-") } ?.map { it.replace("-r", "-") }
?.sorted() ?.sorted()
.orEmpty() .orEmpty()
val langFile = file("src/commonMain/resources/MR/files/languages.json") val langFile = file("src/commonMain/moko-resources/files/languages.json")
if (langFile.exists()) { if (langFile.exists()) {
val currentLangs = langFile.reader().use { val currentLangs = langFile.reader().use {
Gson().fromJson(it, JsonObject::class.java) Gson().fromJson(it, JsonObject::class.java)

View File

@@ -1,6 +1,5 @@
import org.jetbrains.compose.compose import org.jetbrains.compose.compose
@Suppress("DSL_SCOPE_VIOLATION")
plugins { plugins {
id(libs.plugins.kotlin.multiplatform.get().pluginId) id(libs.plugins.kotlin.multiplatform.get().pluginId)
id(libs.plugins.android.library.get().pluginId) id(libs.plugins.android.library.get().pluginId)
@@ -13,14 +12,22 @@ kotlin {
androidTarget { androidTarget {
compilations { compilations {
all { all {
kotlinOptions.jvmTarget = Config.androidJvmTarget.toString() compileTaskProvider.configure {
compilerOptions {
jvmTarget = Config.androidJvmTarget
}
}
} }
} }
} }
jvm("desktop") { jvm("desktop") {
compilations { compilations {
all { all {
kotlinOptions.jvmTarget = Config.desktopJvmTarget.toString() compileTaskProvider.configure {
compilerOptions {
jvmTarget = Config.desktopJvmTarget
}
}
} }
} }
} }
@@ -54,7 +61,6 @@ kotlin {
} }
val commonMain by getting { val commonMain by getting {
dependencies { dependencies {
api(kotlin("stdlib-common"))
api(libs.coroutines.core) api(libs.coroutines.core)
api(libs.serialization.json.core) api(libs.serialization.json.core)
api(libs.serialization.json.okio) api(libs.serialization.json.okio)
@@ -81,7 +87,6 @@ kotlin {
val jvmMain by getting { val jvmMain by getting {
dependencies { dependencies {
api(kotlin("stdlib-jdk8"))
} }
} }
val jvmTest by getting { val jvmTest by getting {

View File

@@ -1,4 +1,3 @@
@Suppress("DSL_SCOPE_VIOLATION")
plugins { plugins {
id(libs.plugins.kotlin.multiplatform.get().pluginId) id(libs.plugins.kotlin.multiplatform.get().pluginId)
id(libs.plugins.kotlin.serialization.get().pluginId) id(libs.plugins.kotlin.serialization.get().pluginId)
@@ -6,7 +5,6 @@ plugins {
id(libs.plugins.ksp.get().pluginId) id(libs.plugins.ksp.get().pluginId)
id(libs.plugins.buildkonfig.get().pluginId) id(libs.plugins.buildkonfig.get().pluginId)
id(libs.plugins.kotlinter.get().pluginId) id(libs.plugins.kotlinter.get().pluginId)
id(libs.plugins.ktorfit.get().pluginId)
id(libs.plugins.apollo.get().pluginId) id(libs.plugins.apollo.get().pluginId)
} }
@@ -14,14 +12,22 @@ kotlin {
androidTarget { androidTarget {
compilations { compilations {
all { all {
kotlinOptions.jvmTarget = Config.androidJvmTarget.toString() compileTaskProvider.configure {
compilerOptions {
jvmTarget = Config.androidJvmTarget
}
}
} }
} }
} }
jvm("desktop") { jvm("desktop") {
compilations { compilations {
all { all {
kotlinOptions.jvmTarget = Config.desktopJvmTarget.toString() compileTaskProvider.configure {
compilerOptions {
jvmTarget = Config.desktopJvmTarget
}
}
} }
} }
} }
@@ -53,7 +59,6 @@ kotlin {
} }
val commonMain by getting { val commonMain by getting {
dependencies { dependencies {
api(kotlin("stdlib-common"))
api(libs.coroutines.core) api(libs.coroutines.core)
api(libs.serialization.json.core) api(libs.serialization.json.core)
api(libs.serialization.json.okio) api(libs.serialization.json.okio)
@@ -62,8 +67,9 @@ kotlin {
api(libs.ktor.websockets) api(libs.ktor.websockets)
api(libs.okio) api(libs.okio)
api(libs.dateTime) api(libs.dateTime)
api(libs.apollo.runtime) implementation(libs.apollo.runtime)
api(libs.apollo.engine.ktor) implementation(libs.apollo.engine.ktor)
implementation(libs.ktorfit.lib)
api(projects.core) api(projects.core)
api(projects.i18n) api(projects.i18n)
api(projects.domain) api(projects.domain)
@@ -78,7 +84,6 @@ kotlin {
val jvmMain by getting { val jvmMain by getting {
dependencies { dependencies {
api(kotlin("stdlib-jdk8"))
} }
} }
val jvmTest by getting { val jvmTest by getting {
@@ -110,7 +115,8 @@ dependencies {
"kspAndroid", "kspAndroid",
"kspIosArm64", "kspIosArm64",
"kspIosSimulatorArm64", "kspIosSimulatorArm64",
"kspIosX64" "kspIosX64",
"kspCommonMainMetadata"
).forEach { ).forEach {
add(it, libs.kotlinInject.compiler) add(it, libs.kotlinInject.compiler)
} }

View File

@@ -0,0 +1,51 @@
package ca.gosyer.jui.data
import ca.gosyer.jui.domain.backup.service.createBackupRepositoryOld
import ca.gosyer.jui.domain.category.service.createCategoryRepositoryOld
import ca.gosyer.jui.domain.chapter.service.createChapterRepositoryOld
import ca.gosyer.jui.domain.download.service.createDownloadRepositoryOld
import ca.gosyer.jui.domain.extension.service.createExtensionRepositoryOld
import ca.gosyer.jui.domain.global.service.createGlobalRepositoryOld
import ca.gosyer.jui.domain.library.service.createLibraryRepositoryOld
import ca.gosyer.jui.domain.manga.service.createMangaRepositoryOld
import ca.gosyer.jui.domain.settings.service.createSettingsRepositoryOld
import ca.gosyer.jui.domain.source.service.createSourceRepositoryOld
import ca.gosyer.jui.domain.updates.service.createUpdatesRepositoryOld
import de.jensklingenberg.ktorfit.Ktorfit
import me.tatarka.inject.annotations.Provides
actual interface SharedDataComponent {
@Provides
fun backupRepositoryOld(ktorfit: Ktorfit) = ktorfit.createBackupRepositoryOld()
@Provides
fun categoryRepositoryOld(ktorfit: Ktorfit) = ktorfit.createCategoryRepositoryOld()
@Provides
fun chapterRepositoryOld(ktorfit: Ktorfit) = ktorfit.createChapterRepositoryOld()
@Provides
fun downloadRepositoryOld(ktorfit: Ktorfit) = ktorfit.createDownloadRepositoryOld()
@Provides
fun extensionRepositoryOld(ktorfit: Ktorfit) = ktorfit.createExtensionRepositoryOld()
@Provides
fun globalRepositoryOld(ktorfit: Ktorfit) = ktorfit.createGlobalRepositoryOld()
@Provides
fun libraryRepositoryOld(ktorfit: Ktorfit) = ktorfit.createLibraryRepositoryOld()
@Provides
fun mangaRepositoryOld(ktorfit: Ktorfit) = ktorfit.createMangaRepositoryOld()
@Provides
fun settingsRepositoryOld(ktorfit: Ktorfit) = ktorfit.createSettingsRepositoryOld()
@Provides
fun sourceRepositoryOld(ktorfit: Ktorfit) = ktorfit.createSourceRepositoryOld()
@Provides
fun updatesRepositoryOld(ktorfit: Ktorfit) = ktorfit.createUpdatesRepositoryOld()
}

View File

@@ -8,24 +8,12 @@ package ca.gosyer.jui.data
import ca.gosyer.jui.core.lang.addSuffix import ca.gosyer.jui.core.lang.addSuffix
import ca.gosyer.jui.data.settings.SettingsRepositoryImpl import ca.gosyer.jui.data.settings.SettingsRepositoryImpl
import ca.gosyer.jui.domain.backup.service.BackupRepositoryOld
import ca.gosyer.jui.domain.category.service.CategoryRepositoryOld
import ca.gosyer.jui.domain.chapter.service.ChapterRepositoryOld
import ca.gosyer.jui.domain.download.service.DownloadRepositoryOld
import ca.gosyer.jui.domain.extension.service.ExtensionRepositoryOld
import ca.gosyer.jui.domain.global.service.GlobalRepositoryOld
import ca.gosyer.jui.domain.library.service.LibraryRepositoryOld
import ca.gosyer.jui.domain.manga.service.MangaRepositoryOld
import ca.gosyer.jui.domain.server.Http import ca.gosyer.jui.domain.server.Http
import ca.gosyer.jui.domain.server.service.ServerPreferences import ca.gosyer.jui.domain.server.service.ServerPreferences
import ca.gosyer.jui.domain.settings.service.SettingsRepository import ca.gosyer.jui.domain.settings.service.SettingsRepository
import ca.gosyer.jui.domain.settings.service.SettingsRepositoryOld import com.apollographql.apollo.ApolloClient
import ca.gosyer.jui.domain.source.service.SourceRepositoryOld import com.apollographql.apollo.network.ws.GraphQLWsProtocol
import ca.gosyer.jui.domain.updates.service.UpdatesRepositoryOld import com.apollographql.ktor.ktorClient
import com.apollographql.apollo3.ApolloClient
import com.apollographql.apollo3.annotations.ApolloExperimental
import com.apollographql.apollo3.network.ktorClient
import com.apollographql.apollo3.network.ws.GraphQLWsProtocol
import de.jensklingenberg.ktorfit.Ktorfit import de.jensklingenberg.ktorfit.Ktorfit
import io.ktor.http.URLBuilder import io.ktor.http.URLBuilder
import io.ktor.http.appendPathSegments import io.ktor.http.appendPathSegments
@@ -33,7 +21,7 @@ import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.IO import kotlinx.coroutines.IO
import me.tatarka.inject.annotations.Provides import me.tatarka.inject.annotations.Provides
interface DataComponent { interface DataComponent : SharedDataComponent {
@Provides @Provides
fun ktorfit( fun ktorfit(
http: Http, http: Http,
@@ -45,7 +33,6 @@ interface DataComponent {
.baseUrl(serverPreferences.serverUrl().get().toString().addSuffix('/')) .baseUrl(serverPreferences.serverUrl().get().toString().addSuffix('/'))
.build() .build()
@OptIn(ApolloExperimental::class)
@Provides @Provides
fun apolloClient( fun apolloClient(
http: Http, http: Http,
@@ -61,39 +48,6 @@ interface DataComponent {
.dispatcher(Dispatchers.IO) .dispatcher(Dispatchers.IO)
.build() .build()
@Provides
fun backupRepositoryOld(ktorfit: Ktorfit) = ktorfit.create<BackupRepositoryOld>()
@Provides
fun categoryRepositoryOld(ktorfit: Ktorfit) = ktorfit.create<CategoryRepositoryOld>()
@Provides
fun chapterRepositoryOld(ktorfit: Ktorfit) = ktorfit.create<ChapterRepositoryOld>()
@Provides
fun downloadRepositoryOld(ktorfit: Ktorfit) = ktorfit.create<DownloadRepositoryOld>()
@Provides
fun extensionRepositoryOld(ktorfit: Ktorfit) = ktorfit.create<ExtensionRepositoryOld>()
@Provides
fun globalRepositoryOld(ktorfit: Ktorfit) = ktorfit.create<GlobalRepositoryOld>()
@Provides
fun libraryRepositoryOld(ktorfit: Ktorfit) = ktorfit.create<LibraryRepositoryOld>()
@Provides
fun mangaRepositoryOld(ktorfit: Ktorfit) = ktorfit.create<MangaRepositoryOld>()
@Provides
fun settingsRepositoryOld(ktorfit: Ktorfit) = ktorfit.create<SettingsRepositoryOld>()
@Provides
fun sourceRepositoryOld(ktorfit: Ktorfit) = ktorfit.create<SourceRepositoryOld>()
@Provides
fun updatesRepositoryOld(ktorfit: Ktorfit) = ktorfit.create<UpdatesRepositoryOld>()
@Provides @Provides
fun settingsRepository(apolloClient: ApolloClient): SettingsRepository = SettingsRepositoryImpl(apolloClient) fun settingsRepository(apolloClient: ApolloClient): SettingsRepository = SettingsRepositoryImpl(apolloClient)
} }

View File

@@ -8,7 +8,8 @@ package ca.gosyer.jui.data
import de.jensklingenberg.ktorfit.Ktorfit import de.jensklingenberg.ktorfit.Ktorfit
import de.jensklingenberg.ktorfit.converter.Converter import de.jensklingenberg.ktorfit.converter.Converter
import de.jensklingenberg.ktorfit.internal.TypeData import de.jensklingenberg.ktorfit.converter.KtorfitResult
import de.jensklingenberg.ktorfit.converter.TypeData
import io.ktor.client.call.body import io.ktor.client.call.body
import io.ktor.client.statement.HttpResponse import io.ktor.client.statement.HttpResponse
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
@@ -29,7 +30,7 @@ class FlowConverterFactory : Converter.Factory {
val convertedBody = ktorfit.nextSuspendResponseConverter( val convertedBody = ktorfit.nextSuspendResponseConverter(
null, null,
typeData.typeArgs.first(), typeData.typeArgs.first(),
)?.convert(response) )?.convert(KtorfitResult.Success(response))
?: response.body(typeData.typeArgs.first().typeInfo) ?: response.body(typeData.typeArgs.first().typeInfo)
emit(convertedBody) emit(convertedBody)
}.flowOn(Dispatchers.IO) }.flowOn(Dispatchers.IO)

View File

@@ -0,0 +1,4 @@
package ca.gosyer.jui.data
expect interface SharedDataComponent

View File

@@ -6,10 +6,10 @@
package ca.gosyer.jui.data.scalars package ca.gosyer.jui.data.scalars
import com.apollographql.apollo3.api.Adapter import com.apollographql.apollo.api.Adapter
import com.apollographql.apollo3.api.CustomScalarAdapters import com.apollographql.apollo.api.CustomScalarAdapters
import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo.api.json.JsonReader
import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo.api.json.JsonWriter
object LongStringScalar : Adapter<Long> { object LongStringScalar : Adapter<Long> {
override fun fromJson( override fun fromJson(

View File

@@ -16,7 +16,7 @@ import ca.gosyer.jui.data.util.toOptional
import ca.gosyer.jui.domain.settings.model.SetSettingsInput import ca.gosyer.jui.domain.settings.model.SetSettingsInput
import ca.gosyer.jui.domain.settings.model.Settings import ca.gosyer.jui.domain.settings.model.Settings
import ca.gosyer.jui.domain.settings.service.SettingsRepository import ca.gosyer.jui.domain.settings.service.SettingsRepository
import com.apollographql.apollo3.ApolloClient import com.apollographql.apollo.ApolloClient
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.IO import kotlinx.coroutines.IO
import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.Flow

View File

@@ -6,6 +6,6 @@
package ca.gosyer.jui.data.util package ca.gosyer.jui.data.util
import com.apollographql.apollo3.api.Optional import com.apollographql.apollo.api.Optional
internal fun <T> T?.toOptional() = Optional.presentIfNotNull(this) internal fun <T> T?.toOptional() = Optional.presentIfNotNull(this)

View File

@@ -0,0 +1,51 @@
package ca.gosyer.jui.data
import ca.gosyer.jui.domain.backup.service.createBackupRepositoryOld
import ca.gosyer.jui.domain.category.service.createCategoryRepositoryOld
import ca.gosyer.jui.domain.chapter.service.createChapterRepositoryOld
import ca.gosyer.jui.domain.download.service.createDownloadRepositoryOld
import ca.gosyer.jui.domain.extension.service.createExtensionRepositoryOld
import ca.gosyer.jui.domain.global.service.createGlobalRepositoryOld
import ca.gosyer.jui.domain.library.service.createLibraryRepositoryOld
import ca.gosyer.jui.domain.manga.service.createMangaRepositoryOld
import ca.gosyer.jui.domain.settings.service.createSettingsRepositoryOld
import ca.gosyer.jui.domain.source.service.createSourceRepositoryOld
import ca.gosyer.jui.domain.updates.service.createUpdatesRepositoryOld
import de.jensklingenberg.ktorfit.Ktorfit
import me.tatarka.inject.annotations.Provides
actual interface SharedDataComponent {
@Provides
fun backupRepositoryOld(ktorfit: Ktorfit) = ktorfit.createBackupRepositoryOld()
@Provides
fun categoryRepositoryOld(ktorfit: Ktorfit) = ktorfit.createCategoryRepositoryOld()
@Provides
fun chapterRepositoryOld(ktorfit: Ktorfit) = ktorfit.createChapterRepositoryOld()
@Provides
fun downloadRepositoryOld(ktorfit: Ktorfit) = ktorfit.createDownloadRepositoryOld()
@Provides
fun extensionRepositoryOld(ktorfit: Ktorfit) = ktorfit.createExtensionRepositoryOld()
@Provides
fun globalRepositoryOld(ktorfit: Ktorfit) = ktorfit.createGlobalRepositoryOld()
@Provides
fun libraryRepositoryOld(ktorfit: Ktorfit) = ktorfit.createLibraryRepositoryOld()
@Provides
fun mangaRepositoryOld(ktorfit: Ktorfit) = ktorfit.createMangaRepositoryOld()
@Provides
fun settingsRepositoryOld(ktorfit: Ktorfit) = ktorfit.createSettingsRepositoryOld()
@Provides
fun sourceRepositoryOld(ktorfit: Ktorfit) = ktorfit.createSourceRepositoryOld()
@Provides
fun updatesRepositoryOld(ktorfit: Ktorfit) = ktorfit.createUpdatesRepositoryOld()
}

View File

@@ -0,0 +1,51 @@
package ca.gosyer.jui.data
import ca.gosyer.jui.domain.backup.service.createBackupRepositoryOld
import ca.gosyer.jui.domain.category.service.createCategoryRepositoryOld
import ca.gosyer.jui.domain.chapter.service.createChapterRepositoryOld
import ca.gosyer.jui.domain.download.service.createDownloadRepositoryOld
import ca.gosyer.jui.domain.extension.service.createExtensionRepositoryOld
import ca.gosyer.jui.domain.global.service.createGlobalRepositoryOld
import ca.gosyer.jui.domain.library.service.createLibraryRepositoryOld
import ca.gosyer.jui.domain.manga.service.createMangaRepositoryOld
import ca.gosyer.jui.domain.settings.service.createSettingsRepositoryOld
import ca.gosyer.jui.domain.source.service.createSourceRepositoryOld
import ca.gosyer.jui.domain.updates.service.createUpdatesRepositoryOld
import de.jensklingenberg.ktorfit.Ktorfit
import me.tatarka.inject.annotations.Provides
actual interface SharedDataComponent {
@Provides
fun backupRepositoryOld(ktorfit: Ktorfit) = ktorfit.createBackupRepositoryOld()
@Provides
fun categoryRepositoryOld(ktorfit: Ktorfit) = ktorfit.createCategoryRepositoryOld()
@Provides
fun chapterRepositoryOld(ktorfit: Ktorfit) = ktorfit.createChapterRepositoryOld()
@Provides
fun downloadRepositoryOld(ktorfit: Ktorfit) = ktorfit.createDownloadRepositoryOld()
@Provides
fun extensionRepositoryOld(ktorfit: Ktorfit) = ktorfit.createExtensionRepositoryOld()
@Provides
fun globalRepositoryOld(ktorfit: Ktorfit) = ktorfit.createGlobalRepositoryOld()
@Provides
fun libraryRepositoryOld(ktorfit: Ktorfit) = ktorfit.createLibraryRepositoryOld()
@Provides
fun mangaRepositoryOld(ktorfit: Ktorfit) = ktorfit.createMangaRepositoryOld()
@Provides
fun settingsRepositoryOld(ktorfit: Ktorfit) = ktorfit.createSettingsRepositoryOld()
@Provides
fun sourceRepositoryOld(ktorfit: Ktorfit) = ktorfit.createSourceRepositoryOld()
@Provides
fun updatesRepositoryOld(ktorfit: Ktorfit) = ktorfit.createUpdatesRepositoryOld()
}

View File

@@ -6,9 +6,9 @@ import org.jetbrains.compose.compose
import org.jetbrains.compose.desktop.application.dsl.TargetFormat import org.jetbrains.compose.desktop.application.dsl.TargetFormat
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
@Suppress("DSL_SCOPE_VIOLATION")
plugins { plugins {
id(libs.plugins.kotlin.jvm.get().pluginId) id(libs.plugins.kotlin.jvm.get().pluginId)
id(libs.plugins.kotlin.compose.get().pluginId)
id(libs.plugins.ksp.get().pluginId) id(libs.plugins.ksp.get().pluginId)
id(libs.plugins.compose.get().pluginId) id(libs.plugins.compose.get().pluginId)
id(libs.plugins.buildconfig.get().pluginId) id(libs.plugins.buildconfig.get().pluginId)
@@ -106,15 +106,15 @@ dependencies {
} }
java { java {
sourceCompatibility = Config.desktopJvmTarget sourceCompatibility = JavaVersion.toVersion(Config.desktopJvmTarget.target)
targetCompatibility = Config.desktopJvmTarget targetCompatibility = JavaVersion.toVersion(Config.desktopJvmTarget.target)
} }
tasks { tasks {
withType<KotlinCompile> { withType<KotlinCompile> {
kotlinOptions { compilerOptions {
jvmTarget = Config.desktopJvmTarget.toString() jvmTarget = Config.desktopJvmTarget
freeCompilerArgs = listOf( freeCompilerArgs.add(
"-opt-in=androidx.compose.ui.ExperimentalComposeUiApi" "-opt-in=androidx.compose.ui.ExperimentalComposeUiApi"
) )
} }

View File

@@ -1,6 +1,5 @@
import org.jetbrains.compose.compose import org.jetbrains.compose.compose
@Suppress("DSL_SCOPE_VIOLATION")
plugins { plugins {
id(libs.plugins.kotlin.multiplatform.get().pluginId) id(libs.plugins.kotlin.multiplatform.get().pluginId)
id(libs.plugins.kotlin.serialization.get().pluginId) id(libs.plugins.kotlin.serialization.get().pluginId)
@@ -8,20 +7,29 @@ plugins {
id(libs.plugins.ksp.get().pluginId) id(libs.plugins.ksp.get().pluginId)
id(libs.plugins.buildkonfig.get().pluginId) id(libs.plugins.buildkonfig.get().pluginId)
id(libs.plugins.kotlinter.get().pluginId) id(libs.plugins.kotlinter.get().pluginId)
id(libs.plugins.ktorfit.get().pluginId)
} }
kotlin { kotlin {
androidTarget { androidTarget {
compilations { compilations {
all { all {
kotlinOptions.jvmTarget = Config.androidJvmTarget.toString() compileTaskProvider.configure {
compilerOptions {
jvmTarget = Config.androidJvmTarget
}
}
} }
} }
} }
jvm("desktop") { jvm("desktop") {
compilations { compilations {
all { all {
kotlinOptions.jvmTarget = Config.desktopJvmTarget.toString() compileTaskProvider.configure {
compilerOptions {
jvmTarget = Config.desktopJvmTarget
}
}
} }
} }
} }
@@ -54,8 +62,6 @@ kotlin {
} }
val commonMain by getting { val commonMain by getting {
dependencies { dependencies {
api(kotlin("stdlib-common"))
api(kotlin("stdlib-common"))
api(libs.coroutines.core) api(libs.coroutines.core)
api(libs.serialization.json.core) api(libs.serialization.json.core)
api(libs.serialization.json.okio) api(libs.serialization.json.okio)
@@ -83,7 +89,6 @@ kotlin {
val jvmMain by getting { val jvmMain by getting {
dependencies { dependencies {
api(kotlin("stdlib-jdk8"))
api(libs.ktor.okHttp) api(libs.ktor.okHttp)
} }
} }
@@ -123,7 +128,6 @@ dependencies {
"kspIosX64" "kspIosX64"
).forEach { ).forEach {
add(it, libs.kotlinInject.compiler) add(it, libs.kotlinInject.compiler)
add(it, libs.ktorfit.ksp)
} }
} }

View File

@@ -29,14 +29,16 @@ import me.tatarka.inject.annotations.Assisted
import me.tatarka.inject.annotations.Inject import me.tatarka.inject.annotations.Inject
import org.lighthousegames.logging.logging import org.lighthousegames.logging.logging
typealias GetMangaPage = @param:Assisted suspend (page: Int) -> MangaPage? fun interface GetMangaPage {
suspend fun get(page: Int): MangaPage?
}
class SourcePager class SourcePager
@Inject @Inject
constructor( constructor(
private val getManga: GetManga, private val getManga: GetManga,
private val serverListeners: ServerListeners, private val serverListeners: ServerListeners,
private val fetcher: GetMangaPage, @Assisted private val fetcher: GetMangaPage,
) : CoroutineScope by CoroutineScope(Dispatchers.Default + SupervisorJob()) { ) : CoroutineScope by CoroutineScope(Dispatchers.Default + SupervisorJob()) {
private val sourceMutex = Mutex() private val sourceMutex = Mutex()
@@ -72,7 +74,7 @@ class SourcePager
launch { launch {
if (hasNextPage.value && sourceMutex.tryLock()) { if (hasNextPage.value && sourceMutex.tryLock()) {
_pageNum.value++ _pageNum.value++
val page = fetcher(_pageNum.value) val page = fetcher.get(_pageNum.value)
if (page != null) { if (page != null) {
_sourceManga.value = _sourceManga.value + page.mangaList _sourceManga.value = _sourceManga.value + page.mangaList
_hasNextPage.value = page.hasNextPage _hasNextPage.value = page.hasNextPage

View File

@@ -6,3 +6,4 @@ kotlin.mpp.stability.nowarn=true
kotlin.native.ignoreDisabledTargets=true kotlin.native.ignoreDisabledTargets=true
org.jetbrains.compose.experimental.uikit.enabled=true org.jetbrains.compose.experimental.uikit.enabled=true
kotlin.mpp.androidSourceSetLayoutVersion=2 kotlin.mpp.androidSourceSetLayoutVersion=2
moko.resources.disableStaticFrameworkWarning=true

View File

@@ -1,47 +1,49 @@
[versions] [versions]
# Kotlin # Kotlin
kotlin = "1.9.23" kotlin = "2.0.20"
coroutines = "1.8.1" coroutines = "1.8.1"
# Serialization # Serialization
json = "1.6.3" json = "1.7.1"
# Compose # Compose
composeGradle = "1.6.1" composeGradle = "1.6.11"
# Compose Libraries # Compose Libraries
voyager = "1.0.0" voyager = "1.0.0"
accompanist = "0.30.1" accompanist = "0.30.1"
googleAccompanist = "0.30.1" googleAccompanist = "0.30.1"
imageloader = "1.7.8" imageloader = "1.8.1"
materialDialogs = "0.9.5" materialDialogs = "0.9.5"
# Android # Android
androidGradle = "8.3.1" androidGradle = "8.5.2"
core = "1.12.0" core = "1.13.1"
appCompat = "1.7.0" appCompat = "1.7.0"
activityCompose = "1.8.2" activityCompose = "1.9.1"
work = "2.9.1" work = "2.9.1"
# Android Lifecycle # Android Lifecycle
lifecycle = "2.7.0" lifecycle = "2.8.4"
# Swing # Swing
darklaf = "3.0.2" darklaf = "3.0.2"
# Ksp # Ksp
ksp = "1.9.23-1.0.19" ksp = "2.0.20-1.0.24"
# Dependency Injection # Dependency Injection
kotlinInject = "0.6.3" kotlinInject = "0.7.1"
# Network # Network
ktor = "2.3.9" ktor = "2.3.12"
ktorfit = "1.12.0" ktorfit = "2.0.1"
apollo = "4.0.0-beta.5" ktorfitKsp = "2.0.1-1.0.24"
apollo = "4.0.0"
apolloKtor = "0.0.2"
# Logging # Logging
slf4j = "2.0.12" slf4j = "2.0.16"
log4j = "2.23.1" log4j = "2.23.1"
kmlogging = "1.4.2" kmlogging = "1.4.2"
@@ -54,14 +56,14 @@ multiplatformSettings = "1.1.1"
# Utility # Utility
desugarJdkLibs = "2.0.4" desugarJdkLibs = "2.0.4"
aboutLibraries = "11.1.1" aboutLibraries = "11.2.2"
dateTime = "0.6.0-RC.2" dateTime = "0.6.1"
immutableCollections = "0.3.7" immutableCollections = "0.3.7"
korge = "5.4.0" korge = "5.4.0"
gradleDownloadTask = "5.4.0" gradleDownloadTask = "5.6.0"
# Localization # Localization
moko = "0.23.0" moko = "0.24.2"
# BuildConfigs # BuildConfigs
buildconfig = "5.3.5" buildconfig = "5.3.5"
@@ -129,9 +131,9 @@ ktor-logging = { module = "io.ktor:ktor-client-logging", version.ref = "ktor" }
ktor-websockets = { module = "io.ktor:ktor-client-websockets", version.ref = "ktor" } ktor-websockets = { module = "io.ktor:ktor-client-websockets", version.ref = "ktor" }
ktor-auth = { module = "io.ktor:ktor-client-auth", version.ref = "ktor" } ktor-auth = { module = "io.ktor:ktor-client-auth", version.ref = "ktor" }
ktorfit-lib = { module = "de.jensklingenberg.ktorfit:ktorfit-lib-light", version.ref = "ktorfit" } ktorfit-lib = { module = "de.jensklingenberg.ktorfit:ktorfit-lib-light", version.ref = "ktorfit" }
ktorfit-ksp = { module = "de.jensklingenberg.ktorfit:ktorfit-ksp", version.ref = "ktorfit" } ktorfit-ksp = { module = "de.jensklingenberg.ktorfit:ktorfit-ksp", version.ref = "ktorfitKsp" }
apollo-runtime = { module = "com.apollographql.apollo3:apollo-runtime", version.ref = "apollo" } apollo-runtime = { module = "com.apollographql.apollo:apollo-runtime", version.ref = "apollo" }
apollo-engine-ktor = { module = "com.apollographql.apollo3:apollo-engine-ktor", version.ref = "apollo" } apollo-engine-ktor = { module = "com.apollographql.ktor:apollo-engine-ktor", version.ref = "apolloKtor" }
# Logging # Logging
logging-slf4j-api = { module = "org.slf4j:slf4j-api", version.ref = "slf4j" } logging-slf4j-api = { module = "org.slf4j:slf4j-api", version.ref = "slf4j" }
@@ -166,6 +168,8 @@ moko-compose = { module = "dev.icerock.moko:resources-compose", version.ref = "m
proguard = { module = "com.guardsquare:proguard-gradle", version.ref = "proguard" } proguard = { module = "com.guardsquare:proguard-gradle", version.ref = "proguard" }
# Gradle # Gradle
gradle-kotlin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
gradle-android = { module = "com.android.tools.build:gradle", version.ref = "androidGradle" }
gradle-download-task = { module = "de.undercouch:gradle-download-task", version.ref = "gradleDownloadTask" } gradle-download-task = { module = "de.undercouch:gradle-download-task", version.ref = "gradleDownloadTask" }
[plugins] [plugins]
@@ -174,6 +178,7 @@ kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" } kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
kotlin-compose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
# Android # Android
android-library = { id = "com.android.library", version.ref = "androidGradle" } android-library = { id = "com.android.library", version.ref = "androidGradle" }
@@ -187,7 +192,7 @@ ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
# Network # Network
ktorfit = { id = "de.jensklingenberg.ktorfit", version.ref = "ktorfit" } ktorfit = { id = "de.jensklingenberg.ktorfit", version.ref = "ktorfit" }
apollo = { id = "com.apollographql.apollo3", version.ref = "apollo" } apollo = { id = "com.apollographql.apollo", version.ref = "apollo" }
# Localization # Localization
moko-gradle = { id = "dev.icerock.mobile.multiplatform-resources", version.ref = "moko" } moko-gradle = { id = "dev.icerock.mobile.multiplatform-resources", version.ref = "moko" }

Binary file not shown.

View File

@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
networkTimeout=10000 networkTimeout=10000
validateDistributionUrl=true validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME

7
gradlew vendored
View File

@@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
# #
# SPDX-License-Identifier: Apache-2.0
#
############################################################################## ##############################################################################
# #
@@ -55,7 +57,7 @@
# Darwin, MinGW, and NonStop. # Darwin, MinGW, and NonStop.
# #
# (3) This script is generated from the Groovy template # (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project. # within the Gradle project.
# #
# You can find Gradle at https://github.com/gradle/gradle/. # You can find Gradle at https://github.com/gradle/gradle/.
@@ -84,7 +86,8 @@ done
# shellcheck disable=SC2034 # shellcheck disable=SC2034
APP_BASE_NAME=${0##*/} APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value. # Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum MAX_FD=maximum

22
gradlew.bat vendored
View File

@@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and @rem See the License for the specific language governing permissions and
@rem limitations under the License. @rem limitations under the License.
@rem @rem
@rem SPDX-License-Identifier: Apache-2.0
@rem
@if "%DEBUG%"=="" @echo off @if "%DEBUG%"=="" @echo off
@rem ########################################################################## @rem ##########################################################################
@@ -43,11 +45,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1 %JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute if %ERRORLEVEL% equ 0 goto execute
echo. echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. echo location of your Java installation. 1>&2
goto fail goto fail
@@ -57,11 +59,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute if exist "%JAVA_EXE%" goto execute
echo. echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. echo location of your Java installation. 1>&2
goto fail goto fail

View File

@@ -1,4 +1,3 @@
@Suppress("DSL_SCOPE_VIOLATION")
plugins { plugins {
id(libs.plugins.kotlin.multiplatform.get().pluginId) id(libs.plugins.kotlin.multiplatform.get().pluginId)
id(libs.plugins.android.library.get().pluginId) id(libs.plugins.android.library.get().pluginId)
@@ -9,14 +8,22 @@ kotlin {
androidTarget { androidTarget {
compilations { compilations {
all { all {
kotlinOptions.jvmTarget = Config.androidJvmTarget.toString() compileTaskProvider.configure {
compilerOptions {
jvmTarget = Config.androidJvmTarget
}
}
} }
} }
} }
jvm("desktop") { jvm("desktop") {
compilations { compilations {
all { all {
kotlinOptions.jvmTarget = Config.desktopJvmTarget.toString() compileTaskProvider.configure {
compilerOptions {
jvmTarget = Config.desktopJvmTarget
}
}
} }
} }
} }
@@ -35,38 +42,26 @@ kotlin {
applyDefaultHierarchyTemplate() applyDefaultHierarchyTemplate()
sourceSets { sourceSets {
val commonMain by getting { getByName("commonMain") {
dependencies { dependencies {
api(kotlin("stdlib-common"))
api(libs.moko.core) api(libs.moko.core)
} }
} }
val commonTest by getting { getByName("commonTest") {
dependencies { dependencies {
implementation(kotlin("test-common")) implementation(kotlin("test-common"))
implementation(kotlin("test-annotations-common")) implementation(kotlin("test-annotations-common"))
} }
} }
getByName("desktopMain") {
dependsOn(commonMain)
}
getByName("androidMain") {
dependsOn(commonMain)
}
} }
} }
tasks { tasks {
registerLocalizationTask(project) registerLocalizationTask(project)
getByName("desktopProcessResources")
.dependsOn("generateMRcommonMain", "generateMRdesktopMain")
} }
multiplatformResources { multiplatformResources {
multiplatformResourcesPackage = "ca.gosyer.jui.i18n" resourcesPackage = "ca.gosyer.jui.i18n"
} }
android { android {

View File

Before

Width:  |  Height:  |  Size: 483 B

After

Width:  |  Height:  |  Size: 483 B

View File

Before

Width:  |  Height:  |  Size: 722 B

After

Width:  |  Height:  |  Size: 722 B

View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

Before

Width:  |  Height:  |  Size: 929 B

After

Width:  |  Height:  |  Size: 929 B

View File

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

Before

Width:  |  Height:  |  Size: 5.0 KiB

After

Width:  |  Height:  |  Size: 5.0 KiB

View File

Before

Width:  |  Height:  |  Size: 7.6 KiB

After

Width:  |  Height:  |  Size: 7.6 KiB

View File

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View File

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View File

Before

Width:  |  Height:  |  Size: 229 B

After

Width:  |  Height:  |  Size: 229 B

View File

Before

Width:  |  Height:  |  Size: 299 B

After

Width:  |  Height:  |  Size: 299 B

View File

Before

Width:  |  Height:  |  Size: 494 B

After

Width:  |  Height:  |  Size: 494 B

View File

Before

Width:  |  Height:  |  Size: 362 B

After

Width:  |  Height:  |  Size: 362 B

View File

Before

Width:  |  Height:  |  Size: 643 B

After

Width:  |  Height:  |  Size: 643 B

View File

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@@ -1,14 +1,15 @@
import org.jetbrains.compose.compose import org.jetbrains.compose.compose
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
@Suppress("DSL_SCOPE_VIOLATION")
plugins { plugins {
id(libs.plugins.kotlin.multiplatform.get().pluginId) id(libs.plugins.kotlin.multiplatform.get().pluginId)
id(libs.plugins.kotlin.compose.get().pluginId)
id(libs.plugins.ksp.get().pluginId) id(libs.plugins.ksp.get().pluginId)
id(libs.plugins.compose.get().pluginId) id(libs.plugins.compose.get().pluginId)
id(libs.plugins.buildkonfig.get().pluginId) id(libs.plugins.buildkonfig.get().pluginId)
id(libs.plugins.kotlinter.get().pluginId) id(libs.plugins.kotlinter.get().pluginId)
id(libs.plugins.aboutLibraries.get().pluginId) id(libs.plugins.aboutLibraries.get().pluginId)
id(libs.plugins.ktorfit.get().pluginId)
} }
kotlin { kotlin {

View File

@@ -1,8 +1,8 @@
import org.jetbrains.compose.compose import org.jetbrains.compose.compose
@Suppress("DSL_SCOPE_VIOLATION")
plugins { plugins {
id(libs.plugins.kotlin.multiplatform.get().pluginId) id(libs.plugins.kotlin.multiplatform.get().pluginId)
id(libs.plugins.kotlin.compose.get().pluginId)
id(libs.plugins.android.library.get().pluginId) id(libs.plugins.android.library.get().pluginId)
id(libs.plugins.ksp.get().pluginId) id(libs.plugins.ksp.get().pluginId)
id(libs.plugins.compose.get().pluginId) id(libs.plugins.compose.get().pluginId)
@@ -14,14 +14,22 @@ kotlin {
androidTarget { androidTarget {
compilations { compilations {
all { all {
kotlinOptions.jvmTarget = Config.androidJvmTarget.toString() compileTaskProvider.configure {
compilerOptions {
jvmTarget = Config.androidJvmTarget
}
}
} }
} }
} }
jvm("desktop") { jvm("desktop") {
compilations { compilations {
all { all {
kotlinOptions.jvmTarget = Config.desktopJvmTarget.toString() compileTaskProvider.configure {
compilerOptions {
jvmTarget = Config.desktopJvmTarget
}
}
} }
} }
} }
@@ -57,7 +65,6 @@ kotlin {
} }
val commonMain by getting { val commonMain by getting {
dependencies { dependencies {
api(kotlin("stdlib-common"))
api(libs.coroutines.core) api(libs.coroutines.core)
api(libs.imageloader.core) api(libs.imageloader.core)
api(libs.imageloader.moko) api(libs.imageloader.moko)
@@ -97,8 +104,6 @@ kotlin {
val jvmMain by getting { val jvmMain by getting {
dependencies { dependencies {
api(kotlin("stdlib-jdk8"))
api(compose.desktop.currentOs) api(compose.desktop.currentOs)
} }
} }

View File

@@ -8,4 +8,4 @@ package ca.gosyer.jui.ui.base.screen
import cafe.adriel.voyager.core.screen.Screen import cafe.adriel.voyager.core.screen.Screen
expect abstract class BaseScreen : Screen expect abstract class BaseScreen() : Screen

View File

@@ -104,7 +104,7 @@ class SettingsGeneralViewModel
@Composable @Composable
fun getLanguageChoices(): ImmutableMap<String, String> { fun getLanguageChoices(): ImmutableMap<String, String> {
val langJsonState = MR.files.languages.readTextAsync() val langJsonState = MR.files.languages_json.readTextAsync()
val langs by produceState(emptyMap(), langJsonState.value) { val langs by produceState(emptyMap(), langJsonState.value) {
val langJson = langJsonState.value val langJson = langJsonState.value
if (langJson != null) { if (langJson != null) {

View File

@@ -8,5 +8,7 @@ package ca.gosyer.jui.ui.util.lang
import io.ktor.utils.io.ByteReadChannel import io.ktor.utils.io.ByteReadChannel
import okio.Source import okio.Source
import kotlin.coroutines.CoroutineContext
import kotlin.coroutines.EmptyCoroutineContext
expect suspend fun ByteReadChannel.toSource(): Source expect suspend fun ByteReadChannel.toSource(context: CoroutineContext = EmptyCoroutineContext): Source

View File

@@ -19,7 +19,7 @@ actual fun getLicenses(): Libs? {
null, null,
) { ) {
withIOContext { withIOContext {
val json = MR.files.aboutlibraries.readText() val json = MR.files.aboutlibraries_json.readText()
value = Libs.Builder().withJson(json).build() value = Libs.Builder().withJson(json).build()
} }
} }

View File

@@ -6,9 +6,32 @@
package ca.gosyer.jui.ui.util.lang package ca.gosyer.jui.ui.util.lang
import ca.gosyer.jui.core.io.source
import io.ktor.util.toByteArray
import io.ktor.utils.io.ByteReadChannel import io.ktor.utils.io.ByteReadChannel
import io.ktor.utils.io.cancel
import io.ktor.utils.io.readAvailable
import kotlinx.coroutines.runBlocking
import okio.Buffer
import okio.Source import okio.Source
import okio.Timeout
import kotlin.coroutines.CoroutineContext
actual suspend fun ByteReadChannel.toSource(context: CoroutineContext): Source {
val channel = this
return object : okio.Source {
override fun close() {
channel.cancel()
}
override fun read(sink: Buffer, byteCount: Long): Long {
val buffer = ByteArray(byteCount.toInt())
val read = runBlocking(context) { channel.readAvailable(buffer) }
sink.write(buffer.reversedArray())
return read.toLong()
}
override fun timeout(): Timeout {
return Timeout()
}
}
}
actual suspend fun ByteReadChannel.toSource(): Source = this.toByteArray().source()

View File

@@ -10,5 +10,6 @@ import io.ktor.utils.io.ByteReadChannel
import io.ktor.utils.io.jvm.javaio.toInputStream import io.ktor.utils.io.jvm.javaio.toInputStream
import okio.Source import okio.Source
import okio.source import okio.source
import kotlin.coroutines.CoroutineContext
actual suspend fun ByteReadChannel.toSource(): Source = toInputStream().source() actual suspend fun ByteReadChannel.toSource(context: CoroutineContext): Source = toInputStream().source()

View File

@@ -1,8 +1,8 @@
import org.jetbrains.compose.compose import org.jetbrains.compose.compose
@Suppress("DSL_SCOPE_VIOLATION")
plugins { plugins {
id(libs.plugins.kotlin.multiplatform.get().pluginId) id(libs.plugins.kotlin.multiplatform.get().pluginId)
id(libs.plugins.kotlin.compose.get().pluginId)
id(libs.plugins.android.library.get().pluginId) id(libs.plugins.android.library.get().pluginId)
id(libs.plugins.compose.get().pluginId) id(libs.plugins.compose.get().pluginId)
id(libs.plugins.buildkonfig.get().pluginId) id(libs.plugins.buildkonfig.get().pluginId)
@@ -13,14 +13,22 @@ kotlin {
androidTarget { androidTarget {
compilations { compilations {
all { all {
kotlinOptions.jvmTarget = Config.androidJvmTarget.toString() compileTaskProvider.configure {
compilerOptions {
jvmTarget = Config.androidJvmTarget
}
}
} }
} }
} }
jvm("desktop") { jvm("desktop") {
compilations { compilations {
all { all {
kotlinOptions.jvmTarget = Config.desktopJvmTarget.toString() compileTaskProvider.configure {
compilerOptions {
jvmTarget = Config.desktopJvmTarget
}
}
} }
} }
} }
@@ -54,7 +62,6 @@ kotlin {
} }
val commonMain by getting { val commonMain by getting {
dependencies { dependencies {
api(kotlin("stdlib-common"))
api(libs.coroutines.core) api(libs.coroutines.core)
api(libs.imageloader.core) api(libs.imageloader.core)
api(libs.imageloader.moko) api(libs.imageloader.moko)
@@ -81,7 +88,6 @@ kotlin {
val jvmMain by getting { val jvmMain by getting {
dependencies { dependencies {
api(kotlin("stdlib-jdk8"))
api(compose.desktop.currentOs) api(compose.desktop.currentOs)
} }
} }