Skip to content

Commit dcec958

Browse files
committed
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.
1 parent f9d8c9a commit dcec958

File tree

1 file changed

+0
-13
lines changed

1 file changed

+0
-13
lines changed

features/ftue/impl/src/main/kotlin/io/element/android/features/ftue/impl/state/DefaultFtueService.kt

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,8 @@ import kotlinx.coroutines.CoroutineScope
2828
import kotlinx.coroutines.flow.MutableStateFlow
2929
import kotlinx.coroutines.flow.combine
3030
import kotlinx.coroutines.flow.distinctUntilChanged
31-
import kotlinx.coroutines.flow.filter
3231
import kotlinx.coroutines.flow.first
3332
import kotlinx.coroutines.flow.launchIn
34-
import kotlinx.coroutines.flow.map
3533
import kotlinx.coroutines.flow.onEach
3634
import kotlinx.coroutines.launch
3735

@@ -60,14 +58,6 @@ class DefaultFtueService(
6058
}
6159
}
6260

63-
/**
64-
* This flow emits true when the FTUE flow is ready to be displayed.
65-
* In this case, the FTUE flow is ready when the session verification status is known.
66-
*/
67-
val isVerificationStatusKnown = sessionVerificationService.sessionVerifiedStatus
68-
.map { it != SessionVerifiedStatus.Unknown }
69-
.distinctUntilChanged()
70-
7161
override suspend fun reset() {
7262
analyticsService.reset()
7363
if (sdkVersionProvider.isAtLeast(Build.VERSION_CODES.TIRAMISU)) {
@@ -134,9 +124,6 @@ class DefaultFtueService(
134124
}
135125

136126
private suspend fun isSessionNotVerified(): Boolean {
137-
// Wait until the session verification status is known
138-
isVerificationStatusKnown.filter { it }.first()
139-
140127
return sessionVerificationService.sessionVerifiedStatus.value == SessionVerifiedStatus.NotVerified && !canSkipVerification()
141128
}
142129

0 commit comments

Comments
 (0)