Skip to content

Commit a87d4fa

Browse files
Merge pull request #5417 from simpledotorg/master
2 parents 71cdab6 + a6388e2 commit a87d4fa

File tree

8 files changed

+34
-29
lines changed

8 files changed

+34
-29
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
2424
- Bump Coroutines to v1.10.2
2525
- Skip Sentry config during app startup in the debug mode
2626
- Show spanish language option in non-production builds only
27+
- Increase lab based risk threshold to 20%
28+
- Update manifest payload to move countries to top level and add version field
29+
- Bump Open CSV to v5.11
2730

2831
### Features
2932

@@ -33,6 +36,10 @@
3336

3437
- Display only languages supported by the selected country in the settings screen
3538

39+
### Fixes
40+
41+
- Fix crash when displaying large statin risk percentage text
42+
3643
## 2025.04.07
3744

3845
### Internal

app/src/main/java/org/simple/clinic/appconfig/AppConfigRepository.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class AppConfigRepository @Inject constructor(
5454
return manifestFetchApi
5555
.fetchManifest()
5656
.map { it.supportedCountries }
57-
.map { FetchSucceeded(it.countries) }
57+
.map { FetchSucceeded(it) }
5858
.cast(ManifestFetchResult::class.java)
5959
.onErrorReturn { cause -> FetchError(ErrorResolver.resolve(cause)) }
6060
}

app/src/main/java/org/simple/clinic/appconfig/CountriesPayload.kt

Lines changed: 0 additions & 11 deletions
This file was deleted.

app/src/main/java/org/simple/clinic/appconfig/Manifest.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ import com.squareup.moshi.JsonClass
66
@JsonClass(generateAdapter = true)
77
data class Manifest(
88

9-
@Json(name = "v2")
10-
val supportedCountries: CountriesPayload
9+
@Json(name = "version")
10+
val version: String,
11+
12+
@Json(name = "countries")
13+
val supportedCountries: List<Country>
1114
)

app/src/main/java/org/simple/clinic/summary/compose/StatinNudgeView.kt

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ import org.simple.clinic.cvdrisk.StatinInfo
4747
import org.simple.clinic.medicalhistory.Answer
4848
import org.simple.clinic.util.toAnnotatedString
4949

50-
private const val LAB_BASED_MIN_REQ_MAX_RISK_RANGE = 10
50+
private const val LAB_BASED_MIN_REQ_MAX_RISK_RANGE = 20
5151
private const val MIN_AGE_FOR_STATIN = 40
5252

5353
@Composable
@@ -157,10 +157,13 @@ fun RiskText(
157157
val totalTextWidth = textWidth + with(LocalDensity.current) { 8.dp.toPx() * 2 }
158158

159159
val calculatedOffsetX = midpoint - (totalTextWidth / 2)
160-
val clampedOffsetX = calculatedOffsetX.coerceIn(
161-
0f,
162-
parentWidth - totalTextWidth - parentPadding
163-
)
160+
val maxOffsetX = parentWidth - totalTextWidth - parentPadding
161+
val clampedOffsetX = if (maxOffsetX >= 0f) {
162+
calculatedOffsetX.coerceIn(0f, maxOffsetX)
163+
} else {
164+
0f
165+
}
166+
164167

165168
Text(
166169
modifier = Modifier

app/src/test/java/org/simple/clinic/appconfig/AppConfigRepositoryTest.kt

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@ package org.simple.clinic.appconfig
22

33
import com.f2prateek.rx.preferences2.Preference
44
import com.google.common.truth.Truth.assertThat
5+
import io.reactivex.Single
6+
import okhttp3.MediaType.Companion.toMediaType
7+
import okhttp3.ResponseBody.Companion.toResponseBody
8+
import org.junit.Test
59
import org.mockito.kotlin.doReturn
610
import org.mockito.kotlin.doThrow
711
import org.mockito.kotlin.mock
812
import org.mockito.kotlin.verify
913
import org.mockito.kotlin.verifyNoMoreInteractions
1014
import org.mockito.kotlin.whenever
11-
import io.reactivex.Single
12-
import okhttp3.MediaType.Companion.toMediaType
13-
import okhttp3.ResponseBody.Companion.toResponseBody
14-
import org.junit.Test
1515
import org.simple.clinic.TestData
1616
import org.simple.clinic.appconfig.StatesResult.StatesFetched
1717
import org.simple.clinic.appconfig.api.ManifestFetchApi
@@ -43,7 +43,7 @@ class AppConfigRepositoryTest {
4343
@Test
4444
fun `successful network calls to fetch the app manifest should return the app manifest`() {
4545
// given
46-
val countriesV2 = listOf(
46+
val countries = listOf(
4747
Country(
4848
isoCountryCode = "IN",
4949
displayName = "India",
@@ -56,16 +56,19 @@ class AppConfigRepositoryTest {
5656
)
5757
)
5858
)
59-
val countriesPayload = CountriesPayload(countriesV2)
59+
val manifestPayload = Manifest(
60+
version = "3",
61+
supportedCountries = countries
62+
)
6063

61-
whenever(manifestFetchApi.fetchManifest()).doReturn(Single.just(Manifest(countriesPayload)))
64+
whenever(manifestFetchApi.fetchManifest()).doReturn(Single.just(manifestPayload))
6265

6366
// then
6467

6568
repository
6669
.fetchAppManifest()
6770
.test()
68-
.assertValue(FetchSucceeded(countriesV2))
71+
.assertValue(FetchSucceeded(countries))
6972
.assertNoErrors()
7073
}
7174

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ android.experimental.enableTestFixturesKotlinSupport=true
2626
# Manifest URL endpoint
2727
# These are currently the same as the API endpoints declared earlier. Those will be removed later
2828
# once the country selection feature is complete.
29-
manifestEndpoint=https://api-qa.simple.org/api/
29+
manifestEndpoint=https://manifest.simple.org/sandbox/
3030
# Needed to switch NDK versions on the CI server since they have different
3131
# NDK versions on macOS and Linux environments. Gradle plugin 3.6+ requires
3232
# us to pin an NDK version if we package native libs.

gradle/libs.versions.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ moshi-moshi = { module = "com.squareup.moshi:moshi", version.ref = "moshi" }
156156
okhttp-okhttp = { module = "com.squareup.okhttp3:okhttp", version.ref = "okhttp" }
157157
okhttp-interceptor-logging = { module = "com.squareup.okhttp3:logging-interceptor", version.ref = "okhttp" }
158158

159-
openCsv = "com.opencsv:opencsv:5.10"
159+
openCsv = "com.opencsv:opencsv:5.11"
160160

161161
play-app-update = "com.google.android.play:app-update-ktx:2.1.0"
162162
play-services-auth = "com.google.android.gms:play-services-auth:21.3.0"

0 commit comments

Comments
 (0)