From fca830027c435ec23684c2eb6f4d544805f7e878 Mon Sep 17 00:00:00 2001 From: s-ayush2903 Date: Mon, 20 Jul 2020 00:59:40 +0530 Subject: [PATCH] Implemented Safe Call on Night Mode Toggle --- .../org/kiwix/kiwixmobile/core/utils/SharedPreferenceUtil.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/org/kiwix/kiwixmobile/core/utils/SharedPreferenceUtil.kt b/core/src/main/java/org/kiwix/kiwixmobile/core/utils/SharedPreferenceUtil.kt index fc3dc5807..25b5ea993 100644 --- a/core/src/main/java/org/kiwix/kiwixmobile/core/utils/SharedPreferenceUtil.kt +++ b/core/src/main/java/org/kiwix/kiwixmobile/core/utils/SharedPreferenceUtil.kt @@ -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 = nightModes.startWith(nightMode)