feat(phase-1/m4.4a): first screens to commonMain + shared clipboard

Pure moves: IncidoDrawer, ReleaseNotesDialog, PassphraseDialog
(clipboard: Context.getSystemService -> LocalClipboardManager, the
SAME API both targets ship in Compose 1.7.3 - the section 6.3
LocalClipboard+ClipEntry swap is a Compose 1.8-only API, recorded
for M5+). PassphraseGenerator moves behind an internal expect/
actual secureRandomInt (blockingFirst precedent; identical
SecureRandom actuals - both targets ARE the JVM).

New seams justified: secureRandomInt (java.security is not common);
commonMain gains jetbrains lifecycle viewmodel-compose +
runtime-compose (the SAME coordinates androidMain resolved since
M4.1) and material-icons-extended (moved with the screens).

Verified: ./gradlew assembleDebug :desktopApp:build SUCCESSFUL
+ :composeApp:compileKotlinJvm + :desktopApp:run --self-test
(SELFTEST id=1 -> RENDER notes=1 selected=1) + :core:data-jvm:smoke
(M1a PASS); objectbox-models clean.
This commit is contained in:
Incido Developer committed 2026-10-06 18:26:07 +13:00
1 parent 31408172df
commit bdb3d7157d
8 files changed
+74 -18

No files matched your search

@@ -1,63 +0,0 @@
package org.incido.compose.data.backup
import org.incido.compose.data.settings.PasswordPolicy
import java.security.SecureRandom
/**
* v0.3.2.0: SecureRandom-based passphrase generator for encrypted
* backups.
*
* The output is guaranteed to satisfy [PasswordPolicy]:
* - length in [MIN, MAX]
* - at least one digit
* - at least one special character
*
* If a freshly-generated passphrase fails validation (rare — only if
* the random draw happens to miss both a digit and a special) we
* regenerate, so the return type is non-nullable.
*/
object PassphraseGenerator {
private const val DEFAULT_LENGTH = 20
/**
* Pool of characters the generator picks from. Carefully built so
* every character is ASCII-printable, no whitespace, no ambiguous
* glyphs (we exclude `0`, `O`, `1`, `l`, `I` to keep the value
* copy-paste friendly).
*/
private val ALPHABET = (
"abcdefghijkmnopqrstuvwxyz" + // no 'l'
"ABCDEFGHJKLMNPQRSTUVWXYZ" + // no 'I', 'O'
"23456789" + // no '0', '1'
PasswordPolicy.SPECIAL_CHARS
).toCharArray()
private val secureRandom = SecureRandom()
/**
* Generate a passphrase of [length] characters (clamped to the
* policy's [PasswordPolicy.MIN_LENGTH] / [PasswordPolicy.MAX_LENGTH]
* bounds). The result is guaranteed to satisfy the policy.
*/
fun generate(length: Int = DEFAULT_LENGTH): String {
val clamped = length.coerceIn(PasswordPolicy.MIN_LENGTH, PasswordPolicy.MAX_LENGTH)
repeat(MAX_ATTEMPTS) {
val candidate = buildRandom(clamped)
if (PasswordPolicy.validate(candidate).isValid) return candidate
}
// Statistically unreachable — the alphabet guarantees a digit
// and a special in any draw of >= 12 chars. Fall back to a
// hand-crafted compliant value so we never throw from a UI
// button tap.
return "IncidoBackup!" + secureRandom.nextInt(10_000).toString().padStart(4, '0')
}
private fun buildRandom(length: Int): String {
val out = StringBuilder(length)
repeat(length) { out.append(ALPHABET[secureRandom.nextInt(ALPHABET.size)]) }
return out.toString()
}
private const val MAX_ATTEMPTS = 16
}
@@ -0,0 +1,14 @@
package org.incido.compose.data.backup
import java.security.SecureRandom
/**
* M4.4a seam for [PassphraseGenerator] — identical two-liner actual on
* both targets (both targets ARE the JVM; commonMain just cannot spell
* `java.security`). Behaviour (CSPRNG backing, draw distribution) is
* exactly the pre-M4 `SecureRandom()` field it replaces.
*/
private val secureRandom = SecureRandom()
internal actual fun secureRandomInt(bound: Int): Int = secureRandom.nextInt(bound)
@@ -1,255 +0,0 @@
package org.incido.compose.ui.drawer
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Home
import androidx.compose.material.icons.filled.LabelOff
import androidx.compose.material.icons.filled.Check
import androidx.compose.material.icons.filled.Delete
import androidx.compose.material.icons.filled.Drafts
import androidx.compose.material.icons.filled.Settings
import androidx.compose.material.icons.filled.Star
import androidx.compose.material.icons.filled.Tag
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.ModalDrawerSheet
import androidx.compose.material3.NavigationDrawerItem
import androidx.compose.material3.NavigationDrawerItemDefaults
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import androidx.lifecycle.viewmodel.compose.viewModel
import org.incido.compose.di.requireAppGraph
import org.incido.compose.ui.theme.AllNoteColors
import org.incido.compose.ui.theme.toComposeColor
import org.incido.domain.model.HashtagUsage
import org.incido.domain.model.NoteColor
import org.incido.domain.model.NoteFilter
/**
* Left-side navigation drawer. Top section has the fixed entries
* (Home / Favorites / the colour-swatch strip / Drafts / Untagged /
* Trash / Settings); a `HorizontalDivider`; then
* a live scrollable list of the user's most-recently-used hashtags.
*
* Tapping a filter entry calls [onSelectFilter]; tapping Settings
* calls [onOpenSettings]. The caller (root) is responsible for closing
* the drawer.
*
* v0.3.2.0 — Settings is a new entry directly underneath "Untagged"
* with its own divider for visual separation.
*
* Colour filters sit between "Favorites" and "Drafts" as one
* horizontal strip of swatches — the colours are self-explanatory, so
* there are no labels. Selecting one shows ONLY active notes of that
* colour — trashed notes never appear, untagged ones do (see
* NoteFilter.ByColor); tapping the selected swatch again returns to
* Home.
*
* "Drafts" lists auto-saved new notes (see Note.isDraft) — a new note
* is persisted automatically while it is being written.
*/
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun IncidoDrawer(
currentFilter: NoteFilter,
onSelectFilter: (NoteFilter) -> Unit,
onOpenSettings: () -> Unit,
modifier: Modifier = Modifier,
viewModel: DrawerViewModel = viewModel(factory = DrawerViewModel.factory(requireAppGraph())),
) {
val recent by viewModel.recentHashtags.collectAsStateWithLifecycle()
ModalDrawerSheet(modifier = modifier) {
Column(
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = 16.dp, vertical = 12.dp),
) {
Text(
text = "Incido",
style = MaterialTheme.typography.headlineSmall,
color = MaterialTheme.colorScheme.primary,
fontWeight = FontWeight.SemiBold,
modifier = Modifier.padding(start = 12.dp, top = 4.dp, bottom = 16.dp),
)
NavigationDrawerItem(
label = { Text("Home") },
selected = currentFilter == NoteFilter.Home,
onClick = { onSelectFilter(NoteFilter.Home) },
icon = { Icon(Icons.Filled.Home, contentDescription = null) },
)
NavigationDrawerItem(
label = { Text("Favorites") },
selected = currentFilter == NoteFilter.Favorites,
onClick = { onSelectFilter(NoteFilter.Favorites) },
icon = { Icon(Icons.Filled.Star, contentDescription = null) },
)
// Colour filters: one horizontal strip of swatches under
// Favorites (NONE is not offered; the colours are
// self-explanatory, so there are no labels). Each shows
// ONLY active notes of that colour — trashed notes never
// appear, untagged ones do. Tapping the selected swatch
// again returns to Home.
Row(
modifier = Modifier
.fillMaxWidth()
.padding(vertical = 6.dp),
horizontalArrangement = Arrangement.spacedBy(
space = 14.dp,
alignment = Alignment.CenterHorizontally,
),
) {
AllNoteColors.filter { it != NoteColor.NONE }.forEach { color ->
val selected = currentFilter == NoteFilter.ByColor(color)
Box(
modifier = Modifier
.size(30.dp)
.clip(CircleShape)
.background(color.toComposeColor())
.then(
if (selected) {
Modifier.border(
width = 3.dp,
color = MaterialTheme.colorScheme.onSurface,
shape = CircleShape,
)
} else {
Modifier
},
)
.clickable {
onSelectFilter(
if (selected) NoteFilter.Home
else NoteFilter.ByColor(color),
)
},
contentAlignment = Alignment.Center,
) {
if (selected) {
Icon(
Icons.Filled.Check,
contentDescription = "${color.label} filter selected",
modifier = Modifier.size(16.dp),
tint = Color.White,
)
}
}
}
}
NavigationDrawerItem(
label = { Text("Drafts") },
selected = currentFilter == NoteFilter.Drafts,
onClick = { onSelectFilter(NoteFilter.Drafts) },
icon = { Icon(Icons.Filled.Drafts, contentDescription = null) },
)
NavigationDrawerItem(
label = { Text("Untagged") },
selected = currentFilter == NoteFilter.Untagged,
onClick = { onSelectFilter(NoteFilter.Untagged) },
icon = { Icon(Icons.Filled.LabelOff, contentDescription = null) },
)
NavigationDrawerItem(
label = { Text("Trash") },
selected = currentFilter == NoteFilter.Trash,
onClick = { onSelectFilter(NoteFilter.Trash) },
icon = { Icon(Icons.Filled.Delete, contentDescription = null) },
)
HorizontalDivider(modifier = Modifier.padding(vertical = 12.dp))
// v0.3.2.0: Settings lives directly underneath Untagged,
// separated by its own divider so the recent-tags section
// below stays grouped.
NavigationDrawerItem(
label = { Text("Settings") },
selected = false,
onClick = onOpenSettings,
icon = { Icon(Icons.Filled.Settings, contentDescription = null) },
)
HorizontalDivider(modifier = Modifier.padding(vertical = 12.dp))
Text(
text = "Recent tags",
style = MaterialTheme.typography.labelLarge,
color = MaterialTheme.colorScheme.onSurfaceVariant,
modifier = Modifier.padding(start = 12.dp, bottom = 4.dp),
)
if (recent.isEmpty()) {
Text(
text = "No tags yet — add some from the editor.",
style = MaterialTheme.typography.bodyMedium,
color = MaterialTheme.colorScheme.onSurfaceVariant,
modifier = Modifier.padding(horizontal = 12.dp, vertical = 8.dp),
)
} else {
Column(
modifier = Modifier
.fillMaxWidth()
// weight(1f) caps this list at the remaining
// sheet height so long tag lists scroll inside
// the drawer instead of overflowing the bottom.
.weight(1f)
.verticalScroll(rememberScrollState()),
verticalArrangement = Arrangement.spacedBy(2.dp),
) {
recent.forEach { usage ->
DrawerHashtagEntry(
usage = usage,
selected = currentFilter == NoteFilter.ByTag(usage.name),
onClick = { onSelectFilter(NoteFilter.ByTag(usage.name)) },
)
}
}
}
Spacer(modifier = Modifier.height(16.dp))
}
}
}
@OptIn(ExperimentalMaterial3Api::class)
@Composable
private fun DrawerHashtagEntry(
usage: HashtagUsage,
selected: Boolean,
onClick: () -> Unit,
) {
NavigationDrawerItem(
label = { Text("#${usage.name}") },
badge = {
val n = usage.noteCount
val label = if (n == 1) "1 note" else "$n notes"
Text(label, style = MaterialTheme.typography.labelSmall, color = MaterialTheme.colorScheme.onSurfaceVariant)
},
selected = selected,
onClick = onClick,
icon = { Icon(Icons.Filled.Tag, contentDescription = null) },
)
}
@@ -1,278 +0,0 @@
package org.incido.compose.ui.settings
import android.content.ClipData
import android.content.ClipboardManager
import android.content.Context
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.ContentCopy
import androidx.compose.material.icons.filled.Refresh
import androidx.compose.material.icons.filled.Visibility
import androidx.compose.material.icons.filled.VisibilityOff
import androidx.compose.material3.AlertDialog
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.OutlinedTextField
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.text.input.PasswordVisualTransformation
import androidx.compose.ui.text.input.VisualTransformation
import androidx.compose.ui.unit.dp
import androidx.compose.foundation.text.KeyboardOptions
import org.incido.compose.data.backup.PassphraseGenerator
import org.incido.compose.data.settings.PasswordPolicy
/**
* v0.3.2.0: passphrase entry / generation / copy dialog for encrypted
* backups.
*
* Two text fields — passphrase + confirm — with live validation
* feedback. The "Generate" button fills both fields with a fresh
* SecureRandom passphrase that satisfies [PasswordPolicy]. The
* "Copy" button pushes the current value onto the system clipboard.
*
* The OK button is enabled only when both fields match **and** the
* value passes the policy. The user can dismiss at any time.
*
* v0.3.3.0: [mode] switches between EXPORT (creating a new passphrase)
* and IMPORT (decrypting an existing backup). The title, supporting
* copy, and confirm-button label adapt accordingly.
*
* v0.3.3.1 hotfix: the IMPORT flow now also drops the EXPORT-only
* chrome — the second "Confirm passphrase" field, the "Generate" /
* "Copy" trailing-icon buttons, and the live password-policy check
* are all suppressed in IMPORT mode. An existing passphrase may
* have been created before the current policy was tightened, so
* the encryption round-trip (decrypt-on-preview) is the source of
* truth for "is this passphrase correct", surfaced as
* "Incorrect passphrase." via snackbar on mismatch.
*/
@Composable
fun PassphraseDialog(
onConfirm: (CharArray) -> Unit,
onDismiss: () -> Unit,
mode: PassphraseDialogMode = PassphraseDialogMode.EXPORT,
) {
val context = LocalContext.current
// v0.3.6.0: use the enum helper so RECOVERY_EXPORT shares the
// EXPORT chrome (policy check, Generate/Copy, Confirm field).
val isExport = mode.isExport
var passphrase by remember { mutableStateOf("") }
var confirm by remember { mutableStateOf("") }
var revealed by remember { mutableStateOf(false) }
var copied by remember { mutableStateOf(false) }
// v0.3.3.1 hotfix: IMPORT mode only needs a single passphrase
// field — skip the password policy check because an existing
// passphrase (created before the policy was tightened) might
// not satisfy it. The encryption round-trip is the source of
// truth: if the passphrase is wrong, the decrypt / preview step
// surfaces "Incorrect passphrase." via the snackbar.
val validation = remember(passphrase, isExport) {
if (isExport) {
PasswordPolicy.validate(passphrase)
} else {
// Empty failure set — `isValid == true`, but the UI
// never enters this branch for IMPORT (we don't render
// the policy failure list / isError state there).
PasswordPolicy.Validation(failures = emptySet())
}
}
val matches = passphrase.isNotEmpty() && passphrase == confirm
val canConfirm = if (isExport) {
validation.isValid && matches
} else {
passphrase.isNotEmpty()
}
// Reset the "copied" hint after a few seconds.
LaunchedEffect(copied) {
if (copied) {
kotlinx.coroutines.delay(2000)
copied = false
}
}
// v0.3.6.0: the recovery-key flows reuse this dialog but get
// their own titles / copy so the user knows they're protecting
// the encryption key, not a note backup.
val title = when (mode) {
PassphraseDialogMode.EXPORT -> "Encrypt backup"
PassphraseDialogMode.IMPORT -> "Decrypt backup"
PassphraseDialogMode.RECOVERY_EXPORT -> "Protect recovery key"
PassphraseDialogMode.RECOVERY_IMPORT -> "Unlock recovery key"
}
val intro = when (mode) {
PassphraseDialogMode.EXPORT ->
"Choose a passphrase to protect this backup. " +
"You'll need it again to restore. Lost passphrases " +
"cannot be recovered."
PassphraseDialogMode.IMPORT ->
"Enter the passphrase you used when this backup was created. " +
"Lost passphrases cannot be recovered."
PassphraseDialogMode.RECOVERY_EXPORT ->
"Choose a passphrase to protect your encryption key. " +
"You'll need this passphrase AND the exported file to " +
"restore the key on another device. Store them in " +
"separate safe places."
PassphraseDialogMode.RECOVERY_IMPORT ->
"Enter the passphrase you used when you exported this " +
"recovery key. Lost passphrases cannot be recovered."
}
val confirmLabel = when (mode) {
PassphraseDialogMode.EXPORT -> "Encrypt & export"
PassphraseDialogMode.RECOVERY_EXPORT -> "Encrypt & export"
else -> "Continue"
}
AlertDialog(
onDismissRequest = onDismiss,
title = { Text(title) },
text = {
Column(modifier = Modifier.fillMaxWidth()) {
Text(
text = intro,
style = MaterialTheme.typography.bodyMedium,
color = MaterialTheme.colorScheme.onSurfaceVariant,
)
Spacer(Modifier.padding(top = 12.dp))
OutlinedTextField(
value = passphrase,
onValueChange = { passphrase = it; confirm = "" },
label = { Text("Passphrase") },
singleLine = true,
visualTransformation = if (revealed) VisualTransformation.None else PasswordVisualTransformation(),
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Password),
// v0.3.3.1 hotfix: IMPORT mode renders only the
// visibility toggle — Generate / Copy are
// nonsensical for an existing passphrase.
trailingIcon = {
Row {
IconButton(onClick = { revealed = !revealed }) {
Icon(
imageVector = if (revealed) Icons.Filled.VisibilityOff else Icons.Filled.Visibility,
contentDescription = if (revealed) "Hide" else "Show",
)
}
if (isExport) {
IconButton(onClick = {
passphrase = PassphraseGenerator.generate()
confirm = passphrase
copied = false
}) {
Icon(Icons.Filled.Refresh, contentDescription = "Generate")
}
IconButton(onClick = {
copyToClipboard(context, passphrase)
copied = true
}) {
Icon(Icons.Filled.ContentCopy, contentDescription = "Copy")
}
}
}
},
isError = passphrase.isNotEmpty() && !validation.isValid,
modifier = Modifier.fillMaxWidth(),
)
if (isExport && passphrase.isNotEmpty() && !validation.isValid) {
Spacer(Modifier.padding(top = 4.dp))
validation.failures.forEach { failure ->
Text(
text = PasswordPolicy.describe(failure),
style = MaterialTheme.typography.labelSmall,
color = MaterialTheme.colorScheme.error,
)
}
}
if (copied) {
Spacer(Modifier.padding(top = 4.dp))
Text(
text = "Copied to clipboard.",
style = MaterialTheme.typography.labelSmall,
color = MaterialTheme.colorScheme.primary,
)
}
if (isExport) {
// v0.3.3.1 hotfix: Confirm passphrase field is
// EXPORT-only — IMPORT only needs a single field.
Spacer(Modifier.padding(top = 12.dp))
OutlinedTextField(
value = confirm,
onValueChange = { confirm = it },
label = { Text("Confirm passphrase") },
singleLine = true,
visualTransformation = if (revealed) VisualTransformation.None else PasswordVisualTransformation(),
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Password),
isError = confirm.isNotEmpty() && !matches,
supportingText = {
if (confirm.isNotEmpty() && !matches) {
Text("Passphrases don't match.")
} else {
Text(
"${PasswordPolicy.MIN_LENGTH}–${PasswordPolicy.MAX_LENGTH} chars, " +
"with at least one digit and one special character.",
style = MaterialTheme.typography.labelSmall,
)
}
},
modifier = Modifier.fillMaxWidth(),
)
}
}
},
confirmButton = {
TextButton(
onClick = {
onConfirm(passphrase.toCharArray())
passphrase = ""
confirm = ""
},
enabled = canConfirm,
) { Text(confirmLabel) }
},
dismissButton = {
TextButton(onClick = onDismiss) { Text("Cancel") }
},
)
}
/**
* v0.3.3.0: which flow is requesting a passphrase. The EXPORT /
* IMPORT pair covers the encrypted backup flows; v0.3.6.0 adds the
* RECOVERY_EXPORT / RECOVERY_IMPORT pair for the at-rest key
* recovery file (UI is the same — [PassphraseDialog] just looks at
* the EXPORT vs IMPORT flag and shows the policy / Generate / Copy
* chrome accordingly).
*/
enum class PassphraseDialogMode {
EXPORT, IMPORT,
RECOVERY_EXPORT, RECOVERY_IMPORT,
;
/** True for the EXPORT-mode chrome (Generate / Copy / Confirm /
* password-policy check). Import variants skip those because
* an existing passphrase may predate the current policy. */
val isExport: Boolean get() = this == EXPORT || this == RECOVERY_EXPORT
}
private fun copyToClipboard(context: Context, value: String) {
if (value.isEmpty()) return
val cm = context.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
cm.setPrimaryClip(ClipData.newPlainText("Incido backup passphrase", value))
}
@@ -1,87 +0,0 @@
package org.incido.compose.ui.settings
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.heightIn
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.AlertDialog
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
import org.incido.compose.data.settings.ReleaseNote
import org.incido.compose.data.settings.ReleaseNotes
/**
* v0.3.2.0: scrollable list of the 5 most recent release notes.
*
* Shown when the user taps the version number on the settings screen.
* The dialog body is a vertical scroll so a future bump to 10 entries
* still fits comfortably on small screens.
*/
@Composable
fun ReleaseNotesDialog(onDismiss: () -> Unit) {
AlertDialog(
onDismissRequest = onDismiss,
title = { Text("What's new") },
text = {
Column(
modifier = Modifier
.fillMaxWidth()
.heightIn(max = 480.dp)
.verticalScroll(rememberScrollState()),
) {
ReleaseNotes.RECENT.forEachIndexed { index, note ->
ReleaseNoteCard(note)
if (index < ReleaseNotes.RECENT.lastIndex) {
HorizontalDivider(modifier = Modifier.padding(vertical = 12.dp))
}
}
}
},
confirmButton = {
TextButton(onClick = onDismiss) { Text("Close") }
},
)
}
@Composable
private fun ReleaseNoteCard(note: ReleaseNote) {
Column(modifier = Modifier.fillMaxWidth()) {
Text(
text = "v${note.version}",
style = MaterialTheme.typography.titleMedium,
fontWeight = FontWeight.SemiBold,
color = MaterialTheme.colorScheme.primary,
)
Text(
text = note.date,
style = MaterialTheme.typography.labelSmall,
color = MaterialTheme.colorScheme.onSurfaceVariant,
)
Spacer(Modifier.padding(top = 6.dp))
Column(verticalArrangement = Arrangement.spacedBy(4.dp)) {
note.bullets.forEach { bullet ->
BulletRow(bullet)
}
}
}
}
@Composable
private fun BulletRow(text: String) {
// Plain Text with manual bullet glyph — keeps it lightweight and
// avoids a nested Row + Icon for every entry.
Text(
text = "• $text",
style = MaterialTheme.typography.bodyMedium,
)
}