Skip to content

Commit 411cb25

Browse files
author
Titouan Thibaud
committed
Remove the "x days behind" chip on the app cards, as they are currently not accurate.
1 parent 4df1989 commit 411cb25

File tree

2 files changed

+1
-46
lines changed

2 files changed

+1
-46
lines changed

app/src/main/java/org/mozilla/tryfox/ui/composables/ArchiveGroupCard.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ fun ArchiveGroupCard(
100100
Column(modifier = Modifier.padding(ArchiveGroupCardTokens.ColumnPadding)) {
101101
CurrentInstallState(
102102
appState = appState,
103-
apkDisplayDateString = dateFromApk,
104103
)
105104

106105
ArchiveGroupHeader(

app/src/main/java/org/mozilla/tryfox/ui/composables/CurrentInstallState.kt

Lines changed: 1 addition & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,8 @@ import kotlin.time.Duration.Companion.milliseconds
2323
@Composable
2424
fun 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

Comments
 (0)