Fix session verification incorrectly displaying as 'not verified' when the user opened the app with no network connection.
It turns out `encryptionService.verificationState()` runs a network request that will cause a deadlock when it fails. Also fixed another deadlock that caused the screen to remain blank sometimes after logging in, because DataStore got stuck when checking the `skipVerification` state for some reason I don't fully understand.
This commit is contained in:
parent
a7a2b4727f
commit
16545ce60e
2 changed files with 45 additions and 12 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue