Skip to content

Commit cf4e9ef

Browse files
Titouan Thibaudtitooan
authored andcommitted
Remove the "x days behind" chip on the app cards, as they are currently not accurate.
1 parent ca2a9e0 commit cf4e9ef

File tree

2 files changed

+1
-52
lines changed

2 files changed

+1
-52
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 & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -4,32 +4,21 @@ import androidx.compose.foundation.layout.Row
44
import androidx.compose.foundation.layout.Spacer
55
import androidx.compose.foundation.layout.padding
66
import androidx.compose.foundation.layout.width
7-
import androidx.compose.material.icons.Icons
8-
import androidx.compose.material.icons.filled.Warning
97
import androidx.compose.material3.AssistChip
108
import androidx.compose.material3.AssistChipDefaults
11-
import androidx.compose.material3.Icon
129
import androidx.compose.material3.MaterialTheme
1310
import androidx.compose.material3.Text
1411
import androidx.compose.runtime.Composable
15-
import androidx.compose.runtime.remember
1612
import androidx.compose.ui.Alignment
1713
import androidx.compose.ui.Modifier
1814
import androidx.compose.ui.unit.dp
1915
import org.mozilla.tryfox.model.AppState
20-
import org.mozilla.tryfox.util.parseDateToMillis
21-
import kotlin.time.Duration.Companion.milliseconds
2216

2317
@Composable
2418
fun CurrentInstallState(
2519
appState: AppState?,
26-
apkDisplayDateString: String,
2720
modifier: Modifier = Modifier,
2821
) {
29-
val apkDateMillis: Long = remember(apkDisplayDateString) {
30-
parseDateToMillis(apkDisplayDateString)
31-
}
32-
3322
Row(
3423
modifier = modifier.padding(bottom = 8.dp),
3524
verticalAlignment = Alignment.CenterVertically,
@@ -46,52 +35,13 @@ fun CurrentInstallState(
4635
border = null,
4736
)
4837
}
49-
apkDateMillis == 0L || appState.installDateMillis == null -> {
38+
else -> {
5039
AssistChip(
5140
onClick = { /* No action */ },
5241
label = { Text("Installed") },
5342
border = AssistChipDefaults.assistChipBorder(true),
5443
)
5544
}
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-
}
9545
}
9646

9747
if (appState != null && appState.isInstalled) {

0 commit comments

Comments
 (0)