Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e1859f9c authored by Ale Nijamkin's avatar Ale Nijamkin Committed by Android (Google) Code Review
Browse files

Merge "[flexiglass] destinationScenes a stable flow." into main

parents d4d75ae1 eacba4ed
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -82,7 +82,7 @@ constructor(
) : ComposableScene {
    override val key = SceneKey.Bouncer

    override fun destinationScenes(): StateFlow<Map<UserAction, SceneModel>> =
    override val destinationScenes: StateFlow<Map<UserAction, SceneModel>> =
        MutableStateFlow(
                mapOf(
                    UserAction.Back to SceneModel(SceneKey.Lockscreen),
+2 −2
Original line number Diff line number Diff line
@@ -66,13 +66,13 @@ constructor(
) : ComposableScene {
    override val key = SceneKey.Lockscreen

    override fun destinationScenes(): StateFlow<Map<UserAction, SceneModel>> =
    override val destinationScenes: StateFlow<Map<UserAction, SceneModel>> =
        viewModel.upDestinationSceneKey
            .map { pageKey -> destinationScenes(up = pageKey) }
            .stateIn(
                scope = applicationScope,
                started = SharingStarted.Eagerly,
                initialValue = destinationScenes(up = null)
                initialValue = destinationScenes(up = viewModel.upDestinationSceneKey.value)
            )

    @Composable
+2 −1
Original line number Diff line number Diff line
@@ -58,13 +58,14 @@ constructor(
) : ComposableScene {
    override val key = SceneKey.QuickSettings

    override fun destinationScenes(): StateFlow<Map<UserAction, SceneModel>> =
    private val _destinationScenes =
        MutableStateFlow<Map<UserAction, SceneModel>>(
                mapOf(
                    UserAction.Swipe(Direction.UP) to SceneModel(SceneKey.Shade),
                )
            )
            .asStateFlow()
    override val destinationScenes: StateFlow<Map<UserAction, SceneModel>> = _destinationScenes

    @Composable
    override fun SceneScope.Content(
+1 −1
Original line number Diff line number Diff line
@@ -38,7 +38,7 @@ import kotlinx.coroutines.flow.asStateFlow
class GoneScene @Inject constructor() : ComposableScene {
    override val key = SceneKey.Gone

    override fun destinationScenes(): StateFlow<Map<UserAction, SceneModel>> =
    override val destinationScenes: StateFlow<Map<UserAction, SceneModel>> =
        MutableStateFlow<Map<UserAction, SceneModel>>(
                mapOf(
                    UserAction.Swipe(Direction.DOWN) to SceneModel(SceneKey.Shade),
+2 −2
Original line number Diff line number Diff line
@@ -79,7 +79,7 @@ fun SceneContainer(
    val currentSceneKey = currentSceneModel.key
    val currentScene = checkNotNull(sceneByKey[currentSceneKey])
    val currentDestinations: Map<UserAction, SceneModel> by
        currentScene.destinationScenes().collectAsState()
        currentScene.destinationScenes.collectAsState()
    val state = remember { SceneTransitionLayoutState(currentSceneKey.toTransitionSceneKey()) }
    val isRibbonEnabled = remember { SystemProperties.getBoolean("flexi.ribbon", false) }

@@ -116,7 +116,7 @@ fun SceneContainer(
                        if (sceneKey == currentSceneKey) {
                                currentDestinations
                            } else {
                                composableScene.destinationScenes().value
                                composableScene.destinationScenes.value
                            }
                            .map { (userAction, destinationSceneModel) ->
                                toTransitionModels(userAction, destinationSceneModel)
Loading