mirror of
https://github.com/openlibrecommunity/olcng.git
synced 2026-07-03 14:05:17 +02:00
Remove unnecessary Context parameter from setNightMode (#3971)
Refactored the `setNightMode` function to remove the unused `Context` parameter. Changes: - Eliminated the `context` parameter from the `setNightMode` function. - Adjusted function signature to align with the current implementation, which does not utilize the `Context`. This simplifies the function interface and ensures cleaner, more maintainable code.
This commit is contained in:
@@ -37,7 +37,7 @@ class AngApplication : MultiDexApplication() {
|
||||
|
||||
MMKV.initialize(this)
|
||||
|
||||
Utils.setNightMode(application)
|
||||
Utils.setNightMode()
|
||||
// Initialize WorkManager with the custom configuration
|
||||
WorkManager.initialize(this, workManagerConfiguration)
|
||||
|
||||
|
||||
@@ -396,7 +396,7 @@ object Utils {
|
||||
}
|
||||
|
||||
|
||||
fun setNightMode(context: Context) {
|
||||
fun setNightMode() {
|
||||
when (MmkvManager.decodeSettingsString(AppConfig.PREF_UI_MODE_NIGHT, "0")) {
|
||||
"0" -> AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM)
|
||||
"1" -> AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO)
|
||||
|
||||
@@ -81,7 +81,7 @@ class SettingsViewModel(application: Application) : AndroidViewModel(application
|
||||
// }
|
||||
}
|
||||
if (key == AppConfig.PREF_UI_MODE_NIGHT) {
|
||||
Utils.setNightMode(getApplication())
|
||||
Utils.setNightMode()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user