@@ -96,6 +96,7 @@ fun StatinNudge(
96
96
Spacer (modifier = Modifier .height(16 .dp))
97
97
DescriptionText (
98
98
isLabBasedStatinNudgeEnabled = isLabBasedStatinNudgeEnabled,
99
+ isNonLabBasedStatinNudgeEnabled = isNonLabBasedStatinNudgeEnabled,
99
100
statinInfo = statinInfo
100
101
)
101
102
@@ -262,17 +263,22 @@ fun RiskProgressBar(
262
263
fun DescriptionText (
263
264
statinInfo : StatinInfo ,
264
265
isLabBasedStatinNudgeEnabled : Boolean ,
266
+ isNonLabBasedStatinNudgeEnabled : Boolean ,
265
267
) {
266
268
val text = descriptionText(
267
269
isLabBasedStatinNudgeEnabled = isLabBasedStatinNudgeEnabled,
270
+ isNonLabBasedStatinNudgeEnabled = isNonLabBasedStatinNudgeEnabled,
268
271
statinInfo = statinInfo,
269
272
)
270
273
271
274
val textColor = when {
272
- statinInfo.cvdRisk == null || statinInfo.cvdRisk.level == CVDRiskLevel .HIGH || statinInfo.hasDiabetes
273
- -> SimpleTheme .colors.material.error
275
+ statinInfo.hasDiabetes || statinInfo.hasCVD -> SimpleTheme .colors.material.error
276
+ isLabBasedStatinNudgeEnabled && (statinInfo.cvdRisk == null || statinInfo.cvdRisk.level == CVDRiskLevel .VERY_HIGH ) -> SimpleTheme .colors.material.error
277
+ isNonLabBasedStatinNudgeEnabled && (statinInfo.cvdRisk == null || statinInfo.cvdRisk.level == CVDRiskLevel .HIGH ) -> SimpleTheme .colors.material.error
278
+ isLabBasedStatinNudgeEnabled && (statinInfo.isSmoker == Answer .Unanswered || statinInfo.cholesterol == null ) ->
279
+ SimpleTheme .colors.onSurface67
274
280
275
- statinInfo.isSmoker == Answer .Unanswered || statinInfo.bmiReading == null || statinInfo.cholesterol == null ->
281
+ isNonLabBasedStatinNudgeEnabled && ( statinInfo.isSmoker == Answer .Unanswered || statinInfo.bmiReading == null ) ->
276
282
SimpleTheme .colors.onSurface67
277
283
278
284
else -> SimpleTheme .colors.material.error
@@ -294,46 +300,67 @@ fun DescriptionText(
294
300
@Composable
295
301
@ReadOnlyComposable
296
302
private fun descriptionText (
303
+ isNonLabBasedStatinNudgeEnabled : Boolean ,
297
304
isLabBasedStatinNudgeEnabled : Boolean ,
298
305
statinInfo : StatinInfo
299
306
): AnnotatedString {
300
- val maxCvdRiskRange = statinInfo.cvdRisk?.max ? : 0
301
-
302
307
return when {
303
308
statinInfo.hasCVD -> stringResource(R .string.statin_alert_refer_to_doctor)
304
309
305
- statinInfo.hasDiabetes && statinInfo.age >= MIN_AGE_FOR_STATIN && isLabBasedStatinNudgeEnabled. not () ->
310
+ statinInfo.hasDiabetes && statinInfo.age >= MIN_AGE_FOR_STATIN ->
306
311
stringResource(R .string.statin_alert_refer_to_doctor_diabetic_40)
307
312
308
- statinInfo.hasDiabetes && statinInfo.age >= MIN_AGE_FOR_STATIN && isLabBasedStatinNudgeEnabled && maxCvdRiskRange < LAB_BASED_MIN_REQ_MAX_RISK_RANGE ->
309
- stringResource( R .string.statin_alert_refer_to_doctor_diabetic_40 )
313
+ isLabBasedStatinNudgeEnabled -> labBasedDescriptionText(statinInfo)
314
+ isNonLabBasedStatinNudgeEnabled -> nonLabBasedDescriptionText(statinInfo )
310
315
311
- statinInfo.cvdRisk == null || statinInfo.cvdRisk.level == CVDRiskLevel .HIGH ->
312
- stringResource(R .string.statin_alert_refer_to_doctor)
316
+ else -> stringResource(R .string.statin_alert_refer_to_doctor)
317
+ }.toAnnotatedString()
318
+ }
313
319
314
- statinInfo.hasDiabetes && isLabBasedStatinNudgeEnabled ->
315
- stringResource(R .string.statin_alert_refer_to_doctor_diabetic)
320
+ @Composable
321
+ @ReadOnlyComposable
322
+ private fun labBasedDescriptionText (
323
+ statinInfo : StatinInfo
324
+ ): String {
325
+ return when {
316
326
317
- statinInfo.isSmoker == Answer .Unanswered && statinInfo.bmiReading == null && isLabBasedStatinNudgeEnabled.not () ->
318
- stringResource(R .string.statin_alert_add_smoking_and_bmi_info)
327
+ statinInfo.cvdRisk == null || statinInfo.cvdRisk.level == CVDRiskLevel .VERY_HIGH ->
328
+ stringResource(R .string.statin_alert_refer_to_doctor)
329
+
330
+ statinInfo.isSmoker == Answer .Unanswered && statinInfo.cholesterol == null ->
331
+ stringResource(R .string.statin_alert_add_smoking_and_cholesterol_info)
319
332
320
- statinInfo.isSmoker == Answer .Unanswered && statinInfo.bmiReading != null && isLabBasedStatinNudgeEnabled. not () ->
333
+ statinInfo.isSmoker == Answer .Unanswered && statinInfo.cholesterol != null ->
321
334
stringResource(R .string.statin_alert_add_smoking_info)
322
335
323
- statinInfo.isSmoker != Answer .Unanswered && statinInfo.bmiReading == null && isLabBasedStatinNudgeEnabled. not () ->
324
- stringResource(R .string.statin_alert_add_bmi_info )
336
+ statinInfo.isSmoker != Answer .Unanswered && statinInfo.cholesterol == null ->
337
+ stringResource(R .string.statin_alert_add_cholesterol_info )
325
338
326
- statinInfo.isSmoker == Answer .Unanswered && statinInfo.cholesterol == null && isLabBasedStatinNudgeEnabled ->
327
- stringResource(R .string.statin_alert_add_smoking_and_cholesterol_info)
339
+ else -> stringResource(R .string.statin_alert_refer_to_doctor)
340
+ }
341
+ }
342
+
343
+ @Composable
344
+ @ReadOnlyComposable
345
+ private fun nonLabBasedDescriptionText (
346
+ statinInfo : StatinInfo
347
+ ): String {
348
+ return when {
328
349
329
- statinInfo.isSmoker == Answer .Unanswered && statinInfo.cholesterol != null && isLabBasedStatinNudgeEnabled ->
350
+ statinInfo.cvdRisk == null || statinInfo.cvdRisk.level == CVDRiskLevel .HIGH ->
351
+ stringResource(R .string.statin_alert_refer_to_doctor)
352
+
353
+ statinInfo.isSmoker == Answer .Unanswered && statinInfo.bmiReading == null ->
354
+ stringResource(R .string.statin_alert_add_smoking_and_bmi_info)
355
+
356
+ statinInfo.isSmoker == Answer .Unanswered && statinInfo.bmiReading != null ->
330
357
stringResource(R .string.statin_alert_add_smoking_info)
331
358
332
- statinInfo.isSmoker != Answer .Unanswered && statinInfo.cholesterol == null && isLabBasedStatinNudgeEnabled ->
333
- stringResource(R .string.statin_alert_add_cholesterol_info )
359
+ statinInfo.isSmoker != Answer .Unanswered && statinInfo.bmiReading == null ->
360
+ stringResource(R .string.statin_alert_add_bmi_info )
334
361
335
362
else -> stringResource(R .string.statin_alert_refer_to_doctor)
336
- }.toAnnotatedString()
363
+ }
337
364
}
338
365
339
366
@Composable
0 commit comments