AppSettingsManager

Manager for application settings stored in a JSON file. Handles loading, saving, and applying settings like language.

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard
private val _settings: MutableStateFlow<AppSettings>
Link copied to clipboard

Currently active settings.

Link copied to clipboard
private val json: Json
Link copied to clipboard
val settings: StateFlow<AppSettings>

Observable settings. Collect this in composables that must react to a change without an app restart (e.g. the light/dark theme mode).

Link copied to clipboard
private val settingsFile: File

Functions

Link copied to clipboard

Applies current settings to the application state (e.g. updates Tr.currentLanguage).

Link copied to clipboard
private fun loadSettings(): AppSettings
Link copied to clipboard
private fun saveSettings(settings: AppSettings)
Link copied to clipboard
fun updateSettings(newSettings: AppSettings)

Updates settings, saves them to file, and applies changes (like language).