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:
Tamim Hossain
2024-11-18 17:26:00 +06:00
committed by GitHub
parent 41893d79c0
commit 2626462e49
3 changed files with 3 additions and 3 deletions
@@ -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()
}
}
}