1541d408acb4

fix: Close browser gap quick wins (v2.3.3)

- Bound Settings stack deck to browser-style region - Remove dead settings placeholder routes and screens - Wire vault sync dot to live SyncStatus - Add focused unit coverage

time
2026-06-25 17:19 UTC · 5 months ago
machine
koh2
parent
c94b00fae8aa
8 files app/build.gradle+2 −2app/src/main/java/com/peachpasswords/ui/PeachAppNavHost.kt+0 −6app/src/main/java/com/peachpasswords/ui/PeachNav.kt+0 −5app/src/main/java/com/peachpasswords/ui/screens/PlaceholderScreens.kt+0 −120app/src/main/java/com/peachpasswords/ui/settings/SettingsScreen.kt+120 −105app/src/main/java/com/peachpasswords/ui/vault/VaultListScreen.kt+27 −4app/src/test/java/com/peachpasswords/ui/settings/SettingsStackTest.kt+6 −0app/src/test/java/com/peachpasswords/ui/vault/VaultListSyncDotTest.kt+30 −0
app/build.gradle+2 −2
@@ -16,8 +16,8 @@1616         applicationId "com.peachpasswords"1717         minSdk 261818         targetSdk 3519-        versionCode 23020020-        versionName "2.3.2"19+        versionCode 23030020+        versionName "2.3.3"2121 2222         testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"2323         vectorDrawables {

view file

app/src/main/java/com/peachpasswords/ui/PeachAppNavHost.kt+0 −6
@@ -21,7 +21,6 @@2121 import com.peachpasswords.ui.onboarding.OnboardingScreen2222 import com.peachpasswords.ui.pairing.ChirpPairScreen2323 import com.peachpasswords.ui.recovery.RecoveryWordEntryScreen24-import com.peachpasswords.ui.screens.SimpleStub2524 import com.peachpasswords.ui.settings.PanicScreen2625 import com.peachpasswords.ui.settings.SettingsScreen2726 import com.peachpasswords.ui.vault.VaultHealthScreen@@ -144,11 +143,6 @@144143             NotesModeScreen(onBack = back)145144         }146145         composable(PeachNav.Settings.route) { SettingsScreen(onBack = back, onNavigate = nav) }147-        composable(PeachNav.SettingsProtection.route) { SimpleStub("Protection", back) }148-        composable(PeachNav.SettingsVault.route) { SimpleStub("Vault settings", back) }149-        composable(PeachNav.SettingsSync.route) { SimpleStub("Sync", back) }150-        composable(PeachNav.SettingsAppearance.route) { SimpleStub("Appearance", back) }151-        composable(PeachNav.SettingsPro.route) { SimpleStub("Peach Pro", back) }152146         composable(PeachNav.CodexGenerate.route) {153147             CodexGenerateScreen(onBack = back, onSetupRecovery = { nav(PeachNav.RecoverySetup) })154148         }

view file

app/src/main/java/com/peachpasswords/ui/PeachNav.kt+0 −5
@@ -32,11 +32,6 @@3232     }3333 3434     data object Settings : PeachNav("settings")35-    data object SettingsProtection : PeachNav("settings/protection")36-    data object SettingsVault : PeachNav("settings/vault")37-    data object SettingsSync : PeachNav("settings/sync")38-    data object SettingsAppearance : PeachNav("settings/appearance")39-    data object SettingsPro : PeachNav("settings/pro")4035     data object CodexGenerate : PeachNav("codex/generate")4136     data object CodexRestore : PeachNav("codex/restore")4237     data object ChirpPair : PeachNav("chirp/pair")

view file

app/src/main/java/com/peachpasswords/ui/screens/PlaceholderScreens.kt+0 −120
@@ -1,120 +0,0 @@1-package com.peachpasswords.ui.screens2-3-import androidx.compose.foundation.clickable4-import androidx.compose.foundation.layout.Arrangement5-import androidx.compose.foundation.layout.Box6-import androidx.compose.foundation.layout.Column7-import androidx.compose.foundation.layout.fillMaxSize8-import androidx.compose.foundation.layout.fillMaxWidth9-import androidx.compose.foundation.layout.padding10-import androidx.compose.foundation.layout.systemBarsPadding11-import androidx.compose.foundation.shape.RoundedCornerShape12-import androidx.compose.material3.MaterialTheme13-import androidx.compose.material3.Text14-import androidx.compose.runtime.Composable15-import androidx.compose.ui.Alignment16-import androidx.compose.ui.Modifier17-import androidx.compose.ui.draw.clip18-import androidx.compose.ui.graphics.Color19-import androidx.compose.ui.text.font.FontStyle20-import androidx.compose.ui.text.font.FontWeight21-import androidx.compose.ui.text.style.TextAlign22-import androidx.compose.ui.unit.dp23-import androidx.compose.ui.unit.sp24-import com.peachpasswords.ui.PeachNav25-import com.peachpasswords.ui.theme.LocalPeachAccent26-import com.peachpasswords.ui.theme.peachColors27-import com.peachpasswords.ui.theme.PeachType28-import com.peachpasswords.ui.theme.ShellBackground29-30-/**31- * Phase-1 placeholder. Each later phase replaces the matching screen with the32- * real implementation; until then these prove the shell + navigation graph work.33- */34-@Composable35-private fun Placeholder(36-    title: String,37-    subtitle: String? = null,38-    actions: List<Pair<String, () -> Unit>> = emptyList(),39-    onBack: (() -> Unit)? = null,40-) {41-    val accent = LocalPeachAccent.current42-    ShellBackground {43-        Column(44-            modifier = Modifier45-                .fillMaxSize()46-                .systemBarsPadding()47-                .padding(horizontal = 28.dp, vertical = 24.dp),48-            verticalArrangement = Arrangement.Center,49-            horizontalAlignment = Alignment.CenterHorizontally,50-        ) {51-            Text(52-                text = title,53-                color = accent,54-                fontFamily = PeachType.Display,55-                fontStyle = FontStyle.Italic,56-                fontWeight = FontWeight.Light,57-                fontSize = 34.sp,58-                textAlign = TextAlign.Center,59-            )60-            if (subtitle != null) {61-                Text(62-                    text = subtitle,63-                    color = peachColors.T1,64-                    fontFamily = PeachType.Mono,65-                    fontSize = 11.sp,66-                    textAlign = TextAlign.Center,67-                    modifier = Modifier.padding(top = 10.dp),68-                )69-            }70-            actions.forEach { (label, onClick) ->71-                NavButton(label, onClick, modifier = Modifier.padding(top = 14.dp))72-            }73-            if (onBack != null) {74-                NavButton("← Back", onBack, modifier = Modifier.padding(top = 14.dp), subtle = true)75-            }76-        }77-    }78-}79-80-@Composable81-private fun NavButton(82-    label: String,83-    onClick: () -> Unit,84-    modifier: Modifier = Modifier,85-    subtle: Boolean = false,86-) {87-    val accent = LocalPeachAccent.current88-    Box(89-        modifier = modifier90-            .fillMaxWidth()91-            .clip(RoundedCornerShape(12.dp))92-            .clickable(onClick = onClick)93-            .padding(vertical = 14.dp),94-        contentAlignment = Alignment.Center,95-    ) {96-        Text(97-            text = label,98-            color = if (subtle) peachColors.T1 else accent,99-            fontFamily = PeachType.Mono,100-            fontSize = 13.sp,101-        )102-    }103-}104-105-@Composable106-fun SettingsScreenStub(onNavigate: (PeachNav) -> Unit, onBack: () -> Unit) =107-    Placeholder(108-        title = "Settings",109-        subtitle = "PHASE 1 · SETTINGS SHELL",110-        actions = listOf(111-            "Sync" to { onNavigate(PeachNav.SettingsSync) },112-            "Pair a device" to { onNavigate(PeachNav.ChirpPair) },113-            "Codex backup" to { onNavigate(PeachNav.CodexGenerate) },114-        ),115-        onBack = onBack,116-    )117-118-@Composable119-fun SimpleStub(title: String, onBack: () -> Unit) =120-    Placeholder(title = title, subtitle = "PHASE 1 · SHELL", onBack = onBack)

view file at the parent

app/src/main/java/com/peachpasswords/ui/settings/SettingsScreen.kt+120 −105
@@ -78,6 +78,8 @@7878 private val TAB_H = 46.dp7979 private val TAB_OVERLAP = 14.dp8080 private val TAB_CARD_H = TAB_H + 4.dp81+private val MAX_DECK_H = 462.dp82+private val DECK_BOTTOM_GUTTER = 36.dp8183 8284 /** Drag distance past which a stack card flips between focused and deck states. */8385 private val DRAG_THRESHOLD = 60.dp@@ -113,6 +115,16 @@113115 internal fun collapsedTabTop(distance: Int): Dp =114116     EXPANDED_H - TAB_OVERLAP + COLLAPSED_TAB_STRIDE * distance115117 118+/**119+ * Browser StackDeck parity: the deck is a bounded region, not the whole settings120+ * screen. The fanned tabs live inside this box so the dark shell does not show121+ * as accidental gaps below the stack.122+ */123+internal fun settingsDeckHeight(availableHeight: Dp): Dp {124+    val constrained = availableHeight - DECK_BOTTOM_GUTTER125+    return minOf(MAX_DECK_H, if (constrained < 0.dp) 0.dp else constrained)126+}127+116128 @Composable117129 fun SettingsScreen(118130     onBack: () -> Unit,@@ -196,119 +208,122 @@196208             }197209 198210             BoxWithConstraints(Modifier.fillMaxSize()) {199-                val focusHeight = maxHeight - 8.dp200-                STACK_CARDS.forEachIndexed { index, card ->201-                    val isActive = card.id == active202-                    val distance = when {203-                        index == activeIndex -> -1204-                        index > activeIndex -> index - activeIndex - 1205-                        else -> STACK_CARDS.size - activeIndex + index - 1206-                    }207-                    val targetTop = when {208-                        isActive -> 0.dp209-                        !deckOpen -> focusHeight + 44.dp + (distance * 8).dp210-                        else -> collapsedTabTop(distance)211-                    }212-                    val targetHeight = when {213-                        isActive && deckOpen -> EXPANDED_H214-                        isActive -> focusHeight215-                        else -> TAB_CARD_H216-                    }217-                    val concealed = !deckOpen && !isActive211+                val deckHeight = settingsDeckHeight(maxHeight)212+                val focusHeight = deckHeight - 8.dp213+                Box(Modifier.fillMaxWidth().height(deckHeight)) {214+                    STACK_CARDS.forEachIndexed { index, card ->215+                        val isActive = card.id == active216+                        val distance = when {217+                            index == activeIndex -> -1218+                            index > activeIndex -> index - activeIndex - 1219+                            else -> STACK_CARDS.size - activeIndex + index - 1220+                        }221+                        val targetTop = when {222+                            isActive -> 0.dp223+                            !deckOpen -> focusHeight + 44.dp + (distance * 8).dp224+                            else -> collapsedTabTop(distance)225+                        }226+                        val targetHeight = when {227+                            isActive && deckOpen -> EXPANDED_H228+                            isActive -> focusHeight229+                            else -> TAB_CARD_H230+                        }231+                        val concealed = !deckOpen && !isActive218232 219-                    val animSpec = if (fanning) {220-                        tween<Float>(140, easing = PeachMotion.Celebrate)221-                    } else {222-                        tween<Float>(PeachMotion.Stack, easing = PeachMotion.StackSpring)223-                    }224-                    val top by animateDpAsState(225-                        targetTop,226-                        animationSpec = if (fanning) tween(140, easing = PeachMotion.Celebrate)227-                        else tween(PeachMotion.Stack, easing = PeachMotion.StackSpring),228-                        label = "top",229-                    )230-                    val cardH by animateDpAsState(231-                        targetHeight,232-                        animationSpec = if (fanning) tween(140, easing = PeachMotion.Celebrate)233-                        else tween(PeachMotion.Stack, easing = PeachMotion.StackSpring),234-                        label = "h",235-                    )236-                    val alpha by animateFloatAsState(if (concealed) 0f else 1f, animSpec, label = "a")237-                    val zIndex = if (isActive) 99f else (50 - distance).toFloat()233+                        val animSpec = if (fanning) {234+                            tween<Float>(140, easing = PeachMotion.Celebrate)235+                        } else {236+                            tween<Float>(PeachMotion.Stack, easing = PeachMotion.StackSpring)237+                        }238+                        val top by animateDpAsState(239+                            targetTop,240+                            animationSpec = if (fanning) tween(140, easing = PeachMotion.Celebrate)241+                            else tween(PeachMotion.Stack, easing = PeachMotion.StackSpring),242+                            label = "top",243+                        )244+                        val cardH by animateDpAsState(245+                            targetHeight,246+                            animationSpec = if (fanning) tween(140, easing = PeachMotion.Celebrate)247+                            else tween(PeachMotion.Stack, easing = PeachMotion.StackSpring),248+                            label = "h",249+                        )250+                        val alpha by animateFloatAsState(if (concealed) 0f else 1f, animSpec, label = "a")251+                        val zIndex = if (isActive) 99f else (50 - distance).toFloat()238252 239-                    // Celebration shake — keyframed bob + tilt as the Pro card lands.240-                    val shakeDy = remember { Animatable(0f) }241-                    val shakeRot = remember { Animatable(0f) }242-                    LaunchedEffect(celebrating == card.id) {243-                        if (celebrating == card.id && !reduceMotion) {244-                            launch {245-                                shakeRot.animateTo(0f, keyframes {253+                        // Celebration shake — keyframed bob + tilt as the Pro card lands.254+                        val shakeDy = remember { Animatable(0f) }255+                        val shakeRot = remember { Animatable(0f) }256+                        LaunchedEffect(celebrating == card.id) {257+                            if (celebrating == card.id && !reduceMotion) {258+                                launch {259+                                    shakeRot.animateTo(0f, keyframes {260+                                        durationMillis = 880261+                                        0f at 0; -1.3f at 211; 0.9f at 422; -0.45f at 616; 0f at 757262+                                    })263+                                }264+                                shakeDy.animateTo(0f, keyframes {246265                                     durationMillis = 880247-                                    0f at 0; -1.3f at 211; 0.9f at 422; -0.45f at 616; 0f at 757266+                                    0f at 0; -10f at 211; 5f at 422; -4f at 616; 2f at 757248267                                 })249268                             }250-                            shakeDy.animateTo(0f, keyframes {251-                                durationMillis = 880252-                                0f at 0; -10f at 211; 5f at 422; -4f at 616; 2f at 757253-                            })254269                         }255-                    }256270 257-                    val density = LocalDensity.current258-                    StackCard(259-                        spec = card,260-                        active = isActive,261-                        focused = isActive && !deckOpen,262-                        lede = vm.lede(card.id, entries.count { it.deletedAt == null }, settings),263-                        showSparkle = card.id == CardId.Pro && isPro,264-                        onIconClick = if (card.id == CardId.Pro && isPro) ({ celebrate() }) else null,265-                        body = {266-                            CardBody(267-                                id = card.id,268-                                fg = card.fg,269-                                vm = vm,270-                                settings = settings,271-                                entriesCount = entries.count { it.deletedAt == null },272-                                onNavigate = onNavigate,273-                            )274-                        },275-                        modifier = Modifier276-                            .fillMaxWidth()277-                            .align(Alignment.TopStart)278-                            .zIndex(zIndex)279-                            // Drag the deck like a physical stack: flick a tab up to focus280-                            // it, drag the focused card down to drop back into the deck.281-                            .pointerInput(card.id, deckOpen, isActive) {282-                                var dragY = 0f283-                                val thresholdPx = with(density) { DRAG_THRESHOLD.toPx() }284-                                detectDragGestures(285-                                    onDragStart = { dragY = 0f },286-                                    onDrag = { change, amount -> change.consume(); dragY += amount.y },287-                                    onDragEnd = {288-                                        when (resolveStackDrag(dragY, thresholdPx, isActive && !deckOpen)) {289-                                            DragOutcome.EXPAND -> { active = card.id; deckOpen = false }290-                                            DragOutcome.COLLAPSE -> { deckOpen = true }291-                                            DragOutcome.NONE -> {}292-                                        }293-                                    },271+                        val density = LocalDensity.current272+                        StackCard(273+                            spec = card,274+                            active = isActive,275+                            focused = isActive && !deckOpen,276+                            lede = vm.lede(card.id, entries.count { it.deletedAt == null }, settings),277+                            showSparkle = card.id == CardId.Pro && isPro,278+                            onIconClick = if (card.id == CardId.Pro && isPro) ({ celebrate() }) else null,279+                            body = {280+                                CardBody(281+                                    id = card.id,282+                                    fg = card.fg,283+                                    vm = vm,284+                                    settings = settings,285+                                    entriesCount = entries.count { it.deletedAt == null },286+                                    onNavigate = onNavigate,294287                                 )295-                            }296-                            .graphicsLayer {297-                                translationY = top.toPx() + with(density) { shakeDy.value.dp.toPx() }298-                                rotationZ = shakeRot.value299-                                this.alpha = alpha300-                            }301-                            .height(cardH),302-                        onClick = {303-                            // Tapping the active card is a no-op (browser StackDeck304-                            // parity); flick it up to focus, a tab up to focus that one.305-                            if (!isActive) {306-                                active = card.id307-                                deckOpen = false308-                            }309-                        },310-                        enabled = !concealed,311-                    )288+                            },289+                            modifier = Modifier290+                                .fillMaxWidth()291+                                .align(Alignment.TopStart)292+                                .zIndex(zIndex)293+                                // Drag the deck like a physical stack: flick a tab up to focus294+                                // it, drag the focused card down to drop back into the deck.295+                                .pointerInput(card.id, deckOpen, isActive) {296+                                    var dragY = 0f297+                                    val thresholdPx = with(density) { DRAG_THRESHOLD.toPx() }298+                                    detectDragGestures(299+                                        onDragStart = { dragY = 0f },300+                                        onDrag = { change, amount -> change.consume(); dragY += amount.y },301+                                        onDragEnd = {302+                                            when (resolveStackDrag(dragY, thresholdPx, isActive && !deckOpen)) {303+                                                DragOutcome.EXPAND -> { active = card.id; deckOpen = false }304+                                                DragOutcome.COLLAPSE -> { deckOpen = true }305+                                                DragOutcome.NONE -> {}306+                                            }307+                                        },308+                                    )309+                                }310+                                .graphicsLayer {311+                                    translationY = top.toPx() + with(density) { shakeDy.value.dp.toPx() }312+                                    rotationZ = shakeRot.value313+                                    this.alpha = alpha314+                                }315+                                .height(cardH),316+                            onClick = {317+                                // Tapping the active card is a no-op (browser StackDeck318+                                // parity); flick it up to focus, a tab up to focus that one.319+                                if (!isActive) {320+                                    active = card.id321+                                    deckOpen = false322+                                }323+                            },324+                            enabled = !concealed,325+                        )326+                    }312327                 }313328             }314329         }

view file

app/src/main/java/com/peachpasswords/ui/vault/VaultListScreen.kt+27 −4
@@ -141,6 +141,7 @@141141                 )142142             } else {143143                 TopBar(144+                    syncStatus = syncStatus,144145                     onSettings = { onNavigate(PeachNav.Settings) },145146                     onAdd = { onNavigate(PeachNav.EntryEdit(null)) },146147                     onLock = { vm.lock() },@@ -227,9 +228,33 @@227228     }228229 }229230 231+internal fun syncStatusDotColor(232+    status: SyncStatus,233+    idle: Color,234+    syncing: Color,235+    synced: Color,236+    error: Color,237+): Color = when (status) {238+    SyncStatus.Idle,239+    SyncStatus.Offline -> idle240+    SyncStatus.Syncing -> syncing241+    is SyncStatus.LastSynced -> synced242+    is SyncStatus.Error -> error243+}244+230245 @Composable231-private fun TopBar(onSettings: () -> Unit, onAdd: () -> Unit, onLock: () -> Unit) {246+private fun TopBar(syncStatus: SyncStatus, onSettings: () -> Unit, onAdd: () -> Unit, onLock: () -> Unit) {232247     val accent = LocalPeachAccent.current248+    val syncDotColor by animateColorAsState(249+        targetValue = syncStatusDotColor(250+            status = syncStatus,251+            idle = peachColors.T2,252+            syncing = peachColors.SyncBusy,253+            synced = peachColors.SyncOk,254+            error = peachColors.SyncErr,255+        ),256+        label = "sync-dot",257+    )233258     // Transparent so the top-left shell bloom reads behind the header (spec §6.3).234259     Row(235260         modifier = Modifier@@ -242,9 +267,7 @@242267     ) {243268         Text(text = "peach", color = accent, style = PeachType.wordmark)244269         Row(verticalAlignment = Alignment.CenterVertically) {245-            // Sync dot: no paired device yet, so it reads offline (t2), never a246-            // bright stand-in green. Wire to live sync status once pairing lands.247-            Box(Modifier.size(6.dp).clip(CircleShape).background(peachColors.T2))270+            Box(Modifier.size(6.dp).clip(CircleShape).background(syncDotColor))248271             Spacer(Modifier.width(10.dp))249272             Icon(250273                 Icons.Outlined.Lock, contentDescription = "Lock vault", tint = peachColors.T0,

view file

app/src/test/java/com/peachpasswords/ui/settings/SettingsStackTest.kt+6 −0
@@ -25,6 +25,12 @@2525         assertEquals(collapsedTabTop(5) - collapsedTabTop(4), stride)2626     }2727 28+    @Test fun settings_deck_is_bounded_like_browser_stack_deck() {29+        assertEquals(462.dp, settingsDeckHeight(900.dp))30+        assertEquals(444.dp, settingsDeckHeight(480.dp))31+        assertEquals(0.dp, settingsDeckHeight(24.dp))32+    }33+2834     // ── Drag gesture resolution ───────────────────────────────────────────────2935 3036     @Test fun settings_stack_drag_up_expands_card() {

view file

app/src/test/java/com/peachpasswords/ui/vault/VaultListSyncDotTest.kt+30 −0
@@ -0,0 +1,30 @@1+package com.peachpasswords.ui.vault2+3+import androidx.compose.ui.graphics.Color4+import com.peachpasswords.sync.SyncStatus5+import org.junit.Assert.assertEquals6+import org.junit.Test7+8+class VaultListSyncDotTest {9+    private val idle = Color(0xFF111111)10+    private val syncing = Color(0xFF222222)11+    private val synced = Color(0xFF333333)12+    private val error = Color(0xFF444444)13+14+    @Test fun sync_dot_reflects_live_sync_status() {15+        assertEquals(idle, dot(SyncStatus.Idle))16+        assertEquals(idle, dot(SyncStatus.Offline))17+        assertEquals(syncing, dot(SyncStatus.Syncing))18+        assertEquals(synced, dot(SyncStatus.LastSynced(123L)))19+        assertEquals(error, dot(SyncStatus.Error("timeout")))20+    }21+22+    private fun dot(status: SyncStatus): Color =23+        syncStatusDotColor(24+            status = status,25+            idle = idle,26+            syncing = syncing,27+            synced = synced,28+            error = error,29+        )30+}

view file