Skip to content

Commit

Permalink
Merge pull request #304 from janiceferns02/bugfix/dark-mode-button-in…
Browse files Browse the repository at this point in the history
…itial-state

Fix initial state (on app install) of dark mode toggle.
  • Loading branch information
andrewtavis authored Jan 25, 2025
2 parents db94d03 + 780177d commit 518a9f1
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions app/src/main/java/be/scri/helpers/PreferencesHelper.kt
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@ object PreferencesHelper {
val uiModeManager = context.getSystemService(UI_MODE_SERVICE) as UiModeManager
val isSystemDarkTheme = uiModeManager.nightMode == UiModeManager.MODE_NIGHT_YES
val isUserDarkMode = sharedPref.getBoolean("dark_mode", isSystemDarkTheme)
if (!sharedPref.contains("dark_mode")) {
setLightDarkModePreference(context, isUserDarkMode)
}
return if (isUserDarkMode) {
AppCompatDelegate.MODE_NIGHT_YES
} else {
Expand Down

0 comments on commit 518a9f1

Please sign in to comment.