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 duressConfigured: Boolean = false,30    val shortcuts: Map<String, ShortcutBinding> = emptyMap(),31    val allowScreenshots: Boolean = false,32)3334internal const val CURRENT_FAVICON_CONSENT_VERSION = 13536/** Network-backed site icons are enabled only after consent to the current disclosure. */37fun faviconsAllowed(settings: VaultSettings): Boolean =38    settings.faviconsEnabled && settings.faviconConsentVersion >= CURRENT_FAVICON_CONSENT_VERSION3940/** Record an explicit acceptance of the current third-party favicon disclosure. */41fun grantCurrentFaviconConsent(settings: VaultSettings): VaultSettings = settings.copy(42    faviconsEnabled = true,43    faviconConsentVersion = CURRENT_FAVICON_CONSENT_VERSION,44)4546@Serializable47data class ShortcutBinding(48    val key: String,49    val ctrl: Boolean = false,50    val meta: Boolean = false,51    val shift: Boolean = false,52    val alt: Boolean = false,53)