VaultSettings.kt

2.2 KB · raw

1package com.peachpasswords.vault23import kotlinx.serialization.Serializable45@Serializable6data class VaultSettings(7    val accentColor: String = "peach",8    val breachMonitoring: Boolean = true,9    val autoLockMinutes: Int? = null,10    val reduceMotion: Boolean = false,11    /** Browser-parity text size: "small" | "medium" | "large". */12    val textSize: String = "medium",13    /** Large-screen layout sizing: "compact" | "auto" | "large". */14    val uiScale: String = "auto",15    /** U1 site icons in lists; off (default) keeps the cleaner initials-only look. */16    val faviconsEnabled: Boolean = false,17    /** Version of the DuckDuckGo domain-inventory disclosure the user accepted. */18    val faviconConsentVersion: Int = 0,19    val biometricsEnabled: Boolean = false,20    val trashRetentionDays: Int? = null,21    val sortOrder: String = "url-first",22    /** Keyboard chips and suggestion rows show only "Peach" until tapped. */23    val hideAutofillPreviews: Boolean = false,24    // Default-on for new installs (Peach handles passkey sign-in / creation through25    // the Android Credential Manager). Existing users are not migrated: the stored26    // setting is preserved on load, so anyone who explicitly disabled it stays27    // off until they re-enable it in Settings → Passkeys.28    val passkeyProviderEnabled: Boolean = true,29    val shortcuts: Map<String, ShortcutBinding> = emptyMap(),30    val allowScreenshots: Boolean = false,31)3233internal const val CURRENT_FAVICON_CONSENT_VERSION = 13435/** Network-backed site icons are enabled only after consent to the current disclosure. */36fun faviconsAllowed(settings: VaultSettings): Boolean =37    settings.faviconsEnabled && settings.faviconConsentVersion >= CURRENT_FAVICON_CONSENT_VERSION3839/** Record an explicit acceptance of the current third-party favicon disclosure. */40fun grantCurrentFaviconConsent(settings: VaultSettings): VaultSettings = settings.copy(41    faviconsEnabled = true,42    faviconConsentVersion = CURRENT_FAVICON_CONSENT_VERSION,43)4445@Serializable46data class ShortcutBinding(47    val key: String,48    val ctrl: Boolean = false,49    val meta: Boolean = false,50    val shift: Boolean = false,51    val alt: Boolean = false,52)