diff --git a/.gitignore b/.gitignore index e59f517f..b5650fb5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .idea +.kotlin out/* *.iml target diff --git a/build.gradle b/build.gradle index 3f206e5d..8e6000fe 100644 --- a/build.gradle +++ b/build.gradle @@ -23,6 +23,7 @@ allprojects { mavenCentral() google() maven { url "https://maven.pkg.jetbrains.space/public/p/compose/dev" } + maven { url "https://nexus.inmo.dev/repository/maven-releases/" } } } diff --git a/client/build.gradle b/client/build.gradle index 2d27583d..54e9d760 100644 --- a/client/build.gradle +++ b/client/build.gradle @@ -3,6 +3,7 @@ plugins { id "org.jetbrains.kotlin.plugin.serialization" id "com.android.library" alias(libs.plugins.compose) + alias(libs.plugins.kt.jb.compose) } apply from: "$mppProjectWithSerializationPresetPath" diff --git a/client/src/main/AndroidManifest.xml b/client/src/androidMain/AndroidManifest.xml similarity index 100% rename from client/src/main/AndroidManifest.xml rename to client/src/androidMain/AndroidManifest.xml diff --git a/client/uikit/package.json b/client/uikit/package.json index 90171193..24bf0d5f 100644 --- a/client/uikit/package.json +++ b/client/uikit/package.json @@ -58,5 +58,6 @@ "semver": "^7.3.2", "svgo": "^2.8.0", "watch-run": "^1.2.5" - } + }, + "packageManager": "yarn@1.22.19+sha1.4ba7fc5c6e704fce2066ecbfb0b0d8976fe62447" } diff --git a/defaultAndroidSettings.gradle b/defaultAndroidSettings.gradle index 389980f1..c3f41ef8 100644 --- a/defaultAndroidSettings.gradle +++ b/defaultAndroidSettings.gradle @@ -1,39 +1,16 @@ apply plugin: 'com.getkeepsafe.dexcount' android { - ext { - jvmKotlinFolderFile = { - String sep = File.separator - return new File("${project.projectDir}${sep}src${sep}jvmMain${sep}kotlin") - } - - enableIncludingJvmCodeInAndroidPart = { - File jvmKotlinFolder = jvmKotlinFolderFile() - if (jvmKotlinFolder.exists()) { - android.sourceSets.main.java.srcDirs += jvmKotlinFolder.path - } - } - - disableIncludingJvmCodeInAndroidPart = { - File jvmKotlinFolder = jvmKotlinFolderFile() - String[] oldDirs = android.sourceSets.main.java.srcDirs - android.sourceSets.main.java.srcDirs = [] - for (oldDir in oldDirs) { - if (oldDir != jvmKotlinFolder.path) { - android.sourceSets.main.java.srcDirs += oldDir - } - } - } - } - compileSdkVersion libs.versions.android.props.compileSdk.get().toInteger() buildToolsVersion libs.versions.android.props.buildTools.get() defaultConfig { minSdkVersion libs.versions.android.props.minSdk.get().toInteger() + compileSdkVersion libs.versions.android.props.compileSdk.get().toInteger() targetSdkVersion libs.versions.android.props.compileSdk.get().toInteger() versionCode "${android_code_version}".toInteger() versionName "$version" + namespace "${project.group}.${project.name}" } buildTypes { release { @@ -51,18 +28,7 @@ android { } compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_17 + targetCompatibility JavaVersion.VERSION_17 } - - kotlinOptions { - jvmTarget = JavaVersion.VERSION_1_8.toString() - } - - sourceSets { - String sep = File.separator - main.java.srcDirs += "src${sep}main${sep}kotlin" - } - - enableIncludingJvmCodeInAndroidPart() } diff --git a/extensions.gradle b/extensions.gradle index 0dea6ff8..4312fc0b 100644 --- a/extensions.gradle +++ b/extensions.gradle @@ -13,21 +13,6 @@ allprojects { projectByName(name) } - allTargetsConfiguration = { -> - kotlin { - targets.all { - compilations.all { - kotlinOptions { - freeCompilerArgs += [ - "-P", - "plugin:androidx.compose.compiler.plugins.kotlin:suppressKotlinVersionCompatibilityCheck=true" - ] - } - } - } - } - } - mppProjectWithSerializationPresetPath = "${rootProject.projectDir.absolutePath}/mppProjectWithSerialization.gradle" mppJavaProjectPresetPath = "${rootProject.projectDir.absolutePath}/mppJavaProject.gradle" mppJsProjectPresetPath = "${rootProject.projectDir.absolutePath}/mppJsProject.gradle" diff --git a/features/auth/client/build.gradle b/features/auth/client/build.gradle index 8687f515..33beb15f 100644 --- a/features/auth/client/build.gradle +++ b/features/auth/client/build.gradle @@ -3,6 +3,7 @@ plugins { id "org.jetbrains.kotlin.plugin.serialization" id "com.android.library" alias(libs.plugins.compose) + alias(libs.plugins.kt.jb.compose) } apply from: "$mppProjectWithSerializationPresetPath" diff --git a/features/auth/client/src/commonMain/kotlin/dev/inmo/postssystem/features/auth/client/AuthorizedFeaturesModules.kt b/features/auth/client/src/commonMain/kotlin/dev/inmo/postssystem/features/auth/client/AuthorizedFeaturesModules.kt index 5fda8a90..7f247b45 100644 --- a/features/auth/client/src/commonMain/kotlin/dev/inmo/postssystem/features/auth/client/AuthorizedFeaturesModules.kt +++ b/features/auth/client/src/commonMain/kotlin/dev/inmo/postssystem/features/auth/client/AuthorizedFeaturesModules.kt @@ -1,7 +1,6 @@ package dev.inmo.postssystem.features.auth.client import dev.inmo.micro_utils.common.Either -import dev.inmo.micro_utils.ktor.client.UnifiedRequester import dev.inmo.postssystem.features.auth.common.AuthKey import dev.inmo.postssystem.features.auth.common.AuthTokenInfo import dev.inmo.postssystem.features.common.common.AdditionalModules @@ -27,7 +26,6 @@ fun createAuthorizedFeaturesDIModule( installClientAuthenticator(serverUrl, get(), get(AuthorizedQualifiers.CredsQualifier), onAuthKeyUpdated, onUserRetrieved, onAuthKeyInvalidated) } } - single { UnifiedRequester(get(), get()) } single { StatusFeatureClient(get(AuthorizedQualifiers.ServerUrlQualifier), get()) } AdditionalModules.Authorized.modules.forEach { diff --git a/features/auth/client/src/commonMain/kotlin/dev/inmo/postssystem/features/auth/client/ClientAuthFeature.kt b/features/auth/client/src/commonMain/kotlin/dev/inmo/postssystem/features/auth/client/ClientAuthFeature.kt index aa227ae0..30253391 100644 --- a/features/auth/client/src/commonMain/kotlin/dev/inmo/postssystem/features/auth/client/ClientAuthFeature.kt +++ b/features/auth/client/src/commonMain/kotlin/dev/inmo/postssystem/features/auth/client/ClientAuthFeature.kt @@ -2,14 +2,14 @@ package dev.inmo.postssystem.features.auth.client import dev.inmo.postssystem.features.auth.common.* import dev.inmo.postssystem.features.users.common.User -import dev.inmo.micro_utils.ktor.client.UnifiedRequester +import dev.inmo.micro_utils.ktor.client.bodyOrNull import dev.inmo.micro_utils.ktor.common.buildStandardUrl import io.ktor.client.HttpClient -import io.ktor.client.request.HttpRequestBuilder +import io.ktor.client.request.* import kotlinx.serialization.builtins.nullable class ClientAuthFeature( - private val requester: UnifiedRequester, + private val client: HttpClient, baseUrl: String ) : AuthFeature { private val rootUrl = buildStandardUrl(baseUrl.dropLastWhile { it == '/' }, authRootPathPart) @@ -26,28 +26,23 @@ class ClientAuthFeature( authGetMePathPart ) - constructor(client: HttpClient, rootUrl: String): this( - UnifiedRequester(client), - rootUrl - ) + override suspend fun auth(creds: AuthCreds): AuthTokenInfo? = client.post( + fullAuthPath + ) { + setBody(creds) + }.bodyOrNull() - override suspend fun auth(creds: AuthCreds): AuthTokenInfo? = requester.unipost( - fullAuthPath, - AuthCreds.serializer() to creds, - AuthTokenInfo.serializer().nullable - ) + override suspend fun refresh(refresh: RefreshToken): AuthTokenInfo? = client.post( + fullRefreshPath + ) { + setBody(refresh) + }.bodyOrNull() - override suspend fun refresh(refresh: RefreshToken): AuthTokenInfo? = requester.unipost( - fullRefreshPath, - RefreshToken.serializer() to refresh, - AuthTokenInfo.serializer().nullable - ) - - override suspend fun getMe(authToken: AuthToken): User? = requester.unipost( - fullGetMePath, - AuthToken.serializer() to authToken, - User.serializer().nullable - ) + override suspend fun getMe(authToken: AuthToken): User? = client.post( + fullGetMePath + ) { + setBody(authToken) + }.bodyOrNull() fun isAuthRequest(builder: HttpRequestBuilder): Boolean = builder.url.buildString().let { it == fullAuthPath || it == fullRefreshPath diff --git a/features/auth/client/src/commonMain/kotlin/dev/inmo/postssystem/features/auth/client/ClientCookiesConfigurator.kt b/features/auth/client/src/commonMain/kotlin/dev/inmo/postssystem/features/auth/client/ClientCookiesConfigurator.kt index a2920273..b82483b8 100644 --- a/features/auth/client/src/commonMain/kotlin/dev/inmo/postssystem/features/auth/client/ClientCookiesConfigurator.kt +++ b/features/auth/client/src/commonMain/kotlin/dev/inmo/postssystem/features/auth/client/ClientCookiesConfigurator.kt @@ -37,7 +37,7 @@ fun HttpClientConfig<*>.installClientAuthenticator( }.onSecond { currentRefreshToken = it.refresh } - val creds = initialAuthKey.t1 as? AuthCreds + val creds = initialAuthKey.t1OrNull as? AuthCreds var userRefreshJob: Job? = null install("Auth Token Refresher") { diff --git a/features/auth/client/src/main/AndroidManifest.xml b/features/auth/client/src/main/AndroidManifest.xml deleted file mode 100644 index 6d0e9ea0..00000000 --- a/features/auth/client/src/main/AndroidManifest.xml +++ /dev/null @@ -1 +0,0 @@ - diff --git a/features/auth/common/src/main/AndroidManifest.xml b/features/auth/common/src/main/AndroidManifest.xml deleted file mode 100644 index fa5134fc..00000000 --- a/features/auth/common/src/main/AndroidManifest.xml +++ /dev/null @@ -1 +0,0 @@ - diff --git a/features/auth/server/src/jvmMain/kotlin/dev/inmo/postssystem/features/auth/server/tokens/AuthTokensRepo.kt b/features/auth/server/src/jvmMain/kotlin/dev/inmo/postssystem/features/auth/server/tokens/AuthTokensRepo.kt index 1fd0ced4..9ca3f047 100644 --- a/features/auth/server/src/jvmMain/kotlin/dev/inmo/postssystem/features/auth/server/tokens/AuthTokensRepo.kt +++ b/features/auth/server/src/jvmMain/kotlin/dev/inmo/postssystem/features/auth/server/tokens/AuthTokensRepo.kt @@ -1,6 +1,6 @@ package dev.inmo.postssystem.features.auth.server.tokens -import com.soywiz.klock.DateTime +import korlibs.time.DateTime import dev.inmo.postssystem.features.auth.common.AuthToken import dev.inmo.postssystem.features.auth.common.RefreshToken import dev.inmo.postssystem.features.users.common.UserId diff --git a/features/auth/server/src/jvmMain/kotlin/dev/inmo/postssystem/features/auth/server/tokens/DefaultAuthTokensService.kt b/features/auth/server/src/jvmMain/kotlin/dev/inmo/postssystem/features/auth/server/tokens/DefaultAuthTokensService.kt index 49aec53c..a63d18de 100644 --- a/features/auth/server/src/jvmMain/kotlin/dev/inmo/postssystem/features/auth/server/tokens/DefaultAuthTokensService.kt +++ b/features/auth/server/src/jvmMain/kotlin/dev/inmo/postssystem/features/auth/server/tokens/DefaultAuthTokensService.kt @@ -1,7 +1,7 @@ package dev.inmo.postssystem.features.auth.server.tokens -import com.soywiz.klock.DateTime -import com.soywiz.klock.milliseconds +import korlibs.time.DateTime +import korlibs.time.milliseconds import dev.inmo.postssystem.features.auth.common.* import dev.inmo.postssystem.features.common.common.Milliseconds import dev.inmo.postssystem.features.users.common.* diff --git a/features/client/template/client/src/main/AndroidManifest.xml b/features/client/template/client/src/main/AndroidManifest.xml deleted file mode 100644 index 854a2d3d..00000000 --- a/features/client/template/client/src/main/AndroidManifest.xml +++ /dev/null @@ -1 +0,0 @@ - diff --git a/features/client/template/common/src/main/AndroidManifest.xml b/features/client/template/common/src/main/AndroidManifest.xml deleted file mode 100644 index 092e7502..00000000 --- a/features/client/template/common/src/main/AndroidManifest.xml +++ /dev/null @@ -1 +0,0 @@ - diff --git a/features/common/client/build.gradle b/features/common/client/build.gradle index 26cdd30f..a6fcbbd5 100644 --- a/features/common/client/build.gradle +++ b/features/common/client/build.gradle @@ -3,6 +3,7 @@ plugins { id "org.jetbrains.kotlin.plugin.serialization" id "com.android.library" alias(libs.plugins.compose) + alias(libs.plugins.kt.jb.compose) } apply from: "$mppProjectWithSerializationPresetPath" diff --git a/features/common/client/src/jsMain/kotlin/dev/inmo/postssystem/features/common/common/ui/DateTimeView.kt b/features/common/client/src/jsMain/kotlin/dev/inmo/postssystem/features/common/common/ui/DateTimeView.kt index 8130bc09..dd6c8726 100644 --- a/features/common/client/src/jsMain/kotlin/dev/inmo/postssystem/features/common/common/ui/DateTimeView.kt +++ b/features/common/client/src/jsMain/kotlin/dev/inmo/postssystem/features/common/common/ui/DateTimeView.kt @@ -1,8 +1,8 @@ package dev.inmo.postssystem.features.common.common.ui import androidx.compose.runtime.Composable -import com.soywiz.klock.DateTime -import com.soywiz.klock.ISO8601 +import korlibs.time.DateTime +import korlibs.time.ISO8601 import org.jetbrains.compose.web.dom.Text object DateTimeView { diff --git a/features/common/client/src/main/AndroidManifest.xml b/features/common/client/src/main/AndroidManifest.xml deleted file mode 100644 index b7562922..00000000 --- a/features/common/client/src/main/AndroidManifest.xml +++ /dev/null @@ -1 +0,0 @@ - diff --git a/features/common/common/src/commonMain/kotlin/dev/inmo/postssystem/features/common/common/DateTimeSerializer.kt b/features/common/common/src/commonMain/kotlin/dev/inmo/postssystem/features/common/common/DateTimeSerializer.kt index 0c4f9317..25011b67 100644 --- a/features/common/common/src/commonMain/kotlin/dev/inmo/postssystem/features/common/common/DateTimeSerializer.kt +++ b/features/common/common/src/commonMain/kotlin/dev/inmo/postssystem/features/common/common/DateTimeSerializer.kt @@ -1,6 +1,6 @@ package dev.inmo.postssystem.features.common.common -import com.soywiz.klock.DateTime +import korlibs.time.DateTime import kotlinx.serialization.KSerializer import kotlinx.serialization.Serializer import kotlinx.serialization.builtins.serializer diff --git a/features/common/common/src/commonMain/kotlin/dev/inmo/postssystem/features/common/common/SimpleInputProvider.kt b/features/common/common/src/commonMain/kotlin/dev/inmo/postssystem/features/common/common/SimpleInputProvider.kt index 13fce4c4..c68091d0 100644 --- a/features/common/common/src/commonMain/kotlin/dev/inmo/postssystem/features/common/common/SimpleInputProvider.kt +++ b/features/common/common/src/commonMain/kotlin/dev/inmo/postssystem/features/common/common/SimpleInputProvider.kt @@ -1,6 +1,7 @@ package dev.inmo.postssystem.features.common.common import dev.inmo.micro_utils.common.MPPFile +import dev.inmo.micro_utils.common.filesize import io.ktor.utils.io.core.* import kotlinx.serialization.KSerializer import kotlinx.serialization.builtins.ByteArraySerializer @@ -27,9 +28,18 @@ class BytesBasedInputProvider( } } -@Serializable(SimpleInputProviderSerializer::class) -expect class FileBasedInputProvider : SimpleInputProvider { +internal interface FileInputProvider : SimpleInputProvider { val file: MPPFile + + override val contentBytes: Long? + get() = file.filesize +} + +@Serializable(SimpleInputProviderSerializer::class) +expect class FileBasedInputProvider : FileInputProvider { + override val file: MPPFile + + override fun invoke(): Input } @Serializable(SimpleInputProviderSerializer::class) diff --git a/features/common/common/src/jsMain/kotlin/dev/inmo/postssystem/features/common/common/FileBasedInputProvider.kt b/features/common/common/src/jsMain/kotlin/dev/inmo/postssystem/features/common/common/FileBasedInputProvider.kt index 2396c976..d3a2b737 100644 --- a/features/common/common/src/jsMain/kotlin/dev/inmo/postssystem/features/common/common/FileBasedInputProvider.kt +++ b/features/common/common/src/jsMain/kotlin/dev/inmo/postssystem/features/common/common/FileBasedInputProvider.kt @@ -7,12 +7,9 @@ import kotlinx.serialization.Serializable @Serializable(SimpleInputProviderSerializer::class) actual class FileBasedInputProvider internal constructor( - actual val file: MPPFile -) : SimpleInputProvider { - override val contentBytes: Long - get() = file.filesize - - override fun invoke(): Input = error("Files inputs must not be used directly") + actual override val file: MPPFile +) : FileInputProvider { + actual override fun invoke(): Input = error("Files inputs must not be used directly") } fun MPPFile.inputProvider() = FileBasedInputProvider(this) diff --git a/features/common/common/src/jvmMain/kotlin/dev/inmo/postssystem/features/common/common/FileBasedInputProvider.kt b/features/common/common/src/jvmMain/kotlin/dev/inmo/postssystem/features/common/common/FileBasedInputProvider.kt index d072ee8b..57f69222 100644 --- a/features/common/common/src/jvmMain/kotlin/dev/inmo/postssystem/features/common/common/FileBasedInputProvider.kt +++ b/features/common/common/src/jvmMain/kotlin/dev/inmo/postssystem/features/common/common/FileBasedInputProvider.kt @@ -8,10 +8,8 @@ import kotlinx.serialization.Serializable @Serializable(SimpleInputProviderSerializer::class) actual class FileBasedInputProvider( - actual val file: MPPFile -) : SimpleInputProvider { - override val contentBytes: Long? - get() = file.filesize + actual override val file: MPPFile +) : FileInputProvider { - override fun invoke(): Input = file.inputStream().asInput() + actual override fun invoke(): Input = file.inputStream().asInput() } diff --git a/features/common/common/src/jvmMain/kotlin/dev/inmo/postssystem/features/common/common/KoinSingleWithBinds.kt b/features/common/common/src/jvmMain/kotlin/dev/inmo/postssystem/features/common/common/KoinSingleWithBinds.kt index 8e9a026b..b791fefc 100644 --- a/features/common/common/src/jvmMain/kotlin/dev/inmo/postssystem/features/common/common/KoinSingleWithBinds.kt +++ b/features/common/common/src/jvmMain/kotlin/dev/inmo/postssystem/features/common/common/KoinSingleWithBinds.kt @@ -1,6 +1,7 @@ package dev.inmo.postssystem.features.common.common import org.koin.core.definition.Definition +import org.koin.core.definition.KoinDefinition import org.koin.core.instance.InstanceFactory import org.koin.core.module.Module import org.koin.core.qualifier.Qualifier @@ -11,6 +12,6 @@ inline fun Module.singleWithBinds( qualifier: Qualifier? = null, createdAtStart: Boolean = false, noinline definition: Definition -): Pair> { +): KoinDefinition<*> { return single(qualifier, createdAtStart, definition) binds (T::class.allSuperclasses.toTypedArray()) } diff --git a/features/common/common/src/linuxX64Main/kotlin/dev/inmo/postssystem/features/common/common/FileMimeType.linuxX64.kt b/features/common/common/src/linuxX64Main/kotlin/dev/inmo/postssystem/features/common/common/FileMimeType.linuxX64.kt new file mode 100644 index 00000000..da924249 --- /dev/null +++ b/features/common/common/src/linuxX64Main/kotlin/dev/inmo/postssystem/features/common/common/FileMimeType.linuxX64.kt @@ -0,0 +1,10 @@ +package dev.inmo.postssystem.features.common.common + +import dev.inmo.micro_utils.common.MPPFile +import dev.inmo.micro_utils.common.filename +import dev.inmo.micro_utils.mime_types.* + +actual val MPPFile.mimeType: MimeType + get() { + return getMimeTypeOrAny(filename.extension) + } diff --git a/features/common/common/src/main/AndroidManifest.xml b/features/common/common/src/main/AndroidManifest.xml deleted file mode 100644 index bde7f1df..00000000 --- a/features/common/common/src/main/AndroidManifest.xml +++ /dev/null @@ -1 +0,0 @@ - diff --git a/features/common/common/src/mingwX64Main/kotlin/dev/inmo/postssystem/features/common/common/FileMimeType.mingwX64.kt b/features/common/common/src/mingwX64Main/kotlin/dev/inmo/postssystem/features/common/common/FileMimeType.mingwX64.kt new file mode 100644 index 00000000..d8379e61 --- /dev/null +++ b/features/common/common/src/mingwX64Main/kotlin/dev/inmo/postssystem/features/common/common/FileMimeType.mingwX64.kt @@ -0,0 +1,11 @@ +package dev.inmo.postssystem.features.common.common + +import dev.inmo.micro_utils.common.MPPFile +import dev.inmo.micro_utils.common.filename +import dev.inmo.micro_utils.mime_types.MimeType +import dev.inmo.micro_utils.mime_types.getMimeTypeOrAny + +actual val MPPFile.mimeType: MimeType + get() { + return getMimeTypeOrAny(filename.extension) + } diff --git a/features/content/binary/client/build.gradle b/features/content/binary/client/build.gradle index bb2ab94a..26157aa0 100644 --- a/features/content/binary/client/build.gradle +++ b/features/content/binary/client/build.gradle @@ -3,6 +3,7 @@ plugins { id "org.jetbrains.kotlin.plugin.serialization" id "com.android.library" alias(libs.plugins.compose) + alias(libs.plugins.kt.jb.compose) } apply from: "$mppProjectWithSerializationPresetPath" diff --git a/features/content/binary/client/src/main/AndroidManifest.xml b/features/content/binary/client/src/main/AndroidManifest.xml deleted file mode 100644 index 85ed176b..00000000 --- a/features/content/binary/client/src/main/AndroidManifest.xml +++ /dev/null @@ -1 +0,0 @@ - diff --git a/features/content/binary/common/src/main/AndroidManifest.xml b/features/content/binary/common/src/main/AndroidManifest.xml deleted file mode 100644 index 39d05da4..00000000 --- a/features/content/binary/common/src/main/AndroidManifest.xml +++ /dev/null @@ -1 +0,0 @@ - diff --git a/features/content/binary/server/src/jvmMain/kotlin/dev/inmo/postssystem/features/content/binary/server/BinaryServerContentStorage.kt b/features/content/binary/server/src/jvmMain/kotlin/dev/inmo/postssystem/features/content/binary/server/BinaryServerContentStorage.kt index a3c4aa24..60bf3fd2 100644 --- a/features/content/binary/server/src/jvmMain/kotlin/dev/inmo/postssystem/features/content/binary/server/BinaryServerContentStorage.kt +++ b/features/content/binary/server/src/jvmMain/kotlin/dev/inmo/postssystem/features/content/binary/server/BinaryServerContentStorage.kt @@ -6,7 +6,6 @@ import dev.inmo.micro_utils.coroutines.subscribeSafelyWithoutExceptions import dev.inmo.micro_utils.mime_types.KnownMimeTypes import dev.inmo.micro_utils.pagination.* import dev.inmo.micro_utils.repos.* -import dev.inmo.postssystem.features.common.common.FileBasedInputProvider import dev.inmo.postssystem.features.content.common.* import dev.inmo.postssystem.features.content.server.storage.ServerContentStorage import dev.inmo.postssystem.features.files.common.* diff --git a/features/content/client/build.gradle b/features/content/client/build.gradle index 4f518105..3b07e9a8 100644 --- a/features/content/client/build.gradle +++ b/features/content/client/build.gradle @@ -3,6 +3,7 @@ plugins { id "org.jetbrains.kotlin.plugin.serialization" id "com.android.library" alias(libs.plugins.compose) + alias(libs.plugins.kt.jb.compose) } apply from: "$mppProjectWithSerializationPresetPath" diff --git a/features/content/client/src/main/AndroidManifest.xml b/features/content/client/src/main/AndroidManifest.xml deleted file mode 100644 index 2990cb1e..00000000 --- a/features/content/client/src/main/AndroidManifest.xml +++ /dev/null @@ -1 +0,0 @@ - diff --git a/features/content/common/src/main/AndroidManifest.xml b/features/content/common/src/main/AndroidManifest.xml deleted file mode 100644 index 07feef75..00000000 --- a/features/content/common/src/main/AndroidManifest.xml +++ /dev/null @@ -1 +0,0 @@ - diff --git a/features/content/text/client/build.gradle b/features/content/text/client/build.gradle index add69bfb..0dbe1ab7 100644 --- a/features/content/text/client/build.gradle +++ b/features/content/text/client/build.gradle @@ -3,6 +3,7 @@ plugins { id "org.jetbrains.kotlin.plugin.serialization" id "com.android.library" alias(libs.plugins.compose) + alias(libs.plugins.kt.jb.compose) } apply from: "$mppProjectWithSerializationPresetPath" diff --git a/features/content/text/client/src/main/AndroidManifest.xml b/features/content/text/client/src/main/AndroidManifest.xml deleted file mode 100644 index e2c3d0a4..00000000 --- a/features/content/text/client/src/main/AndroidManifest.xml +++ /dev/null @@ -1 +0,0 @@ - diff --git a/features/content/text/common/src/main/AndroidManifest.xml b/features/content/text/common/src/main/AndroidManifest.xml deleted file mode 100644 index f9c5c71a..00000000 --- a/features/content/text/common/src/main/AndroidManifest.xml +++ /dev/null @@ -1 +0,0 @@ - diff --git a/features/files/client/src/commonMain/kotlin/dev/inmo/postssystem/features/files/client/ClientReadFilesStorage.kt b/features/files/client/src/commonMain/kotlin/dev/inmo/postssystem/features/files/client/ClientReadFilesStorage.kt index df837e9e..92a56f9f 100644 --- a/features/files/client/src/commonMain/kotlin/dev/inmo/postssystem/features/files/client/ClientReadFilesStorage.kt +++ b/features/files/client/src/commonMain/kotlin/dev/inmo/postssystem/features/files/client/ClientReadFilesStorage.kt @@ -2,28 +2,28 @@ package dev.inmo.postssystem.features.files.client import dev.inmo.postssystem.features.files.common.* import dev.inmo.postssystem.features.files.common.storage.ReadFilesStorage -import dev.inmo.micro_utils.ktor.client.UnifiedRequester +import dev.inmo.micro_utils.ktor.client.bodyOrNull import dev.inmo.micro_utils.ktor.common.buildStandardUrl import dev.inmo.micro_utils.repos.ReadCRUDRepo -import dev.inmo.micro_utils.repos.ktor.client.crud.KtorReadStandardCrudRepo +import dev.inmo.micro_utils.repos.ktor.client.crud.KtorReadCRUDRepoClient import io.ktor.client.HttpClient -import io.ktor.client.request.post -import io.ktor.client.request.setBody -import io.ktor.client.statement.HttpResponse +import io.ktor.client.request.* import io.ktor.client.statement.readBytes +import io.ktor.http.ContentType +import io.ktor.http.encodeURLQueryComponent import kotlinx.serialization.BinaryFormat import kotlinx.serialization.builtins.nullable class ClientReadFilesStorage( baseUrl: String, private val client: HttpClient, - private val serialFormat: BinaryFormat -) : ReadFilesStorage, ReadCRUDRepo by KtorReadStandardCrudRepo( + private val serialFormat: BinaryFormat, + contentType: ContentType +) : ReadFilesStorage, ReadCRUDRepo by KtorReadCRUDRepoClient( buildStandardUrl(baseUrl, filesRootPathPart), - UnifiedRequester(client, serialFormat), - MetaFileInfoStorageWrapper.serializer(), - MetaFileInfoStorageWrapper.serializer().nullable, - FileId.serializer() + client, + contentType, + { it.string.encodeURLQueryComponent() } ) { private val fullFilesPath = buildStandardUrl(baseUrl, filesRootPathPart) private val fullFilesGetBytesPath = buildStandardUrl( @@ -37,12 +37,11 @@ class ClientReadFilesStorage( override suspend fun getFullFileInfo( id: FileId - ): FullFileInfoStorageWrapper? = unifiedRequester.uniget( + ): FullFileInfoStorageWrapper? = client.get( buildStandardUrl( fullFilesPath, filesGetFullFileInfoPathPart, - filesFileIdParameter to unifiedRequester.encodeUrlQueryValue(FileId.serializer(), id) - ), - FullFileInfoStorageWrapper.serializer().nullable - ) + filesFileIdParameter to id.string.encodeURLQueryComponent() + ) + ).bodyOrNull() } diff --git a/features/files/client/src/commonMain/kotlin/dev/inmo/postssystem/features/files/client/ModuleLoader.kt b/features/files/client/src/commonMain/kotlin/dev/inmo/postssystem/features/files/client/ModuleLoader.kt index d535be20..1ffbcdd1 100644 --- a/features/files/client/src/commonMain/kotlin/dev/inmo/postssystem/features/files/client/ModuleLoader.kt +++ b/features/files/client/src/commonMain/kotlin/dev/inmo/postssystem/features/files/client/ModuleLoader.kt @@ -5,5 +5,5 @@ import dev.inmo.postssystem.features.auth.client.AuthorizedQualifiers import dev.inmo.postssystem.features.files.common.storage.ReadFilesStorage val loader = AuthorizedModuleLoader { - single { ClientReadFilesStorage(get(AuthorizedQualifiers.ServerUrlQualifier), get(), get()) } + single { ClientReadFilesStorage(get(AuthorizedQualifiers.ServerUrlQualifier), get(), get(), get()) } } diff --git a/features/files/client/src/main/AndroidManifest.xml b/features/files/client/src/main/AndroidManifest.xml deleted file mode 100644 index 20740703..00000000 --- a/features/files/client/src/main/AndroidManifest.xml +++ /dev/null @@ -1 +0,0 @@ - diff --git a/features/files/common/src/jvmMain/kotlin/dev/inmo/postssystem/features/files/common/DiskReadFilesStorage.kt b/features/files/common/src/jvmMain/kotlin/dev/inmo/postssystem/features/files/common/DiskReadFilesStorage.kt index 84c4dd4f..b21f5c76 100644 --- a/features/files/common/src/jvmMain/kotlin/dev/inmo/postssystem/features/files/common/DiskReadFilesStorage.kt +++ b/features/files/common/src/jvmMain/kotlin/dev/inmo/postssystem/features/files/common/DiskReadFilesStorage.kt @@ -61,4 +61,8 @@ class DiskReadFilesStorage( } ) } + + override suspend fun getIdsByPagination(pagination: Pagination): PaginationResult { + return metasKeyValueRepo.keys(pagination) + } } diff --git a/features/files/common/src/main/AndroidManifest.xml b/features/files/common/src/main/AndroidManifest.xml deleted file mode 100644 index 39fefc5e..00000000 --- a/features/files/common/src/main/AndroidManifest.xml +++ /dev/null @@ -1 +0,0 @@ - diff --git a/features/posts/client/src/main/AndroidManifest.xml b/features/posts/client/src/main/AndroidManifest.xml deleted file mode 100644 index 1d10bd6b..00000000 --- a/features/posts/client/src/main/AndroidManifest.xml +++ /dev/null @@ -1 +0,0 @@ - diff --git a/features/posts/common/src/commonMain/kotlin/dev/inmo/postssystem/features/posts/common/Post.kt b/features/posts/common/src/commonMain/kotlin/dev/inmo/postssystem/features/posts/common/Post.kt index 00007290..7d4bca57 100644 --- a/features/posts/common/src/commonMain/kotlin/dev/inmo/postssystem/features/posts/common/Post.kt +++ b/features/posts/common/src/commonMain/kotlin/dev/inmo/postssystem/features/posts/common/Post.kt @@ -1,6 +1,6 @@ package dev.inmo.postssystem.features.posts.common -import com.soywiz.klock.DateTime +import korlibs.time.DateTime import dev.inmo.postssystem.features.common.common.DateTimeSerializer import dev.inmo.postssystem.features.content.common.Content import dev.inmo.postssystem.features.content.common.ContentId diff --git a/features/posts/common/src/main/AndroidManifest.xml b/features/posts/common/src/main/AndroidManifest.xml deleted file mode 100644 index 6e2b9ccc..00000000 --- a/features/posts/common/src/main/AndroidManifest.xml +++ /dev/null @@ -1 +0,0 @@ - diff --git a/features/posts/server/src/jvmMain/kotlin/dev/inmo/postssystem/features/posts/server/ExposedServerPostsStorage.kt b/features/posts/server/src/jvmMain/kotlin/dev/inmo/postssystem/features/posts/server/ExposedServerPostsStorage.kt index adde6059..47c52931 100644 --- a/features/posts/server/src/jvmMain/kotlin/dev/inmo/postssystem/features/posts/server/ExposedServerPostsStorage.kt +++ b/features/posts/server/src/jvmMain/kotlin/dev/inmo/postssystem/features/posts/server/ExposedServerPostsStorage.kt @@ -1,6 +1,6 @@ package dev.inmo.postssystem.features.posts.server -import com.soywiz.klock.DateTime +import korlibs.time.DateTime import dev.inmo.micro_utils.repos.exposed.* import dev.inmo.postssystem.features.content.common.ContentId import dev.inmo.postssystem.features.posts.common.* diff --git a/features/publication/client/src/main/AndroidManifest.xml b/features/publication/client/src/main/AndroidManifest.xml deleted file mode 100644 index a785962d..00000000 --- a/features/publication/client/src/main/AndroidManifest.xml +++ /dev/null @@ -1 +0,0 @@ - diff --git a/features/publication/common/src/main/AndroidManifest.xml b/features/publication/common/src/main/AndroidManifest.xml deleted file mode 100644 index 7a641a46..00000000 --- a/features/publication/common/src/main/AndroidManifest.xml +++ /dev/null @@ -1 +0,0 @@ - diff --git a/features/roles/client/src/commonMain/kotlin/dev/inmo/postssystem/features/roles/client/ClientUsersRolesStorage.kt b/features/roles/client/src/commonMain/kotlin/dev/inmo/postssystem/features/roles/client/ClientUsersRolesStorage.kt index 0c11d2e7..20f7f1a4 100644 --- a/features/roles/client/src/commonMain/kotlin/dev/inmo/postssystem/features/roles/client/ClientUsersRolesStorage.kt +++ b/features/roles/client/src/commonMain/kotlin/dev/inmo/postssystem/features/roles/client/ClientUsersRolesStorage.kt @@ -1,7 +1,7 @@ package dev.inmo.postssystem.features.roles.client import dev.inmo.postssystem.features.roles.common.* -import dev.inmo.micro_utils.ktor.client.UnifiedRequester +import io.ktor.client.* import kotlinx.serialization.KSerializer class ClientRolesStorage( diff --git a/features/roles/client/src/commonMain/kotlin/dev/inmo/postssystem/features/roles/client/ReadClientUsersRolesStorage.kt b/features/roles/client/src/commonMain/kotlin/dev/inmo/postssystem/features/roles/client/ReadClientUsersRolesStorage.kt index 9ad26a35..f30e5276 100644 --- a/features/roles/client/src/commonMain/kotlin/dev/inmo/postssystem/features/roles/client/ReadClientUsersRolesStorage.kt +++ b/features/roles/client/src/commonMain/kotlin/dev/inmo/postssystem/features/roles/client/ReadClientUsersRolesStorage.kt @@ -27,7 +27,7 @@ class ReadClientRolesStorage( buildStandardUrl( userRolesFullUrl, usersRolesGetSubjectsPathPart, - usersRolesRoleQueryParameterName to unifiedRequester.encodeUrlQueryValue(serializer, role) + usersRolesRoleQueryParameterName to role ) ).body() diff --git a/features/roles/client/src/main/AndroidManifest.xml b/features/roles/client/src/main/AndroidManifest.xml deleted file mode 100644 index 2cc8c4f7..00000000 --- a/features/roles/client/src/main/AndroidManifest.xml +++ /dev/null @@ -1 +0,0 @@ - diff --git a/features/roles/common/src/main/AndroidManifest.xml b/features/roles/common/src/main/AndroidManifest.xml deleted file mode 100644 index aa7bc86e..00000000 --- a/features/roles/common/src/main/AndroidManifest.xml +++ /dev/null @@ -1 +0,0 @@ - diff --git a/features/roles/manager/client/src/main/AndroidManifest.xml b/features/roles/manager/client/src/main/AndroidManifest.xml deleted file mode 100644 index e88a91a9..00000000 --- a/features/roles/manager/client/src/main/AndroidManifest.xml +++ /dev/null @@ -1 +0,0 @@ - diff --git a/features/roles/manager/common/src/main/AndroidManifest.xml b/features/roles/manager/common/src/main/AndroidManifest.xml deleted file mode 100644 index 863b7a69..00000000 --- a/features/roles/manager/common/src/main/AndroidManifest.xml +++ /dev/null @@ -1 +0,0 @@ - diff --git a/features/status/client/src/commonMain/kotlin/dev/inmo/postssystem/features/status/client/StatusFeatureClient.kt b/features/status/client/src/commonMain/kotlin/dev/inmo/postssystem/features/status/client/StatusFeatureClient.kt index 63cabac9..35051a2c 100644 --- a/features/status/client/src/commonMain/kotlin/dev/inmo/postssystem/features/status/client/StatusFeatureClient.kt +++ b/features/status/client/src/commonMain/kotlin/dev/inmo/postssystem/features/status/client/StatusFeatureClient.kt @@ -2,11 +2,9 @@ package dev.inmo.postssystem.features.status.client import dev.inmo.postssystem.features.status.common.statusAuthorisedPathPart import dev.inmo.postssystem.features.status.common.statusRootPart -import dev.inmo.micro_utils.ktor.client.UnifiedRequester import dev.inmo.micro_utils.ktor.common.buildStandardUrl import io.ktor.client.HttpClient import io.ktor.client.request.get -import io.ktor.client.statement.HttpResponse import io.ktor.http.HttpStatusCode class StatusFeatureClient( diff --git a/features/status/client/src/main/AndroidManifest.xml b/features/status/client/src/main/AndroidManifest.xml deleted file mode 100644 index 64ae9c83..00000000 --- a/features/status/client/src/main/AndroidManifest.xml +++ /dev/null @@ -1 +0,0 @@ - diff --git a/features/status/common/src/main/AndroidManifest.xml b/features/status/common/src/main/AndroidManifest.xml deleted file mode 100644 index 32fae894..00000000 --- a/features/status/common/src/main/AndroidManifest.xml +++ /dev/null @@ -1 +0,0 @@ - diff --git a/features/template/client/src/main/AndroidManifest.xml b/features/template/client/src/main/AndroidManifest.xml deleted file mode 100644 index f591b318..00000000 --- a/features/template/client/src/main/AndroidManifest.xml +++ /dev/null @@ -1 +0,0 @@ - diff --git a/features/template/common/src/main/AndroidManifest.xml b/features/template/common/src/main/AndroidManifest.xml deleted file mode 100644 index e074950c..00000000 --- a/features/template/common/src/main/AndroidManifest.xml +++ /dev/null @@ -1 +0,0 @@ - diff --git a/features/users/client/src/commonMain/kotlin/dev/inmo/postssystem/features/users/client/ModuleLoader.kt b/features/users/client/src/commonMain/kotlin/dev/inmo/postssystem/features/users/client/ModuleLoader.kt index ec061aed..ddb2aa07 100644 --- a/features/users/client/src/commonMain/kotlin/dev/inmo/postssystem/features/users/client/ModuleLoader.kt +++ b/features/users/client/src/commonMain/kotlin/dev/inmo/postssystem/features/users/client/ModuleLoader.kt @@ -5,5 +5,5 @@ import dev.inmo.postssystem.features.auth.client.AuthorizedQualifiers import dev.inmo.postssystem.features.users.common.ReadUsersStorage val loader = AuthorizedModuleLoader { - single { UsersStorageKtorClient(get(AuthorizedQualifiers.ServerUrlQualifier), get()) } + single { UsersStorageKtorClient(get(AuthorizedQualifiers.ServerUrlQualifier), get(), get()) } } diff --git a/features/users/client/src/commonMain/kotlin/dev/inmo/postssystem/features/users/client/UsersStorageKtorClient.kt b/features/users/client/src/commonMain/kotlin/dev/inmo/postssystem/features/users/client/UsersStorageKtorClient.kt index c3962616..aa40d31b 100644 --- a/features/users/client/src/commonMain/kotlin/dev/inmo/postssystem/features/users/client/UsersStorageKtorClient.kt +++ b/features/users/client/src/commonMain/kotlin/dev/inmo/postssystem/features/users/client/UsersStorageKtorClient.kt @@ -1,19 +1,19 @@ package dev.inmo.postssystem.features.users.client import dev.inmo.postssystem.features.users.common.* -import dev.inmo.micro_utils.ktor.client.UnifiedRequester import dev.inmo.micro_utils.ktor.common.buildStandardUrl import dev.inmo.micro_utils.repos.ReadCRUDRepo -import dev.inmo.micro_utils.repos.ktor.client.crud.KtorReadStandardCrudRepo -import kotlinx.serialization.builtins.nullable +import dev.inmo.micro_utils.repos.ktor.client.crud.KtorReadCRUDRepoClient +import io.ktor.client.* +import io.ktor.http.* class UsersStorageKtorClient( baseUrl: String, - client: HttpClient -) : ReadUsersStorage, ReadCRUDRepo by KtorReadStandardCrudRepo( + client: HttpClient, + contentType: ContentType +) : ReadUsersStorage, ReadCRUDRepo by KtorReadCRUDRepoClient( buildStandardUrl(baseUrl, usersServerPathPart), client, - User.serializer(), - User.serializer().nullable, - UserId.serializer() + contentType, + { it.long.toString() } ) diff --git a/features/users/client/src/main/AndroidManifest.xml b/features/users/client/src/main/AndroidManifest.xml deleted file mode 100644 index f27161fd..00000000 --- a/features/users/client/src/main/AndroidManifest.xml +++ /dev/null @@ -1 +0,0 @@ - diff --git a/features/users/common/build.gradle b/features/users/common/build.gradle index ecd1b752..a367b58a 100644 --- a/features/users/common/build.gradle +++ b/features/users/common/build.gradle @@ -21,7 +21,3 @@ kotlin { } } } - -android { - disableIncludingJvmCodeInAndroidPart() -} diff --git a/features/users/common/src/commonMain/kotlin/dev/inmo/postssystem/features/users/common/User.kt b/features/users/common/src/commonMain/kotlin/dev/inmo/postssystem/features/users/common/User.kt index 644a64ae..e6cc7815 100644 --- a/features/users/common/src/commonMain/kotlin/dev/inmo/postssystem/features/users/common/User.kt +++ b/features/users/common/src/commonMain/kotlin/dev/inmo/postssystem/features/users/common/User.kt @@ -31,7 +31,7 @@ sealed class User : NewUser { } @Serializable -data class DefaultUser( +data class RegisteredUser( override val id: UserId, override val firstName: String, override val lastName: String, diff --git a/features/users/common/src/jvmMain/kotlin/dev/inmo/postssystem/features/users/common/ExposedUsersStorage.kt b/features/users/common/src/jvmMain/kotlin/dev/inmo/postssystem/features/users/common/ExposedUsersStorage.kt index bdd42932..4fc80a91 100644 --- a/features/users/common/src/jvmMain/kotlin/dev/inmo/postssystem/features/users/common/ExposedUsersStorage.kt +++ b/features/users/common/src/jvmMain/kotlin/dev/inmo/postssystem/features/users/common/ExposedUsersStorage.kt @@ -3,8 +3,7 @@ package dev.inmo.postssystem.features.users.common import dev.inmo.micro_utils.repos.exposed.AbstractExposedCRUDRepo import dev.inmo.micro_utils.repos.exposed.initTable import org.jetbrains.exposed.sql.* -import org.jetbrains.exposed.sql.statements.InsertStatement -import org.jetbrains.exposed.sql.statements.UpdateStatement +import org.jetbrains.exposed.sql.statements.* class ExposedUsersStorage(override val database: Database) : UsersStorage, AbstractExposedCRUDRepo( tableName = "Users" @@ -15,11 +14,12 @@ class ExposedUsersStorage(override val database: Database) : UsersStorage, Abstr private val lastNameColumn = text("lastName") override val primaryKey: PrimaryKey = PrimaryKey(userIdColumn) + override val selectById: ISqlExpressionBuilder.(UserId) -> Op = { userIdColumn.eq(it.long) } + override val ResultRow.asId: UserId + get() = UserId(get(userIdColumn)) - override val selectByIds: SqlExpressionBuilder.(List) -> Op = { userIdColumn.inList(it.map { it.long }) } - override val selectById: SqlExpressionBuilder.(UserId) -> Op = { userIdColumn.eq(it.long) } override val ResultRow.asObject: User - get() = DefaultUser( + get() = RegisteredUser( get(userIdColumn).userId, get(firstNameColumn), get(lastNameColumn), @@ -30,19 +30,19 @@ class ExposedUsersStorage(override val database: Database) : UsersStorage, Abstr initTable() } - override fun insert(value: NewUser, it: InsertStatement) { + override fun insert(value: NewUser, it: UpdateBuilder) { it[usernameColumn] = value.username.string it[firstNameColumn] = value.firstName it[lastNameColumn] = value.lastName } - override fun update(id: UserId, value: NewUser, it: UpdateStatement) { + override fun update(id: UserId?, value: NewUser, it: UpdateBuilder) { it[usernameColumn] = value.username.string it[firstNameColumn] = value.firstName it[lastNameColumn] = value.lastName } - override fun InsertStatement.asObject(value: NewUser): User = DefaultUser( + override fun InsertStatement.asObject(value: NewUser): User = RegisteredUser( get(userIdColumn).userId, get(firstNameColumn), get(lastNameColumn), diff --git a/features/users/common/src/main/AndroidManifest.xml b/features/users/common/src/main/AndroidManifest.xml deleted file mode 100644 index 0a697ab6..00000000 --- a/features/users/common/src/main/AndroidManifest.xml +++ /dev/null @@ -1 +0,0 @@ - diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 6caf3650..7e36d91e 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,39 +1,42 @@ [versions] -kotlin = "1.6.21" -kotlin-serialization = "1.3.3" -jsuikit = "0.1.7" -compose = "1.2.0-alpha01-dev709" -microutils = "0.11.1" -tgbotapi = "2.0.2" -ktor = "2.0.2" -klock = "2.7.0" -koin = "3.2.0" -exposed = "0.38.2" +kotlin = "2.0.10" +kotlin-serialization = "1.7.1" +kotlin-coroutines = "1.8.1" +jsuikit = "0.7.6" +compose = "1.7.0-alpha02" +microutils = "0.22.0" +tgbotapi = "17.0.0" +ktor = "2.3.11" +korlibs = "5.4.0" +koin = "3.5.6" +exposed = "0.53.0" psql = "42.3.6" -scrimage = "4.0.31" -dokka = "1.6.21" +scrimage = "4.1.1" +dokka = "1.9.20" logback = "1.2.10" -uuid = "0.4.1" +uuid = "0.8.4" android-junit = "4.12" android-test-junit = "1.1.2" android-espresso-core = "3.3.0" -gh-release = "2.3.7" +gh-release = "2.5.1" -android-gradle = "7.0.4" +android-gradle = "8.2.2" dexcount = "3.1.0" -android-coreKtx = "1.7.0" +android-coreKtx = "1.12.0" android-recyclerView = "1.2.1" android-appCompat = "1.4.1" +android-fragment = "1.6.2" +android-compose-material3 = "1.1.2" android-espresso = "3.3.0" android-test = "1.1.2" -android-props-minSdk = "19" -android-props-compileSdk = "32" -android-props-buildTools = "32.0.0" +android-props-minSdk = "21" +android-props-compileSdk = "35" +android-props-buildTools = "35.0.0" [libraries] @@ -42,6 +45,10 @@ kotlin-reflect = { module = "org.jetbrains.kotlin:kotlin-reflect", version.ref = kotlin-serialization = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlin-serialization" } kotlin-serialization-properties = { module = "org.jetbrains.kotlinx:kotlinx-serialization-properties", version.ref = "kotlin-serialization" } +kotlin-coroutines = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlin-coroutines" } +kotlin-coroutines-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "kotlin-coroutines" } +kotlin-coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "kotlin-coroutines" } + jsuikit = { module = "dev.inmo:kjsuikit", version.ref = "jsuikit" } postgresql = { module = "org.postgresql:postgresql", version.ref = "psql" } @@ -81,12 +88,18 @@ microutils-serialization-typedserializer = { module = "dev.inmo:micro_utils.seri tgbotapi = { module = "dev.inmo:tgbotapi", version.ref = "tgbotapi" } -klock = { module = "com.soywiz.korlibs.klock:klock", version.ref = "klock" } +klock = { module = "com.soywiz.korge:korlibs-time", version.ref = "korlibs" } +krypto = { module = "com.soywiz.korge:korlibs-crypto", version.ref = "korlibs" } scrimage = { module = "com.sksamuel.scrimage:scrimage-core", version.ref = "scrimage" } -androidx-test-junit = { module = "androidx.test.ext:junit", version.ref = "android-test-junit" } -androidx-espresso = { module = "androidx.test.espresso:espresso-core", version.ref = "android-espresso-core" } +android-coreKtx = { module = "androidx.core:core-ktx", version.ref = "android-coreKtx" } +android-recyclerView = { module = "androidx.recyclerview:recyclerview", version.ref = "android-recyclerView" } +android-appCompat-resources = { module = "androidx.appcompat:appcompat-resources", version.ref = "android-appCompat" } +android-compose-material3 = { module = "androidx.compose.material3:material3", version.ref = "android-compose-material3" } +android-fragment = { module = "androidx.fragment:fragment", version.ref = "android-fragment" } +android-espresso = { module = "androidx.test.espresso:espresso-core", version.ref = "android-espresso" } +android-test-junit = { module = "androidx.test.ext:junit", version.ref = "android-test" } # classpaths @@ -100,3 +113,4 @@ buildscript-android-dexcount = { module = "com.getkeepsafe.dexcount:dexcount-gra [plugins] compose = { id = "org.jetbrains.compose", version.ref = "compose" } +kt-jb-compose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 11ec8ce8..462c8661 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,4 +1,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip zipStoreBase=GRADLE_USER_HOME diff --git a/mppAndroidProject.gradle b/mppAndroidProject.gradle index 270d7e20..6424eee0 100644 --- a/mppAndroidProject.gradle +++ b/mppAndroidProject.gradle @@ -1,11 +1,16 @@ project.version = "$version" project.group = "$group" -// apply from: "$publishGradlePath" +apply from: "$publishGradlePath" kotlin { - android { + androidTarget { publishAllLibraryVariants() + compilations.all { + kotlinOptions { + jvmTarget = "17" + } + } } sourceSets { @@ -18,18 +23,15 @@ kotlin { dependencies { implementation kotlin('test-common') implementation kotlin('test-annotations-common') - } - } - androidTest { - dependencies { - implementation kotlin('test-junit') - implementation libs.androidx.test.junit - implementation libs.androidx.espresso + implementation libs.kt.coroutines.test } } } - - allTargetsConfiguration() } apply from: "$defaultAndroidSettingsPresetPath" + +java { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 +} diff --git a/mppJavaProject.gradle b/mppJavaProject.gradle index c10ccc57..cb029dda 100644 --- a/mppJavaProject.gradle +++ b/mppJavaProject.gradle @@ -4,7 +4,13 @@ project.group = "$group" apply from: "$publishGradlePath" kotlin { - jvm() + jvm { + compilations.main { + kotlinOptions { + jvmTarget = "17" + } + } + } sourceSets { commonMain { @@ -16,6 +22,7 @@ kotlin { dependencies { implementation kotlin('test-common') implementation kotlin('test-annotations-common') + implementation libs.kotlin.coroutines.test } } @@ -25,11 +32,9 @@ kotlin { } } } - - allTargetsConfiguration() } java { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 } diff --git a/mppJsProject.gradle b/mppJsProject.gradle index 653e092c..9dd17d6a 100644 --- a/mppJsProject.gradle +++ b/mppJsProject.gradle @@ -13,21 +13,25 @@ kotlin { commonMain { dependencies { implementation kotlin('stdlib') + api libs.kotlin.serialization } } commonTest { dependencies { implementation kotlin('test-common') implementation kotlin('test-annotations-common') + implementation libs.kotlin.coroutines.test } } jsTest { dependencies { implementation kotlin('test-js') - implementation kotlin('test-junit') } } } - - allTargetsConfiguration() +} + +java { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 } diff --git a/mppProjectWithSerialization.gradle b/mppProjectWithSerialization.gradle index edc0a07c..9893cc77 100644 --- a/mppProjectWithSerialization.gradle +++ b/mppProjectWithSerialization.gradle @@ -4,19 +4,30 @@ project.group = "$group" apply from: "$publishGradlePath" kotlin { - jvm() + jvm { + compilations.main { + kotlinOptions { + jvmTarget = "17" + } + } + } js (IR) { browser() nodejs() } - android { + androidTarget { publishAllLibraryVariants() + compilations.all { + kotlinOptions { + jvmTarget = "17" + } + } } sourceSets { commonMain { dependencies { - implementation libs.kotlin.std + implementation kotlin('stdlib') api libs.kotlin.serialization } } @@ -24,6 +35,7 @@ kotlin { dependencies { implementation kotlin('test-common') implementation kotlin('test-annotations-common') + implementation libs.kotlin.coroutines.test } } jvmTest { @@ -34,24 +46,23 @@ kotlin { jsTest { dependencies { implementation kotlin('test-js') - implementation kotlin('test-junit') } } - androidTest { + androidUnitTest { dependencies { implementation kotlin('test-junit') - implementation libs.androidx.test.junit - implementation libs.androidx.espresso + implementation libs.android.test.junit + implementation libs.android.espresso } } - } - allTargetsConfiguration() + androidMain.dependsOn jvmMain + } } apply from: "$defaultAndroidSettingsPresetPath" java { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 } diff --git a/publicators/simple/client/src/main/AndroidManifest.xml b/publicators/simple/client/src/androidMain/AndroidManifest.xml similarity index 100% rename from publicators/simple/client/src/main/AndroidManifest.xml rename to publicators/simple/client/src/androidMain/AndroidManifest.xml diff --git a/publicators/simple/client/src/commonMain/kotlin/dev/inmo/postssystem/publicators/simple/client/SimplePublicatorServiceClient.kt b/publicators/simple/client/src/commonMain/kotlin/dev/inmo/postssystem/publicators/simple/client/SimplePublicatorServiceClient.kt index aa554d86..7d2fb2c1 100644 --- a/publicators/simple/client/src/commonMain/kotlin/dev/inmo/postssystem/publicators/simple/client/SimplePublicatorServiceClient.kt +++ b/publicators/simple/client/src/commonMain/kotlin/dev/inmo/postssystem/publicators/simple/client/SimplePublicatorServiceClient.kt @@ -1,11 +1,13 @@ package dev.inmo.postssystem.publicators.simple.client -import dev.inmo.micro_utils.ktor.client.UnifiedRequester import dev.inmo.micro_utils.ktor.common.buildStandardUrl import dev.inmo.postssystem.features.posts.common.PostId import dev.inmo.postssystem.features.publication.common.publicatorsRootPath import dev.inmo.postssystem.publicators.simple.common.simplePublicatorPublishPathPart import dev.inmo.postssystem.publicators.simple.common.simplePublicatorRootPath +import io.ktor.client.* +import io.ktor.client.call.* +import io.ktor.client.request.* import kotlinx.serialization.builtins.serializer class SimplePublicatorServiceClient( @@ -25,9 +27,9 @@ class SimplePublicatorServiceClient( simplePublicatorPublishPathPart ) - override suspend fun publish(postId: PostId) = unifiedRequester.unipost( + override suspend fun publish(postId: PostId) = client.post( publishFullUrl, - PostId.serializer() to postId, - Unit.serializer() - ) + ) { + setBody(postId) + }.body() } diff --git a/publicators/simple/common/src/main/AndroidManifest.xml b/publicators/simple/common/src/androidMain/AndroidManifest.xml similarity index 100% rename from publicators/simple/common/src/main/AndroidManifest.xml rename to publicators/simple/common/src/androidMain/AndroidManifest.xml diff --git a/publicators/template/client/src/main/AndroidManifest.xml b/publicators/template/client/src/androidMain/AndroidManifest.xml similarity index 100% rename from publicators/template/client/src/main/AndroidManifest.xml rename to publicators/template/client/src/androidMain/AndroidManifest.xml diff --git a/publicators/template/common/src/main/AndroidManifest.xml b/publicators/template/common/src/androidMain/AndroidManifest.xml similarity index 100% rename from publicators/template/common/src/main/AndroidManifest.xml rename to publicators/template/common/src/androidMain/AndroidManifest.xml diff --git a/publish.gradle b/publish.gradle index 78519469..e557d68a 100644 --- a/publish.gradle +++ b/publish.gradle @@ -1,7 +1,7 @@ apply plugin: 'maven-publish' task javadocsJar(type: Jar) { - classifier = 'javadoc' + archiveClassifier = 'javadoc' } publishing { @@ -49,12 +49,15 @@ publishing { maven { name = "GitHubPackages" url = uri("https://maven.pkg.github.com/PostsSystem/core") + credentials { username = project.hasProperty('GITHUBPACKAGES_USER') ? project.property('GITHUBPACKAGES_USER') : System.getenv('GITHUBPACKAGES_USER') password = project.hasProperty('GITHUBPACKAGES_PASSWORD') ? project.property('GITHUBPACKAGES_PASSWORD') : System.getenv('GITHUBPACKAGES_PASSWORD') } + } } } } } + \ No newline at end of file diff --git a/services/posts/client/src/main/AndroidManifest.xml b/services/posts/client/src/androidMain/AndroidManifest.xml similarity index 100% rename from services/posts/client/src/main/AndroidManifest.xml rename to services/posts/client/src/androidMain/AndroidManifest.xml diff --git a/services/posts/client/src/commonMain/kotlin/dev/inmo/postssystem/services/posts/client/ClientWritePostsService.kt b/services/posts/client/src/commonMain/kotlin/dev/inmo/postssystem/services/posts/client/ClientWritePostsService.kt index 63f67fdf..6a59bdd8 100644 --- a/services/posts/client/src/commonMain/kotlin/dev/inmo/postssystem/services/posts/client/ClientWritePostsService.kt +++ b/services/posts/client/src/commonMain/kotlin/dev/inmo/postssystem/services/posts/client/ClientWritePostsService.kt @@ -8,7 +8,6 @@ import dev.inmo.micro_utils.ktor.common.encodeHex import dev.inmo.micro_utils.repos.ktor.common.crud.createRouting import dev.inmo.micro_utils.repos.ktor.common.crud.updateRouting import dev.inmo.micro_utils.repos.ktor.common.one_to_many.removeRoute -import dev.inmo.postssystem.features.common.common.FileBasedInputProvider import dev.inmo.postssystem.features.common.common.SimpleInputProvider import dev.inmo.postssystem.features.content.common.* import dev.inmo.postssystem.features.files.common.FileId diff --git a/services/posts/common/src/main/AndroidManifest.xml b/services/posts/common/src/androidMain/AndroidManifest.xml similarity index 100% rename from services/posts/common/src/main/AndroidManifest.xml rename to services/posts/common/src/androidMain/AndroidManifest.xml diff --git a/services/posts/server/src/jvmMain/kotlin/dev/inmo/postssystem/services/posts/server/ServerPostsServiceRoutingConfigurator.kt b/services/posts/server/src/jvmMain/kotlin/dev/inmo/postssystem/services/posts/server/ServerPostsServiceRoutingConfigurator.kt index eadd9289..28f6c438 100644 --- a/services/posts/server/src/jvmMain/kotlin/dev/inmo/postssystem/services/posts/server/ServerPostsServiceRoutingConfigurator.kt +++ b/services/posts/server/src/jvmMain/kotlin/dev/inmo/postssystem/services/posts/server/ServerPostsServiceRoutingConfigurator.kt @@ -11,7 +11,6 @@ import dev.inmo.micro_utils.repos.ktor.common.crud.createRouting import dev.inmo.micro_utils.repos.ktor.common.crud.updateRouting import dev.inmo.micro_utils.repos.ktor.common.one_to_many.removeRoute import dev.inmo.micro_utils.repos.ktor.server.crud.configureReadCRUDRepoRoutes -import dev.inmo.postssystem.features.common.common.FileBasedInputProvider import dev.inmo.postssystem.features.content.common.* import dev.inmo.postssystem.features.files.common.FileId import dev.inmo.postssystem.features.posts.common.* diff --git a/services/template/client/src/main/AndroidManifest.xml b/services/template/client/src/androidMain/AndroidManifest.xml similarity index 100% rename from services/template/client/src/main/AndroidManifest.xml rename to services/template/client/src/androidMain/AndroidManifest.xml diff --git a/services/template/common/src/main/AndroidManifest.xml b/services/template/common/src/androidMain/AndroidManifest.xml similarity index 100% rename from services/template/common/src/main/AndroidManifest.xml rename to services/template/common/src/androidMain/AndroidManifest.xml diff --git a/settings.gradle b/settings.gradle index 5bc4109d..070d6db8 100644 --- a/settings.gradle +++ b/settings.gradle @@ -83,5 +83,3 @@ includes.each { originalName -> project.projectDir = new File(projectDirectory) println(project) } - -enableFeaturePreview("VERSION_CATALOGS") diff --git a/targets/telegram/content/polls/client/src/main/AndroidManifest.xml b/targets/telegram/content/polls/client/src/androidMain/AndroidManifest.xml similarity index 100% rename from targets/telegram/content/polls/client/src/main/AndroidManifest.xml rename to targets/telegram/content/polls/client/src/androidMain/AndroidManifest.xml diff --git a/targets/telegram/content/polls/common/src/main/AndroidManifest.xml b/targets/telegram/content/polls/common/src/androidMain/AndroidManifest.xml similarity index 100% rename from targets/telegram/content/polls/common/src/main/AndroidManifest.xml rename to targets/telegram/content/polls/common/src/androidMain/AndroidManifest.xml diff --git a/targets/telegram/loader/client/src/main/AndroidManifest.xml b/targets/telegram/loader/client/src/androidMain/AndroidManifest.xml similarity index 100% rename from targets/telegram/loader/client/src/main/AndroidManifest.xml rename to targets/telegram/loader/client/src/androidMain/AndroidManifest.xml diff --git a/targets/telegram/loader/common/src/main/AndroidManifest.xml b/targets/telegram/loader/common/src/androidMain/AndroidManifest.xml similarity index 100% rename from targets/telegram/loader/common/src/main/AndroidManifest.xml rename to targets/telegram/loader/common/src/androidMain/AndroidManifest.xml diff --git a/targets/telegram/template/client/src/main/AndroidManifest.xml b/targets/telegram/template/client/src/androidMain/AndroidManifest.xml similarity index 100% rename from targets/telegram/template/client/src/main/AndroidManifest.xml rename to targets/telegram/template/client/src/androidMain/AndroidManifest.xml diff --git a/targets/telegram/template/common/src/main/AndroidManifest.xml b/targets/telegram/template/common/src/androidMain/AndroidManifest.xml similarity index 100% rename from targets/telegram/template/common/src/main/AndroidManifest.xml rename to targets/telegram/template/common/src/androidMain/AndroidManifest.xml