Only update color scheme after color picker has been closed

This commit is contained in:
MM20
2023-08-23 21:25:17 +02:00
parent bf9035bb2c
commit ebee33ecf0
3 changed files with 44 additions and 47 deletions
@@ -10,6 +10,7 @@ import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.combine
import kotlinx.coroutines.flow.flowOf
import kotlinx.coroutines.flow.flowOn
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.launch
import java.util.UUID
@@ -29,7 +30,7 @@ class ThemeRepository(
fun getTheme(id: UUID): Flow<Theme?> {
if (id == DefaultThemeId) return flowOf(getDefaultTheme())
if (id == BlackAndWhiteThemeId) return flowOf(getBlackAndWhiteTheme())
return database.themeDao().get(id).map { it?.let { Theme(it) } }
return database.themeDao().get(id).map { it?.let { Theme(it) } }.flowOn(Dispatchers.Default)
}
fun createTheme(theme: Theme) {