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

Commit 6de11885 authored by Ale Nijamkin's avatar Ale Nijamkin
Browse files

[flexiglass] Lazy init canSwipeToEnter

Blind attempt to fix the attached bug.

Bug: 357966562
Change-Id: I3b58f3abd80395f86118ea81f9ae79cb6d1acb76
Flag: NONE this seems unflagged by nature so fixing it in an unflagged way
Test: manually verified that the device can lock and unlock
parent 47c54dc7
Loading
Loading
Loading
Loading
+13 −9
Original line number Diff line number Diff line
@@ -119,15 +119,18 @@ constructor(
     * Note: `true` doesn't mean the lockscreen is visible. It may be occluded or covered by other
     * UI.
     */
    val canSwipeToEnter: StateFlow<Boolean?> =
    val canSwipeToEnter: StateFlow<Boolean?> by lazy {
        combine(
                authenticationInteractor.authenticationMethod.map {
                    it == AuthenticationMethodModel.None
                },
                isLockscreenEnabled,
                deviceUnlockedInteractor.deviceUnlockStatus,
                isDeviceEntered
            ) { isNoneAuthMethod, isLockscreenEnabled, deviceUnlockStatus, isDeviceEntered ->
                isDeviceEntered) {
                    isNoneAuthMethod,
                    isLockscreenEnabled,
                    deviceUnlockStatus,
                    isDeviceEntered ->
                    val isSwipeAuthMethod = isNoneAuthMethod && isLockscreenEnabled
                    (isSwipeAuthMethod ||
                        (deviceUnlockStatus.isUnlocked &&
@@ -142,6 +145,7 @@ constructor(
                // from upstream data sources.
                initialValue = null,
            )
    }

    /**
     * Attempt to enter the device and dismiss the lockscreen. If authentication is required to