File tree Expand file tree Collapse file tree 2 files changed +22
-3
lines changed
src/commonMain/kotlin/dev/zxilly/notify/sdk Expand file tree Collapse file tree 2 files changed +22
-3
lines changed Original file line number Diff line number Diff line change 11@file:Suppress(" UnstableApiUsage" , " UNUSED_VARIABLE" )
22
3+ import com.codingfeline.buildkonfig.compiler.FieldSpec
34import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
45import java.io.FileInputStream
56import java.util.*
@@ -63,11 +64,16 @@ afterEvaluate {
6364plugins {
6465 kotlin(" multiplatform" ) version " 1.7.21"
6566 kotlin(" plugin.serialization" ) version " 1.7.21"
66- id(" io.codearte.nexus-staging" ) version " 0.30.0"
67- id(" com.dorongold.task-tree" ) version " 2.1.0"
67+
6868 id(" com.android.library" )
69+
70+ id(" io.codearte.nexus-staging" ) version " 0.30.0"
6971 id(" maven-publish" )
7072 id(" signing" )
73+
74+ id(" com.dorongold.task-tree" ) version " 2.1.0"
75+
76+ id(" com.codingfeline.buildkonfig" ) version " 0.13.3"
7177}
7278
7379kotlin {
@@ -155,6 +161,14 @@ kotlin {
155161 }
156162}
157163
164+ buildkonfig {
165+ packageName = " dev.zxilly.notify.sdk"
166+
167+ defaultConfigs {
168+ buildConfigField(FieldSpec .Type .STRING , " VERSION" , version.toString())
169+ }
170+ }
171+
158172val hostOs: String = System .getProperty(" os.name" )
159173val isMacosX64 = hostOs == " Mac OS X"
160174val isLinuxX64 = hostOs == " Linux"
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ package dev.zxilly.notify.sdk
33import dev.zxilly.notify.sdk.entity.*
44import io.ktor.client.*
55import io.ktor.client.call.*
6+ import io.ktor.client.plugins.*
67import io.ktor.client.plugins.contentnegotiation.*
78import io.ktor.client.request.*
89import io.ktor.client.request.forms.*
@@ -16,12 +17,16 @@ class Client private constructor(
1617 private val userID : String ,
1718 private val endpoint : String
1819) {
19- private val client = HttpClient () {
20+ private val client = HttpClient {
2021 install(ContentNegotiation ) {
2122 json(Json {
2223 ignoreUnknownKeys = true
2324 })
2425 }
26+ // set useragent
27+ install(UserAgent ) {
28+ agent = " znotify-kt-sdk/${BuildKonfig .VERSION } "
29+ }
2530 }
2631
2732 private suspend inline fun check () {
You can’t perform that action at this time.
0 commit comments