Re-enable SyncService.withEncryptionSync to improve decryption of notifications (#1199)
* Re-enable `SyncService.withEncryptionSync` to improve decryption of notifications. * Add feature flag
This commit is contained in:
parent
47a0ecb3b8
commit
199f578e4a
8 changed files with 30 additions and 4 deletions
|
|
@ -31,5 +31,11 @@ enum class FeatureFlags(
|
|||
title = "Polls",
|
||||
description = "Create poll and render poll events in the timeline",
|
||||
defaultValue = false,
|
||||
),
|
||||
UseEncryptionSync(
|
||||
key = "feature.useencryptionsync",
|
||||
title = "Use encryption sync",
|
||||
description = "Use the encryption sync API for decrypting notifications.",
|
||||
defaultValue = true,
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ class BuildtimeFeatureFlagProvider @Inject constructor() :
|
|||
when (feature) {
|
||||
FeatureFlags.LocationSharing -> true
|
||||
FeatureFlags.Polls -> false
|
||||
FeatureFlags.UseEncryptionSync -> true
|
||||
}
|
||||
} else {
|
||||
false
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ dependencies {
|
|||
implementation(projects.libraries.androidutils)
|
||||
implementation(projects.libraries.network)
|
||||
implementation(projects.services.toolbox.api)
|
||||
implementation(projects.libraries.featureflag.api)
|
||||
api(projects.libraries.matrix.api)
|
||||
implementation(libs.dagger)
|
||||
implementation(projects.libraries.core)
|
||||
|
|
|
|||
|
|
@ -19,6 +19,8 @@ package io.element.android.libraries.matrix.impl
|
|||
import android.content.Context
|
||||
import io.element.android.libraries.core.coroutine.CoroutineDispatchers
|
||||
import io.element.android.libraries.di.ApplicationContext
|
||||
import io.element.android.libraries.featureflag.api.FeatureFlagService
|
||||
import io.element.android.libraries.featureflag.api.FeatureFlags
|
||||
import io.element.android.libraries.network.useragent.UserAgentProvider
|
||||
import io.element.android.libraries.sessionstorage.api.SessionData
|
||||
import io.element.android.libraries.sessionstorage.api.SessionStore
|
||||
|
|
@ -39,6 +41,7 @@ class RustMatrixClientFactory @Inject constructor(
|
|||
private val sessionStore: SessionStore,
|
||||
private val userAgentProvider: UserAgentProvider,
|
||||
private val clock: SystemClock,
|
||||
private val featureFlagsService: FeatureFlagService,
|
||||
) {
|
||||
|
||||
suspend fun create(sessionData: SessionData): RustMatrixClient = withContext(coroutineDispatchers.io) {
|
||||
|
|
@ -53,7 +56,12 @@ class RustMatrixClientFactory @Inject constructor(
|
|||
|
||||
client.restoreSession(sessionData.toSession())
|
||||
|
||||
val syncService = client.syncService().finish()
|
||||
val syncService = client.syncService().apply {
|
||||
if (featureFlagsService.isFeatureEnabled(FeatureFlags.UseEncryptionSync)) {
|
||||
withEncryptionSync(withCrossProcessLock = false, appIdentifier = null)
|
||||
}
|
||||
}
|
||||
.finish()
|
||||
|
||||
RustMatrixClient(
|
||||
client = client,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue