Add a feature flag to reuse the last pos value for initial syncs (#5010)

This commit is contained in:
Jorge Martin Espinosa
2025-07-10 15:33:23 +02:00
committed by GitHub
parent c373d78a77
commit b618395f42
4 changed files with 12 additions and 1 deletions

View File

@@ -173,7 +173,7 @@ jsoup = "org.jsoup:jsoup:1.21.1"
appyx_core = { module = "com.bumble.appyx:core", version.ref = "appyx" }
molecule-runtime = "app.cash.molecule:molecule-runtime:2.1.0"
timber = "com.jakewharton.timber:timber:5.0.1"
matrix_sdk = "org.matrix.rustcomponents:sdk-android:25.7.7"
matrix_sdk = "org.matrix.rustcomponents:sdk-android:25.7.10"
matrix_richtexteditor = { module = "io.element.android:wysiwyg", version.ref = "wysiwyg" }
matrix_richtexteditor_compose = { module = "io.element.android:wysiwyg-compose", version.ref = "wysiwyg" }
sqldelight-driver-android = { module = "app.cash.sqldelight:android-driver", version.ref = "sqldelight" }

View File

@@ -175,4 +175,13 @@ enum class FeatureFlags(
// False so it's displayed in the developer options screen
isFinished = false,
),
SharePos(
key = "feature.share_pos",
title = "Share pos in sliding sync",
description = "Keep the sliding sync pos to make initial syncs faster. Requires an app restart to take effect." +
"\n\nWARNING: this may cause issues with syncs.",
defaultValue = { false },
// False so it's displayed in the developer options screen
isFinished = false,
),
}

View File

@@ -78,6 +78,7 @@ class RustMatrixClientFactory @Inject constructor(
client.setUtdDelegate(UtdTracker(analyticsService))
val syncService = client.syncService()
.withSharePos(enable = featureFlagService.isFeatureEnabled(FeatureFlags.SharePos))
.withOfflineMode()
.finish()

View File

@@ -13,5 +13,6 @@ import org.matrix.rustcomponents.sdk.SyncServiceBuilder
class FakeFfiSyncServiceBuilder : SyncServiceBuilder(NoPointer) {
override fun withOfflineMode(): SyncServiceBuilder = this
override fun withSharePos(enable: Boolean): SyncServiceBuilder = this
override suspend fun finish(): SyncService = FakeFfiSyncService()
}