@@ -23,13 +23,8 @@ import kotlin.time.Duration.Companion.milliseconds
2323@Composable
2424fun CurrentInstallState (
2525 appState : AppState ? ,
26- apkDisplayDateString : String ,
2726 modifier : Modifier = Modifier ,
2827) {
29- val apkDateMillis: Long = remember(apkDisplayDateString) {
30- parseDateToMillis(apkDisplayDateString)
31- }
32-
3328 Row (
3429 modifier = modifier.padding(bottom = 8 .dp),
3530 verticalAlignment = Alignment .CenterVertically ,
@@ -46,52 +41,13 @@ fun CurrentInstallState(
4641 border = null ,
4742 )
4843 }
49- apkDateMillis == 0L || appState.installDateMillis == null -> {
44+ else -> {
5045 AssistChip (
5146 onClick = { /* No action */ },
5247 label = { Text (" Installed" ) },
5348 border = AssistChipDefaults .assistChipBorder(true ),
5449 )
5550 }
56- appState.installDateMillis >= apkDateMillis -> {
57- AssistChip (
58- onClick = { /* No action */ },
59- label = { Text (" Up to date" ) },
60- colors = AssistChipDefaults .assistChipColors(
61- containerColor = MaterialTheme .colorScheme.primaryContainer,
62- labelColor = MaterialTheme .colorScheme.onPrimaryContainer,
63- ),
64- border = null ,
65- )
66- }
67- else -> {
68- val diff = (apkDateMillis - appState.installDateMillis).milliseconds
69- val daysBehind = diff.inWholeDays
70- val hoursBehind = diff.inWholeHours
71-
72- val timeBehindText = when {
73- daysBehind > 31 -> " ${daysBehind / 7 } weeks behind"
74- daysBehind > 0 -> " $daysBehind days behind"
75- hoursBehind > 0 -> " $hoursBehind hours behind"
76- else -> " Less than an hour behind"
77- }
78- AssistChip (
79- onClick = { /* No action */ },
80- label = { Text (timeBehindText) },
81- leadingIcon = {
82- Icon (
83- Icons .Filled .Warning ,
84- contentDescription = " Warning" ,
85- tint = MaterialTheme .colorScheme.onTertiaryContainer,
86- )
87- },
88- colors = AssistChipDefaults .assistChipColors(
89- containerColor = MaterialTheme .colorScheme.tertiaryContainer,
90- labelColor = MaterialTheme .colorScheme.onTertiaryContainer,
91- ),
92- border = null ,
93- )
94- }
9551 }
9652
9753 if (appState != null && appState.isInstalled) {
0 commit comments