Merge pull request #3451 from element-hq/feature/valere/invisible_crypto_feature_flag
Feature/valere/invisible crypto feature flag
This commit is contained in:
commit
da3f5e00dc
5 changed files with 45 additions and 34 deletions
|
|
@ -13,8 +13,6 @@ import io.element.android.libraries.core.meta.BuildType
|
|||
|
||||
/**
|
||||
* To enable or disable a FeatureFlags, change the `defaultValue` value.
|
||||
* Warning: to enable a flag for the release app, you MUST update the file
|
||||
* [io.element.android.libraries.featureflag.impl.StaticFeatureFlagProvider]
|
||||
*/
|
||||
enum class FeatureFlags(
|
||||
override val key: String,
|
||||
|
|
@ -125,4 +123,13 @@ enum class FeatureFlags(
|
|||
defaultValue = { true },
|
||||
isFinished = false,
|
||||
),
|
||||
InvisibleCrypto(
|
||||
key = "feature.invisibleCrypto",
|
||||
title = "Invisible Crypto",
|
||||
description = "This setting controls how end-to-end encryption (E2E) keys are shared." +
|
||||
" Enabling it will prevent the inclusion of devices that have not been explicitly verified by their owners." +
|
||||
" You'll have to stop and re-open the app manually for that setting to take effect.",
|
||||
defaultValue = { false },
|
||||
isFinished = false,
|
||||
),
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@ package io.element.android.libraries.matrix.impl
|
|||
import io.element.android.appconfig.AuthenticationConfig
|
||||
import io.element.android.libraries.core.coroutine.CoroutineDispatchers
|
||||
import io.element.android.libraries.di.CacheDirectory
|
||||
import io.element.android.libraries.featureflag.api.FeatureFlagService
|
||||
import io.element.android.libraries.featureflag.api.FeatureFlags
|
||||
import io.element.android.libraries.matrix.impl.analytics.UtdTracker
|
||||
import io.element.android.libraries.matrix.impl.certificates.UserCertificatesProvider
|
||||
import io.element.android.libraries.matrix.impl.paths.SessionPaths
|
||||
|
|
@ -30,6 +32,7 @@ import org.matrix.rustcomponents.sdk.SlidingSyncVersion
|
|||
import org.matrix.rustcomponents.sdk.SlidingSyncVersionBuilder
|
||||
import org.matrix.rustcomponents.sdk.use
|
||||
import timber.log.Timber
|
||||
import uniffi.matrix_sdk_crypto.CollectStrategy
|
||||
import java.io.File
|
||||
import javax.inject.Inject
|
||||
|
||||
|
|
@ -45,6 +48,7 @@ class RustMatrixClientFactory @Inject constructor(
|
|||
private val clock: SystemClock,
|
||||
private val utdTracker: UtdTracker,
|
||||
private val appPreferencesStore: AppPreferencesStore,
|
||||
private val featureFlagService: FeatureFlagService,
|
||||
) {
|
||||
suspend fun create(sessionData: SessionData): RustMatrixClient = withContext(coroutineDispatchers.io) {
|
||||
val sessionDelegate = RustClientSessionDelegate(sessionStore, appCoroutineScope, coroutineDispatchers)
|
||||
|
|
@ -104,6 +108,13 @@ class RustMatrixClientFactory @Inject constructor(
|
|||
.addRootCertificates(userCertificatesProvider.provides())
|
||||
.autoEnableBackups(true)
|
||||
.autoEnableCrossSigning(true)
|
||||
.roomKeyRecipientStrategy(
|
||||
strategy = if (featureFlagService.isFeatureEnabled(FeatureFlags.InvisibleCrypto)) {
|
||||
CollectStrategy.IdentityBasedStrategy
|
||||
} else {
|
||||
CollectStrategy.DeviceBasedStrategy(onlyAllowTrustedDevices = false, errorOnVerifiedUserProblem = false)
|
||||
}
|
||||
)
|
||||
.run {
|
||||
// Apply sliding sync version settings
|
||||
when (slidingSync) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue