Skip to content

Commit dcc7cba

Browse files
committed
fix: force json format
1 parent 92231bb commit dcc7cba

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

app/src/main/java/to/bitkit/data/dto/AppUpdaterDTO.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ data class ReleaseInfoDTO(
1616
data class Platforms(
1717
@SerialName("android")
1818
val android: PlatformDetails,
19+
@SerialName("ios")
20+
val ios: PlatformDetails?,
1921
)
2022

2123
/**

app/src/main/java/to/bitkit/services/AppUpdaterService.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
package to.bitkit.services
22

33
import io.ktor.client.HttpClient
4-
import io.ktor.client.call.body
54
import io.ktor.client.request.get
65
import io.ktor.client.statement.HttpResponse
6+
import io.ktor.client.statement.bodyAsText
77
import io.ktor.http.isSuccess
8+
import kotlinx.serialization.json.Json
89
import to.bitkit.data.dto.ReleaseInfoDTO
910
import to.bitkit.env.Env
1011
import to.bitkit.utils.AppError
@@ -20,7 +21,9 @@ class AppUpdaterService @Inject constructor(
2021
val response: HttpResponse = client.get(Env.RELEASE_URL)
2122
return when (response.status.isSuccess()) {
2223
true -> {
23-
val responseBody = runCatching { response.body<ReleaseInfoDTO>() }.getOrElse {
24+
val responseBody = runCatching {
25+
Json.decodeFromString<ReleaseInfoDTO>(response.bodyAsText())
26+
}.getOrElse {
2427
throw AppUpdaterError.InvalidResponse(it.message.orEmpty())
2528
}
2629
responseBody

0 commit comments

Comments
 (0)