When clearing cache, ensure that SessionPreferencesStore is removed from the cache.
Fixes blank screen after clear cache. Also cleanup the codebase.
This commit is contained in:
parent
fbe70ddf5d
commit
e48b958d52
4 changed files with 12 additions and 11 deletions
|
|
@ -45,7 +45,7 @@ import io.element.android.libraries.di.SessionScope
|
|||
import io.element.android.services.analytics.api.AnalyticsService
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.flow.StateFlow
|
||||
import kotlinx.coroutines.flow.drop
|
||||
import kotlinx.coroutines.flow.distinctUntilChanged
|
||||
import kotlinx.coroutines.flow.launchIn
|
||||
import kotlinx.coroutines.flow.onEach
|
||||
import kotlinx.coroutines.launch
|
||||
|
|
@ -93,11 +93,9 @@ class FtueFlowNode @AssistedInject constructor(
|
|||
})
|
||||
|
||||
analyticsService.didAskUserConsent()
|
||||
.drop(1) // We only care about consent passing from not asked to asked state
|
||||
.onEach { didAskUserConsent ->
|
||||
if (didAskUserConsent) {
|
||||
lifecycleScope.launch { moveToNextStep() }
|
||||
}
|
||||
.distinctUntilChanged()
|
||||
.onEach {
|
||||
lifecycleScope.launch { moveToNextStep() }
|
||||
}
|
||||
.launchIn(lifecycleScope)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ import kotlinx.coroutines.CoroutineScope
|
|||
import kotlinx.coroutines.FlowPreview
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.flow.catch
|
||||
import kotlinx.coroutines.flow.distinctUntilChanged
|
||||
import kotlinx.coroutines.flow.filter
|
||||
import kotlinx.coroutines.flow.first
|
||||
import kotlinx.coroutines.flow.launchIn
|
||||
|
|
@ -70,6 +71,7 @@ class DefaultFtueService @Inject constructor(
|
|||
.launchIn(sessionCoroutineScope)
|
||||
|
||||
analyticsService.didAskUserConsent()
|
||||
.distinctUntilChanged()
|
||||
.onEach { updateState() }
|
||||
.launchIn(sessionCoroutineScope)
|
||||
}
|
||||
|
|
@ -120,10 +122,7 @@ class DefaultFtueService @Inject constructor(
|
|||
emit(SessionVerifiedStatus.NotVerified)
|
||||
}
|
||||
.first()
|
||||
// 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
|
||||
return readyVerifiedSessionStatus == SessionVerifiedStatus.NotVerified && !canSkipVerification()
|
||||
}
|
||||
|
||||
private suspend fun canSkipVerification(): Boolean {
|
||||
|
|
@ -131,7 +130,6 @@ class DefaultFtueService @Inject constructor(
|
|||
}
|
||||
|
||||
private suspend fun needsAnalyticsOptIn(): Boolean {
|
||||
// We need this function to not be suspend, so we need to load the value through runBlocking
|
||||
return analyticsService.didAskUserConsent().first().not()
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue