Move invalidateComposeThemeColors()

This commit is contained in:
bemusementpark 2024-07-30 00:19:16 +09:30
parent 447ea85333
commit ce501fd363
2 changed files with 6 additions and 6 deletions

View File

@ -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<ThemeState> = _uiState
fun invalidateComposeThemeColors() {
// invalidate compose theme colors
cachedColorsProvider = null
}
fun setNewAccent(@StyleRes newAccentColorStyle: Int) {
prefs.setAccentColorStyle(newAccentColorStyle)
// update UI state

View File

@ -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.
*/