Merge pull request #3110 from element-hq/fix/jme/session-verification-state-with-no-network

Fix incorrect 'device verified' screen when app was opened with no network connection
This commit is contained in:
Benoit Marty 2024-07-01 11:09:24 +02:00 committed by GitHub
commit 1419703059
2 changed files with 45 additions and 12 deletions

View file

@ -119,8 +119,14 @@ class DefaultFtueService @Inject constructor(
emit(SessionVerifiedStatus.NotVerified)
}
.first()
val skipVerification = suspend { sessionPreferencesStore.isSessionVerificationSkipped().first() }
return readyVerifiedSessionStatus == SessionVerifiedStatus.NotVerified && !skipVerification()
// For some obscure reason we need to call this *before* we check the `readyVerifiedSessionStatus`, otherwise there's a deadlock
// It seems like a DataStore bug
val skipVerification = canSkipVerification()
return readyVerifiedSessionStatus == SessionVerifiedStatus.NotVerified && !skipVerification
}
private suspend fun canSkipVerification(): Boolean {
return sessionPreferencesStore.isSessionVerificationSkipped().first()
}
private suspend fun needsAnalyticsOptIn(): Boolean {