Implemented Safe Call on Night Mode Toggle

This commit is contained in:
s-ayush2903 2020-07-20 00:59:40 +05:30
parent e2bc5b8352
commit fca830027c
No known key found for this signature in database
GPG Key ID: B4341DD08B2371CB

View File

@ -127,7 +127,8 @@ class SharedPreferenceUtil @Inject constructor(context: Context?) {
val nightMode: NightModeConfig.Mode
get() = from(
sharedPreferences.getString("", null)?.toInt() ?: AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM
sharedPreferences.getString(PREF_NIGHT_MODE, null)?.toInt()
?: AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM
)
fun nightModes(): Flowable<NightModeConfig.Mode> = nightModes.startWith(nightMode)