Merge pull request #4029 from element-hq/feature/bma/eventCache
Add a feature flag to be able to enable the event cache
This commit is contained in:
@@ -161,4 +161,11 @@ enum class FeatureFlags(
|
||||
defaultValue = { buildMeta -> buildMeta.buildType != BuildType.RELEASE },
|
||||
isFinished = false,
|
||||
),
|
||||
EventCache(
|
||||
key = "feature.event_cache",
|
||||
title = "Use SDK Event cache",
|
||||
description = "Warning: you must kill and restart the app for the change to take effect.",
|
||||
defaultValue = { false },
|
||||
isFinished = false,
|
||||
),
|
||||
}
|
||||
|
||||
@@ -232,6 +232,11 @@ interface MatrixRoom : Closeable {
|
||||
*/
|
||||
suspend fun setUnreadFlag(isUnread: Boolean): Result<Unit>
|
||||
|
||||
/**
|
||||
* Clear the event cache storage for the current room.
|
||||
*/
|
||||
suspend fun clearEventCacheStorage(): Result<Unit>
|
||||
|
||||
/**
|
||||
* Share a location message in the room.
|
||||
*
|
||||
|
||||
@@ -109,9 +109,7 @@ class RustMatrixClientFactory @Inject constructor(
|
||||
.addRootCertificates(userCertificatesProvider.provides())
|
||||
.autoEnableBackups(true)
|
||||
.autoEnableCrossSigning(true)
|
||||
// TODO Add a feature flag to enable persistent storage
|
||||
// See https://github.com/matrix-org/matrix-rust-sdk/pull/4396
|
||||
.useEventCachePersistentStorage(false)
|
||||
.useEventCachePersistentStorage(featureFlagService.isFeatureEnabled(FeatureFlags.EventCache))
|
||||
.roomKeyRecipientStrategy(
|
||||
strategy = if (featureFlagService.isFeatureEnabled(FeatureFlags.OnlySignedDeviceIsolationMode)) {
|
||||
CollectStrategy.IdentityBasedStrategy
|
||||
|
||||
@@ -569,6 +569,12 @@ class RustMatrixRoom(
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun clearEventCacheStorage(): Result<Unit> = withContext(roomDispatcher) {
|
||||
runCatching {
|
||||
innerRoom.clearEventCacheStorage()
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun kickUser(userId: UserId, reason: String?): Result<Unit> = withContext(roomDispatcher) {
|
||||
runCatching {
|
||||
innerRoom.kickUser(userId.value, reason)
|
||||
|
||||
@@ -574,6 +574,10 @@ class FakeMatrixRoom(
|
||||
fun givenRoomMembersState(state: MatrixRoomMembersState) {
|
||||
membersStateFlow.value = state
|
||||
}
|
||||
|
||||
override suspend fun clearEventCacheStorage(): Result<Unit> {
|
||||
return Result.success(Unit)
|
||||
}
|
||||
}
|
||||
|
||||
fun defaultRoomPowerLevels() = MatrixRoomPowerLevels(
|
||||
|
||||
Reference in New Issue
Block a user