SettingsRepository

@Singleton
class SettingsRepository @Inject constructor(context: Context)

Reactive repository for application settings backed by SharedPreferences.

Exposes a StateFlow of AppSettings and applies atomic read-modify-write updates. Also tracks the timestamp of the last key export for backup reminders.

Constructors

Link copied to clipboard
@Inject
constructor(context: Context)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
val settings: StateFlow<AppSettings>

Functions

Link copied to clipboard

Returns the current settings snapshot without subscribing to updates.

Link copied to clipboard
Link copied to clipboard

Records the current time as the last successful key export.

Link copied to clipboard
fun update(transform: (AppSettings) -> AppSettings)

Atomically updates settings: applies transform, persists to disk, and emits the new value.