git.iko.soy/parseable-android
on master help sign in
Fix login failure: AboutInfo.license type mismatch with server response (#8)
4be24bciko
app/src/main/java/com/parseable/android/data/model/Models.kt+1−1
@@ -107,7 +107,7 @@ data class AboutInfo(
107 val commit: String? = null,
107 val commit: String? = null,
108 @SerialName("deploymentId")
108 @SerialName("deploymentId")
109 val deploymentId: String? = null,
109 val deploymentId: String? = null,
110− val license: String? = null,
110+ val license: JsonObject? = null,
111 val mode: String? = null,
111 val mode: String? = null,
112 val staging: String? = null,
112 val staging: String? = null,
113 val store: JsonObject? = null,
113 val store: JsonObject? = null,
app/src/main/java/com/parseable/android/ui/screens/settings/SettingsScreen.kt+3−1
@@ -16,6 +16,8 @@ import androidx.compose.ui.unit.dp
16import androidx.hilt.navigation.compose.hiltViewModel
16import androidx.hilt.navigation.compose.hiltViewModel
17import androidx.lifecycle.compose.collectAsStateWithLifecycle
17import androidx.lifecycle.compose.collectAsStateWithLifecycle
18import com.parseable.android.BuildConfig
18import com.parseable.android.BuildConfig
19+import kotlinx.serialization.json.contentOrNull
20+import kotlinx.serialization.json.jsonPrimitive
19
21
20@OptIn(ExperimentalMaterial3Api::class)
22@OptIn(ExperimentalMaterial3Api::class)
21@Composable
23@Composable
@@ -153,7 +155,7 @@ fun SettingsScreen(
153 about.version?.let { SettingsRow("Version", it) }
155 about.version?.let { SettingsRow("Version", it) }
154 about.commit?.let { SettingsRow("Commit", it.take(12)) }
156 about.commit?.let { SettingsRow("Commit", it.take(12)) }
155 about.mode?.let { SettingsRow("Mode", it) }
157 about.mode?.let { SettingsRow("Mode", it) }
156− about.license?.let { SettingsRow("License", it) }
158+ about.license?.get("name")?.jsonPrimitive?.contentOrNull?.let { SettingsRow("License", it) }
157 about.deploymentId?.let { SettingsRow("Deployment ID", it.take(12)) }
159 about.deploymentId?.let { SettingsRow("Deployment ID", it.take(12)) }
158 about.queryEngine?.let { SettingsRow("Query Engine", it) }
160 about.queryEngine?.let { SettingsRow("Query Engine", it) }
159 }
161 }
app/src/test/java/com/parseable/android/SettingsViewModelTest.kt+3−1
@@ -3,6 +3,8 @@ package com.parseable.android
3import com.parseable.android.data.model.AboutInfo
3import com.parseable.android.data.model.AboutInfo
4import com.parseable.android.data.model.ApiResult
4import com.parseable.android.data.model.ApiResult
5import com.parseable.android.data.model.ServerConfig
5import com.parseable.android.data.model.ServerConfig
6+import kotlinx.serialization.json.buildJsonObject
7+import kotlinx.serialization.json.put
6import com.parseable.android.data.repository.ParseableRepository
8import com.parseable.android.data.repository.ParseableRepository
7import com.parseable.android.data.repository.SettingsRepository
9import com.parseable.android.data.repository.SettingsRepository
8import com.parseable.android.ui.screens.settings.SettingsViewModel
10import com.parseable.android.ui.screens.settings.SettingsViewModel
@@ -60,7 +62,7 @@ class SettingsViewModelTest {
60
62
61 @Test
63 @Test
62 fun `load sets about info on success`() = runTest {
64 fun `load sets about info on success`() = runTest {
63− val about = AboutInfo(version = "1.2.0", mode = "standalone", license = "AGPL")
65+ val about = AboutInfo(version = "1.2.0", mode = "standalone", license = buildJsonObject { put("name", "AGPL") })
64 coEvery { settingsRepository.serverConfig } returns flowOf(null)
66 coEvery { settingsRepository.serverConfig } returns flowOf(null)
65 coEvery { repository.getAbout() } returns ApiResult.Success(about)
67 coEvery { repository.getAbout() } returns ApiResult.Success(about)
66 coEvery { repository.listUsers() } returns ApiResult.Success(emptyList())
68 coEvery { repository.listUsers() } returns ApiResult.Success(emptyList())