From ce501fd36389ded62e9901daac21b9fc29b31b23 Mon Sep 17 00:00:00 2001 From: bemusementpark Date: Tue, 30 Jul 2024 00:19:16 +0930 Subject: [PATCH] Move invalidateComposeThemeColors() --- .../preferences/appearance/AppearanceSettingsViewModel.kt | 7 +------ .../java/org/thoughtcrime/securesms/ui/theme/Themes.kt | 5 +++++ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/org/thoughtcrime/securesms/preferences/appearance/AppearanceSettingsViewModel.kt b/app/src/main/java/org/thoughtcrime/securesms/preferences/appearance/AppearanceSettingsViewModel.kt index 47cc9f69bf..2547e23e22 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/preferences/appearance/AppearanceSettingsViewModel.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/preferences/appearance/AppearanceSettingsViewModel.kt @@ -6,7 +6,7 @@ import dagger.hilt.android.lifecycle.HiltViewModel import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.StateFlow import org.session.libsession.utilities.TextSecurePreferences -import org.thoughtcrime.securesms.ui.theme.cachedColorsProvider +import org.thoughtcrime.securesms.ui.theme.invalidateComposeThemeColors import org.thoughtcrime.securesms.util.ThemeState import org.thoughtcrime.securesms.util.themeState import javax.inject.Inject @@ -17,11 +17,6 @@ class AppearanceSettingsViewModel @Inject constructor(private val prefs: TextSec private val _uiState = MutableStateFlow(prefs.themeState()) val uiState: StateFlow = _uiState - fun invalidateComposeThemeColors() { - // invalidate compose theme colors - cachedColorsProvider = null - } - fun setNewAccent(@StyleRes newAccentColorStyle: Int) { prefs.setAccentColorStyle(newAccentColorStyle) // update UI state diff --git a/app/src/main/java/org/thoughtcrime/securesms/ui/theme/Themes.kt b/app/src/main/java/org/thoughtcrime/securesms/ui/theme/Themes.kt index 9b83028ec8..2f4957565b 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/ui/theme/Themes.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/ui/theme/Themes.kt @@ -22,6 +22,11 @@ val LocalType = compositionLocalOf { sessionTypography } var cachedColorsProvider: ThemeColorsProvider? = null +fun invalidateComposeThemeColors() { + // invalidate compose theme colors + cachedColorsProvider = null +} + /** * Apply a Material2 compose theme based on user selections in SharedPreferences. */