Skip to content

Commit e9da57f

Browse files
authored
1.4.52 bugfix (#26)
* 1.4.52 bug fix
1 parent 085f997 commit e9da57f

File tree

9 files changed

+20
-19
lines changed

9 files changed

+20
-19
lines changed

api/library/kotlin-simple-api-client/src/commonMain/kotlin/kim/jeonghyeon/net/SimpleApiCustom.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ class SimpleApiCustom internal constructor(val config: Config) {
3232

3333
}
3434

35-
fun HttpClient.getAdapter(): RequestResponseAdapter? {
36-
return feature(SimpleApiCustom)?.config?.adapter
35+
fun getAdapter(client: HttpClient): RequestResponseAdapter? {
36+
return client.feature(SimpleApiCustom)?.config?.adapter
3737
}
3838

3939
val NoConfig = Config()

api/plugin/kotlin-simple-api-gradle-service-shared/src/main/kotlin/kim/jeonghyeon/simplearchitecture/plugin/generator/ApiGenerator.kt

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ class ApiGenerator(
7878
""".trimMargin()
7979

8080
private fun SharedKtClass.makeClassDefinition() =
81-
"class ${getApiImplementationName(name)}(val client: HttpClient, val baseUrl: String, val requestResponseAdapter: RequestResponseAdapter?) : $name"
81+
"class ${getApiImplementationName(name)}(val client: HttpClient, val baseUrl: String) : $name"
8282

8383
private fun SharedKtClass.makeMainPathProperty(): String {
8484

@@ -139,6 +139,7 @@ class ApiGenerator(
139139
| ${parameters.map { it.toParameterInfo() }.joinToString(",\n ")}
140140
| )
141141
|)
142+
|val requestResponseAdapter: RequestResponseAdapter? = SimpleApiCustom.getAdapter(client)
142143
|return client.callApi(callInfo, if (requestResponseAdapter == null) ${if (pluginOptions.useFramework) "SimpleApiCustom.NoConfig.getArchitectureAdapter()" else "SimpleApiCustom.NoConfig.getApiAdapter()"} else requestResponseAdapter)
143144
""".trimMargin()
144145
}
@@ -243,7 +244,7 @@ class ApiGenerator(
243244
import io.ktor.client.HttpClient
244245
import kim.jeonghyeon.net.*
245246
246-
expect inline fun <reified T> HttpClient.create${pluginOptions.postFix.capitalize()}(baseUrl: String, requestResponseAdapter: RequestResponseAdapter? = SimpleApiCustom.run { getAdapter() }): T
247+
expect inline fun <reified T> HttpClient.create${pluginOptions.postFix.capitalize()}(baseUrl: String): T
247248
248249
""".trimIndent()
249250
)
@@ -272,10 +273,10 @@ class ApiGenerator(
272273
|${joinToString("\n") { "import ${if (it.packageName.isEmpty()) "" else "${it.packageName}."}${it.name}" }}
273274
|${joinToString("\n") { "import ${if (it.packageName.isEmpty()) "" else "${it.packageName}."}${it.name}Impl" }}
274275
|
275-
|${if (pluginOptions.isMultiplatform) "actual " else ""}inline fun <reified T> HttpClient.create${pluginOptions.postFix.capitalize()}(baseUrl: String, requestResponseAdapter: RequestResponseAdapter?${if (pluginOptions.isMultiplatform) "" else " = SimpleApiCustom.run { getAdapter() }"}): T {
276+
|${if (pluginOptions.isMultiplatform) "actual " else ""}inline fun <reified T> HttpClient.create${pluginOptions.postFix.capitalize()}(baseUrl: String): T {
276277
|
277278
| return when (T::class) {
278-
|${joinToString("\n") { "${it.name}::class -> ${it.name}Impl(this, baseUrl, requestResponseAdapter) as T" }.prependIndent(" ")}
279+
|${joinToString("\n") { "${it.name}::class -> ${it.name}Impl(this, baseUrl) as T" }.prependIndent(" ")}
279280
|
280281
| else -> ${getElseStatement()}
281282
| }
@@ -304,19 +305,19 @@ class ApiGenerator(
304305

305306
fun getElseStatement(): String {
306307
//api -> error("can not create " + T::class.simpleName)
307-
//architecture -> createSimple<T>(baseUrl, requestResponseAdapter)
308-
//other with api -> createSimple<T>(baseUrl, requestResponseAdapter)
309-
//other with architecture -> createSimpleFramework<T>(baseUrl, requestResponseAdapter)
308+
//architecture -> createSimple<T>(baseUrl)
309+
//other with api -> createSimple<T>(baseUrl)
310+
//other with architecture -> createSimpleFramework<T>(baseUrl)
310311
val isApi = pluginOptions.isInternal && !pluginOptions.useFramework
311312
val isArchitecture = pluginOptions.isInternal && pluginOptions.useFramework
312313
val isOtherWithApi = !pluginOptions.isInternal && !pluginOptions.useFramework
313314

314315
return if (isApi) {
315316
"error(\"can not create \" + T::class.simpleName)"
316317
} else if (isArchitecture || isOtherWithApi) {
317-
"createSimple<T>(baseUrl, requestResponseAdapter)"
318+
"createSimple<T>(baseUrl)"
318319
} else {
319-
"createSimpleFramework<T>(baseUrl, requestResponseAdapter)"
320+
"createSimpleFramework<T>(baseUrl)"
320321
}
321322
}
322323
}

buildSrc/src/main/kotlin/DependencyVersion.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
object versions {
2-
const val simpleArch = "1.4.51"
2+
const val simpleArch = "1.4.52"
33

44
object kotlin {
55
const val version = "1.4.21"

framework/kotlin-simple-architecture-client/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@ kotlin {
9898

9999
api(deps.sqldelight.android)
100100
api(deps.android.timber)
101-
api(deps.android.accompanist.coil)
102-
api(deps.android.accompanist.insets)
101+
// api(deps.android.accompanist.coil)
102+
// api(deps.android.accompanist.insets)
103103
}
104104
}
105105

initializer/android-backend-api-only/buildSrc/src/main/kotlin/Dependencies.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
object versions {
2-
const val simpleArch = "1.4.51"
2+
const val simpleArch = "1.4.52"
33

44
object kotlin {
55
const val version = "1.4.20"

initializer/android-ios-backend/buildSrc/src/main/kotlin/Dependencies.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
object versions {
2-
const val simpleArch = "1.4.51"
2+
const val simpleArch = "1.4.52"
33

44
object kotlin {
55
const val version = "1.4.20"

initializer/android-ios/buildSrc/src/main/kotlin/Dependencies.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
object versions {
2-
const val simpleArch = "1.4.51"
2+
const val simpleArch = "1.4.52"
33

44
object kotlin {
55
const val version = "1.4.20"

initializer/android/buildSrc/src/main/kotlin/Dependencies.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
object versions {
2-
const val simpleArch = "1.4.51"
2+
const val simpleArch = "1.4.52"
33

44
object kotlin {
55
const val version = "1.4.20"

sample/buildSrc/src/main/kotlin/Dependencies.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
object versions {
2-
const val simpleArch = "1.4.51"
2+
const val simpleArch = "1.4.52"
33

44
object kotlin {
55
const val version = "1.4.20"

0 commit comments

Comments
 (0)