diff --git a/libraries/featureflag/api/src/main/kotlin/io/element/android/libraries/featureflag/api/FeatureFlags.kt b/libraries/featureflag/api/src/main/kotlin/io/element/android/libraries/featureflag/api/FeatureFlags.kt index 3c821ef3fb..3feef36ffa 100644 --- a/libraries/featureflag/api/src/main/kotlin/io/element/android/libraries/featureflag/api/FeatureFlags.kt +++ b/libraries/featureflag/api/src/main/kotlin/io/element/android/libraries/featureflag/api/FeatureFlags.kt @@ -34,13 +34,6 @@ enum class FeatureFlags( defaultValue = { false }, isFinished = false, ), - SyncOnPush( - key = "feature.syncOnPush", - title = "Sync on push", - description = "Subscribe to room sync when a push is received", - defaultValue = { true }, - isFinished = false, - ), OnlySignedDeviceIsolationMode( key = "feature.onlySignedDeviceIsolationMode", title = "Exclude insecure devices when sending/receiving messages", diff --git a/libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/push/SyncOnNotifiableEvent.kt b/libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/push/SyncOnNotifiableEvent.kt index 57c004ce23..bb4e03e4d0 100644 --- a/libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/push/SyncOnNotifiableEvent.kt +++ b/libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/push/SyncOnNotifiableEvent.kt @@ -8,8 +8,6 @@ package io.element.android.libraries.push.impl.push import io.element.android.libraries.core.coroutine.CoroutineDispatchers -import io.element.android.libraries.featureflag.api.FeatureFlagService -import io.element.android.libraries.featureflag.api.FeatureFlags import io.element.android.libraries.matrix.api.MatrixClientProvider import io.element.android.libraries.push.impl.notifications.model.NotifiableEvent import io.element.android.services.appnavstate.api.AppForegroundStateService @@ -21,15 +19,10 @@ import kotlin.time.Duration.Companion.seconds class SyncOnNotifiableEvent @Inject constructor( private val matrixClientProvider: MatrixClientProvider, - private val featureFlagService: FeatureFlagService, private val appForegroundStateService: AppForegroundStateService, private val dispatchers: CoroutineDispatchers, ) { suspend operator fun invoke(notifiableEvents: List) = withContext(dispatchers.io) { - if (!featureFlagService.isFeatureEnabled(FeatureFlags.SyncOnPush)) { - return@withContext - } - try { val eventsBySession = notifiableEvents.groupBy { it.sessionId } diff --git a/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/push/SyncOnNotifiableEventTest.kt b/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/push/SyncOnNotifiableEventTest.kt index e1c4b33acf..f7d4fc0fda 100644 --- a/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/push/SyncOnNotifiableEventTest.kt +++ b/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/push/SyncOnNotifiableEventTest.kt @@ -9,8 +9,6 @@ package io.element.android.libraries.push.impl.push import app.cash.turbine.test import com.google.common.truth.Truth.assertThat -import io.element.android.libraries.featureflag.api.FeatureFlags -import io.element.android.libraries.featureflag.test.FakeFeatureFlagService import io.element.android.libraries.matrix.api.MatrixClient import io.element.android.libraries.matrix.api.sync.SyncState import io.element.android.libraries.matrix.test.A_ROOM_ID @@ -23,7 +21,6 @@ import io.element.android.libraries.matrix.test.sync.FakeSyncService import io.element.android.libraries.push.impl.notifications.fixtures.aNotifiableCallEvent import io.element.android.libraries.push.impl.notifications.fixtures.aNotifiableMessageEvent import io.element.android.services.appnavstate.test.FakeAppForegroundStateService -import io.element.android.tests.testutils.lambda.assert import io.element.android.tests.testutils.lambda.lambdaRecorder import io.element.android.tests.testutils.testCoroutineDispatchers import kotlinx.coroutines.ExperimentalCoroutinesApi @@ -60,24 +57,13 @@ class SyncOnNotifiableEventTest { private val notifiableEvent = aNotifiableMessageEvent() private val incomingCallNotifiableEvent = aNotifiableCallEvent() - @Test - fun `when feature flag is disabled, nothing happens`() = runTest { - val sut = createSyncOnNotifiableEvent(client = client, isSyncOnPushEnabled = false) - - sut(listOf(notifiableEvent)) - - assert(startSyncLambda).isNeverCalled() - assert(stopSyncLambda).isNeverCalled() - assert(subscribeToSyncLambda).isNeverCalled() - } - @OptIn(ExperimentalCoroutinesApi::class) @Test fun `when feature flag is enabled, a ringing call waits until the room is in 'in-call' state`() = runTest { val appForegroundStateService = FakeAppForegroundStateService( initialForegroundValue = false, ) - val sut = createSyncOnNotifiableEvent(client = client, appForegroundStateService = appForegroundStateService, isSyncOnPushEnabled = true) + val sut = createSyncOnNotifiableEvent(client = client, appForegroundStateService = appForegroundStateService) val unlocked = AtomicBoolean(false) launch { @@ -97,7 +83,7 @@ class SyncOnNotifiableEventTest { val appForegroundStateService = FakeAppForegroundStateService( initialForegroundValue = false, ) - val sut = createSyncOnNotifiableEvent(client = client, appForegroundStateService = appForegroundStateService, isSyncOnPushEnabled = true) + val sut = createSyncOnNotifiableEvent(client = client, appForegroundStateService = appForegroundStateService) val unlocked = AtomicBoolean(false) launch { @@ -116,7 +102,7 @@ class SyncOnNotifiableEventTest { val appForegroundStateService = FakeAppForegroundStateService( initialForegroundValue = false, ) - val sut = createSyncOnNotifiableEvent(client = client, appForegroundStateService = appForegroundStateService, isSyncOnPushEnabled = true) + val sut = createSyncOnNotifiableEvent(client = client, appForegroundStateService = appForegroundStateService) appForegroundStateService.isSyncingNotificationEvent.test { syncService.emitSyncState(SyncState.Running) @@ -138,7 +124,7 @@ class SyncOnNotifiableEventTest { val appForegroundStateService = FakeAppForegroundStateService( initialForegroundValue = false, ) - val sut = createSyncOnNotifiableEvent(client = client, appForegroundStateService = appForegroundStateService, isSyncOnPushEnabled = true) + val sut = createSyncOnNotifiableEvent(client = client, appForegroundStateService = appForegroundStateService) appForegroundStateService.isSyncingNotificationEvent.test { launch { sut(listOf(notifiableEvent)) } @@ -157,20 +143,13 @@ class SyncOnNotifiableEventTest { private fun TestScope.createSyncOnNotifiableEvent( client: MatrixClient = FakeMatrixClient(), - isSyncOnPushEnabled: Boolean = true, appForegroundStateService: FakeAppForegroundStateService = FakeAppForegroundStateService( initialForegroundValue = true, ), ): SyncOnNotifiableEvent { - val featureFlagService = FakeFeatureFlagService( - initialState = mapOf( - FeatureFlags.SyncOnPush.key to isSyncOnPushEnabled - ) - ) val matrixClientProvider = FakeMatrixClientProvider { Result.success(client) } return SyncOnNotifiableEvent( matrixClientProvider = matrixClientProvider, - featureFlagService = featureFlagService, appForegroundStateService = appForegroundStateService, dispatchers = testCoroutineDispatchers(), )