SettingsRepository

Repository for the settings.

Properties

Link copied to clipboard
val isDarkTheme: StateFlow<Boolean>
Link copied to clipboard
val isFahrenheit: StateFlow<Boolean>
Link copied to clipboard
val isInches: StateFlow<Boolean>
Link copied to clipboard
val isMiles: StateFlow<Boolean>
Link copied to clipboard
Link copied to clipboard

Access the list of available locales.

Link copied to clipboard
val selectedLocale: StateFlow<Locale>

Functions

Link copied to clipboard
fun fetchOldLocation(weatherVm: WeatherViewModel, scope: CoroutineScope)

Fetch the weather for the old location.

Link copied to clipboard
fun initialize(preferences: SharedPreferences)

Initialize the settings repository. Loads the settings from the shared preferences. If the settings are not found, it uses the default.

Link copied to clipboard
fun reloadConfig(context: Context)

Reload the configuration. Reloads the config so all the changes are applied.

Link copied to clipboard
fun setDarkTheme(isDarkTheme: Boolean)

Set the dark theme setting.

Link copied to clipboard
fun setFahrenheit(isFahrenheit: Boolean)

Set the temperature unit setting.

Link copied to clipboard
fun setInches(isInches: Boolean)

Set the inches/millis setting.

Link copied to clipboard

Set the last location. Used when app first starts to show the last location.

Link copied to clipboard
fun setLastWeather(weatherData: WeatherData)

Set the last weather. Used when app first starts to show the last weather.

Link copied to clipboard
fun setLocale(locale: Locale)

Set the locale setting.

Link copied to clipboard
fun setMiles(isMiles: Boolean)