feat(phase-1/m4.5a): desktop settings screen on the shared sections
DesktopSettingsScreen composes the M4.4d common sections (Appearance / Backup / About + building blocks) plus desktop-only Encryption rows. Android-incapable surfaces are hidden per 6.5: dynamic-color row (onDynamicColor null), Carnet importer (onImportCarnet null), SecuritySection entirely (no BiometricPrompt/FLAG_SECURE on the JVM). Flow dedupe so settings drives the EXACT M2/M3 behaviour, not a copy: - BackupActions split: BackupFlows/rememberBackupFlows owns the pick+ bridge + dialog machinery; the menu is now a thin skin (launchImport/ launchExportPlain/launchExportEncrypted + Dialogs()). - SecurityActions split: SecurityKeyFlows owns the recovery-key export/ import dialogs (hasKey gate, overwrite warning, import leg); toggleDesktopEncryption() keeps the enable/disable ordering. - M4.4d sections became PUBLIC (desktopApp is a separate module). Main.kt: gear button routes list-window <-> settings in-place (no nav stack yet — desktop nav polish is M5). New scripted leg --settings-smoke renders the screen headlessly before auto-exit. Verified: assembleDebug :desktopApp:build SUCCESSFUL + :desktopApp: run --self-test --settings-smoke (SELFTEST id=1, RENDER notes=1 selected=1, SETTINGS shown, ST_EXIT=0) + :core:data-jvm:smoke (M1a PASS); models clean.
This commit is contained in:
1 parent
0dc5935d1d
commit
d264238640
5 files changed
+461
-216
No files matched your search
@@ -15,6 +15,7 @@ import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.foundation.lazy.items
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.Add
|
||||
import androidx.compose.material.icons.filled.Settings
|
||||
import androidx.compose.material.icons.filled.Star
|
||||
import androidx.compose.material.icons.outlined.StarBorder
|
||||
import androidx.compose.material3.CenterAlignedTopAppBar
|
||||
@@ -101,6 +102,9 @@ fun main(args: Array<String>) {
|
||||
val backupPassphrase = args.argAfter("--backup-passphrase")
|
||||
// M3 task 4: scripted at-rest encryption legs — leg A enables + proves,
|
||||
// leg B (a SEPARATE process) proves the relaunch auto-install + sweep.
|
||||
// M4.5: scripted settings leg — opens the real settings screen mid-run
|
||||
// so the shared sections (M4.4d) render on the JVM before auto-exit.
|
||||
val settingsSmoke = "--settings-smoke" in args
|
||||
val cryptoSelfTest = "--crypto-self-test" in args
|
||||
val cryptoReopen = "--crypto-reopen" in args
|
||||
val cryptoPassphrase = args.argAfter("--crypto-passphrase") ?: "selftest-passphrase"
|
||||
@@ -144,6 +148,7 @@ fun main(args: Array<String>) {
|
||||
windowState = windowState,
|
||||
exitAfterSeconds = exitAfterSeconds,
|
||||
selfTest = selfTest,
|
||||
settingsSmoke = settingsSmoke,
|
||||
backupImport = backupImport,
|
||||
backupExport = backupExport,
|
||||
backupExportEnc = backupExportEnc,
|
||||
@@ -170,6 +175,7 @@ private fun NotesWindow(
|
||||
windowState: androidx.compose.ui.window.WindowState,
|
||||
exitAfterSeconds: Long?,
|
||||
selfTest: Boolean,
|
||||
settingsSmoke: Boolean,
|
||||
backupImport: String?,
|
||||
backupExport: String?,
|
||||
backupExportEnc: String?,
|
||||
@@ -184,6 +190,8 @@ private fun NotesWindow(
|
||||
val notes by remember(repository) { repository.observeAll() }
|
||||
.collectAsState(initial = emptyList())
|
||||
var selectedId by remember { mutableStateOf<Long?>(null) }
|
||||
// M4.5: the real settings screen replaces the M1b placeholder list.
|
||||
var showSettings by remember { mutableStateOf(false) }
|
||||
val scope = rememberCoroutineScope()
|
||||
val snackbar = remember { SnackbarHostState() }
|
||||
|
||||
@@ -202,6 +210,9 @@ private fun NotesWindow(
|
||||
MaterialTheme(
|
||||
colorScheme = if (darkTheme) darkColorScheme() else lightColorScheme(),
|
||||
) {
|
||||
if (showSettings) {
|
||||
DesktopSettingsScreen(app = app, onBack = { showSettings = false })
|
||||
} else {
|
||||
Scaffold(
|
||||
snackbarHost = { SnackbarHost(snackbar) },
|
||||
topBar = {
|
||||
@@ -230,6 +241,9 @@ private fun NotesWindow(
|
||||
}
|
||||
},
|
||||
) { Icon(Icons.Filled.Add, contentDescription = "New note") }
|
||||
IconButton(onClick = { showSettings = true }) {
|
||||
Icon(Icons.Filled.Settings, contentDescription = "Settings")
|
||||
}
|
||||
},
|
||||
)
|
||||
},
|
||||
@@ -267,6 +281,7 @@ private fun NotesWindow(
|
||||
Editor(repository = repository, note = selected)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LaunchedEffect(notes.size) {
|
||||
@@ -295,6 +310,15 @@ private fun NotesWindow(
|
||||
println("SELFTEST wrote note id=${saved.id}")
|
||||
}
|
||||
}
|
||||
if (settingsSmoke) {
|
||||
LaunchedEffect(Unit) {
|
||||
delay(1500)
|
||||
// Compose the real screen (crash = failure); it stays up as the
|
||||
// window's content until --exit-after closes the app.
|
||||
showSettings = true
|
||||
println("SETTINGS shown (shared Appearance/Backup/About + desktop rows)")
|
||||
}
|
||||
}
|
||||
if (backupImport != null || backupExportEnc != null) {
|
||||
LaunchedEffect(Unit) {
|
||||
delay(800) // mirror the self-test pacing; wait past first frame
|
||||
|
||||
Reference in new issue
Block a user