629eb924b636
fix: Gate TOTP shell progress (v2.3.51)
- time
- 2026-06-26 14:17 UTC · 4 months ago
- machine
- koh2
- parent
- c592f947ec77
↓ peach-android-629eb924.tar.gzatlas at this save
files changed3 files
app/build.gradle+2 −2app/src/main/java/com/peachpasswords/ui/vault/VaultListScreen.kt+12 −6app/src/test/java/com/peachpasswords/ui/vault/VaultListSyncDotTest.kt+12 −0app/build.gradle+2 −2
@@ -16,8 +16,8 @@1616 applicationId "com.peachpasswords"1717 minSdk 261818 targetSdk 3519- versionCode 23500020- versionName "2.3.50"19+ versionCode 23510020+ versionName "2.3.51"2121 2222 testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"2323 vectorDrawables {app/src/main/java/com/peachpasswords/ui/vault/VaultListScreen.kt+12 −6
@@ -172,6 +172,7 @@172172 value = search,173173 onChange = vm::setSearch,174174 count = if (search.isNotBlank()) "${entries.size}/$total" else "$total",175+ totpActive = totpShellProgressActive(entries),175176 )176177 if (allTags.isNotEmpty()) {177178 TagFilterStrip(@@ -385,7 +386,7 @@385386 }386387 387388 @Composable388-private fun SearchBar(value: String, onChange: (String) -> Unit, count: String) {389+private fun SearchBar(value: String, onChange: (String) -> Unit, count: String, totpActive: Boolean) {389390 val accent = LocalPeachAccent.current390391 // Global TOTP period progress — a 2dp accent tick above the field, ~10×/s.391392 val progress by produceState(0f) {@@ -394,11 +395,13 @@394395 Column(Modifier.fillMaxWidth()) {395396 Box(396397 Modifier.fillMaxWidth().height(2.dp).drawBehind {397- drawRect(398- color = accent.copy(alpha = 0.85f),399- size = Size(width = size.width * progress, height = size.height),400- topLeft = Offset.Zero,401- )398+ if (totpActive) {399+ drawRect(400+ color = accent.copy(alpha = 0.85f),401+ size = Size(width = size.width * progress, height = size.height),402+ topLeft = Offset.Zero,403+ )404+ }402405 },403406 )404407 Row(@@ -430,6 +433,9 @@430433 }431434 }432435 }436+437+internal fun totpShellProgressActive(entries: List<VaultEntry>): Boolean =438+ entries.any { it.hasTOTP() }433439 434440 @Composable435441 private fun SortBar(app/src/test/java/com/peachpasswords/ui/vault/VaultListSyncDotTest.kt+12 −0
@@ -2,7 +2,10 @@22 33 import androidx.compose.ui.graphics.Color44 import com.peachpasswords.sync.SyncStatus5+import com.peachpasswords.vault.VaultEntry56 import org.junit.Assert.assertEquals7+import org.junit.Assert.assertFalse8+import org.junit.Assert.assertTrue69 import org.junit.Test710 811 class VaultListSyncDotTest {@@ -17,6 +20,15 @@1720 assertEquals(syncing, dot(SyncStatus.Syncing))1821 assertEquals(synced, dot(SyncStatus.LastSynced(123L)))1922 assertEquals(error, dot(SyncStatus.Error("timeout")))23+ }24+25+ @Test fun totp_shell_progress_only_activates_when_entries_have_totp() {26+ val plain = VaultEntry(id = "plain", title = "Plain", createdAt = 1L, modifiedAt = 1L)27+ val totp = plain.copy(id = "totp", totp = "GEZDGNBVGY3TQOJQ")28+29+ assertFalse(totpShellProgressActive(emptyList()))30+ assertFalse(totpShellProgressActive(listOf(plain)))31+ assertTrue(totpShellProgressActive(listOf(plain, totp)))2032 }2133 2234 private fun dot(status: SyncStatus): Color =