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

Commit 6019e9d8 authored by Riley Campillo's avatar Riley Campillo
Browse files

Get user switcher actions on the background flow.

Bug: 332061190
Test: UserSwitcherInteractorTest
Flag: NONE
Change-Id: Ic430195499aa1b5d6b465baec88b36e9dee0936b
parent 21f8ea37
Loading
Loading
Loading
Loading
+74 −67
Original line number Diff line number Diff line
@@ -76,6 +76,7 @@ import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.flow.combine
import kotlinx.coroutines.flow.distinctUntilChanged
import kotlinx.coroutines.flow.flowOn
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.onEach
@@ -170,12 +171,14 @@ constructor(
                    keyguardInteractor.isKeyguardShowing,
                ) { _, userInfos, settings, isDeviceLocked ->
                    buildList {
                    val canAccessUserSwitcher = !isDeviceLocked || settings.isAddUsersFromLockscreen
                        val canAccessUserSwitcher =
                            !isDeviceLocked || settings.isAddUsersFromLockscreen
                        if (canAccessUserSwitcher) {
                            // The device is locked and our setting to allow actions that add users
                            // from the lock-screen is not enabled. We can finish building the list
                            // here.
                        val isFullScreen = featureFlags.isEnabled(Flags.FULL_SCREEN_USER_SWITCHER)
                            val isFullScreen =
                                featureFlags.isEnabled(Flags.FULL_SCREEN_USER_SWITCHER)

                            val actionList: List<UserActionModel> =
                                if (isFullScreen) {
@@ -233,12 +236,16 @@ constructor(
                            }
                        }
                        if (
                        UserActionsUtil.canManageUsers(repository, settings.isUserSwitcherEnabled)
                            UserActionsUtil.canManageUsers(
                                repository,
                                settings.isUserSwitcherEnabled
                            )
                        ) {
                            add(UserActionModel.NAVIGATE_TO_USER_MANAGEMENT)
                        }
                    }
                }
                .flowOn(backgroundDispatcher)

    val userRecords: StateFlow<ArrayList<UserRecord>> =
        combine(