Simplify the code again.

We do not need `isVerificationStatusKnown`. If `sessionVerificationService.sessionVerifiedStatus` is `Unknown`, `isSessionVerificationStateReady()` will return true and `isSessionNotVerified()` will not be called, since the `ftueState` will be `FtueStep.WaitingForInitialState`.

Note that TU is still OK with this change.
This commit is contained in:
Benoit Marty
2025-09-22 09:34:32 +02:00
parent b2630553b4
commit b1b37b1224

View File

@@ -28,10 +28,8 @@ import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.combine
import kotlinx.coroutines.flow.distinctUntilChanged
import kotlinx.coroutines.flow.filter
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.onEach
import kotlinx.coroutines.launch
@@ -60,14 +58,6 @@ class DefaultFtueService(
}
}
/**
* This flow emits true when the FTUE flow is ready to be displayed.
* In this case, the FTUE flow is ready when the session verification status is known.
*/
val isVerificationStatusKnown = sessionVerificationService.sessionVerifiedStatus
.map { it != SessionVerifiedStatus.Unknown }
.distinctUntilChanged()
override suspend fun reset() {
analyticsService.reset()
if (sdkVersionProvider.isAtLeast(Build.VERSION_CODES.TIRAMISU)) {
@@ -134,9 +124,6 @@ class DefaultFtueService(
}
private suspend fun isSessionNotVerified(): Boolean {
// Wait until the session verification status is known
isVerificationStatusKnown.filter { it }.first()
return sessionVerificationService.sessionVerifiedStatus.value == SessionVerifiedStatus.NotVerified && !canSkipVerification()
}