Avoid runBlocking. Start with a nullable boolean.

This commit is contained in:
Benoit Marty 2023-10-31 21:51:10 +01:00 committed by Benoit Marty
parent 5013ff061e
commit d09d95b269
4 changed files with 12 additions and 15 deletions

View file

@ -39,7 +39,6 @@ import io.element.android.libraries.matrix.api.verification.SessionVerificationS
import io.element.android.services.analytics.api.AnalyticsService
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.launch
import kotlinx.coroutines.runBlocking
import javax.inject.Inject
class PreferencesRootPresenter @Inject constructor(
@ -80,7 +79,7 @@ class PreferencesRootPresenter @Inject constructor(
val showSecureBackupIndicator by indicatorService.showSettingChatBackupIndicator()
val secureStorageFlag by featureFlagService.isFeatureEnabledFlow(FeatureFlags.SecureStorage)
.collectAsState(initial = runBlocking { featureFlagService.isFeatureEnabled(FeatureFlags.SecureStorage) })
.collectAsState(initial = null)
val accountManagementUrl: MutableState<String?> = remember {
mutableStateOf(null)
@ -98,7 +97,7 @@ class PreferencesRootPresenter @Inject constructor(
myUser = matrixUser.value,
version = versionFormatter.get(),
showCompleteVerification = showCompleteVerification,
showSecureBackup = !showCompleteVerification && secureStorageFlag,
showSecureBackup = !showCompleteVerification && secureStorageFlag == true,
showSecureBackupBadge = showSecureBackupIndicator,
accountManagementUrl = accountManagementUrl.value,
devicesManagementUrl = devicesManagementUrl.value,