Skip to content

Commit b394688

Browse files
committed
Remove FeatureFlag.SyncOnPush
1 parent d04434e commit b394688

File tree

3 files changed

+4
-39
lines changed

3 files changed

+4
-39
lines changed

libraries/featureflag/api/src/main/kotlin/io/element/android/libraries/featureflag/api/FeatureFlags.kt

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,6 @@ enum class FeatureFlags(
3434
defaultValue = { false },
3535
isFinished = false,
3636
),
37-
SyncOnPush(
38-
key = "feature.syncOnPush",
39-
title = "Sync on push",
40-
description = "Subscribe to room sync when a push is received",
41-
defaultValue = { true },
42-
isFinished = false,
43-
),
4437
OnlySignedDeviceIsolationMode(
4538
key = "feature.onlySignedDeviceIsolationMode",
4639
title = "Exclude insecure devices when sending/receiving messages",

libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/push/SyncOnNotifiableEvent.kt

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
package io.element.android.libraries.push.impl.push
99

1010
import io.element.android.libraries.core.coroutine.CoroutineDispatchers
11-
import io.element.android.libraries.featureflag.api.FeatureFlagService
12-
import io.element.android.libraries.featureflag.api.FeatureFlags
1311
import io.element.android.libraries.matrix.api.MatrixClientProvider
1412
import io.element.android.libraries.push.impl.notifications.model.NotifiableEvent
1513
import io.element.android.services.appnavstate.api.AppForegroundStateService
@@ -21,15 +19,10 @@ import kotlin.time.Duration.Companion.seconds
2119

2220
class SyncOnNotifiableEvent @Inject constructor(
2321
private val matrixClientProvider: MatrixClientProvider,
24-
private val featureFlagService: FeatureFlagService,
2522
private val appForegroundStateService: AppForegroundStateService,
2623
private val dispatchers: CoroutineDispatchers,
2724
) {
2825
suspend operator fun invoke(notifiableEvents: List<NotifiableEvent>) = withContext(dispatchers.io) {
29-
if (!featureFlagService.isFeatureEnabled(FeatureFlags.SyncOnPush)) {
30-
return@withContext
31-
}
32-
3326
try {
3427
val eventsBySession = notifiableEvents.groupBy { it.sessionId }
3528

libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/push/SyncOnNotifiableEventTest.kt

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ package io.element.android.libraries.push.impl.push
99

1010
import app.cash.turbine.test
1111
import com.google.common.truth.Truth.assertThat
12-
import io.element.android.libraries.featureflag.api.FeatureFlags
13-
import io.element.android.libraries.featureflag.test.FakeFeatureFlagService
1412
import io.element.android.libraries.matrix.api.MatrixClient
1513
import io.element.android.libraries.matrix.api.sync.SyncState
1614
import io.element.android.libraries.matrix.test.A_ROOM_ID
@@ -23,7 +21,6 @@ import io.element.android.libraries.matrix.test.sync.FakeSyncService
2321
import io.element.android.libraries.push.impl.notifications.fixtures.aNotifiableCallEvent
2422
import io.element.android.libraries.push.impl.notifications.fixtures.aNotifiableMessageEvent
2523
import io.element.android.services.appnavstate.test.FakeAppForegroundStateService
26-
import io.element.android.tests.testutils.lambda.assert
2724
import io.element.android.tests.testutils.lambda.lambdaRecorder
2825
import io.element.android.tests.testutils.testCoroutineDispatchers
2926
import kotlinx.coroutines.ExperimentalCoroutinesApi
@@ -60,24 +57,13 @@ class SyncOnNotifiableEventTest {
6057
private val notifiableEvent = aNotifiableMessageEvent()
6158
private val incomingCallNotifiableEvent = aNotifiableCallEvent()
6259

63-
@Test
64-
fun `when feature flag is disabled, nothing happens`() = runTest {
65-
val sut = createSyncOnNotifiableEvent(client = client, isSyncOnPushEnabled = false)
66-
67-
sut(listOf(notifiableEvent))
68-
69-
assert(startSyncLambda).isNeverCalled()
70-
assert(stopSyncLambda).isNeverCalled()
71-
assert(subscribeToSyncLambda).isNeverCalled()
72-
}
73-
7460
@OptIn(ExperimentalCoroutinesApi::class)
7561
@Test
7662
fun `when feature flag is enabled, a ringing call waits until the room is in 'in-call' state`() = runTest {
7763
val appForegroundStateService = FakeAppForegroundStateService(
7864
initialForegroundValue = false,
7965
)
80-
val sut = createSyncOnNotifiableEvent(client = client, appForegroundStateService = appForegroundStateService, isSyncOnPushEnabled = true)
66+
val sut = createSyncOnNotifiableEvent(client = client, appForegroundStateService = appForegroundStateService)
8167

8268
val unlocked = AtomicBoolean(false)
8369
launch {
@@ -97,7 +83,7 @@ class SyncOnNotifiableEventTest {
9783
val appForegroundStateService = FakeAppForegroundStateService(
9884
initialForegroundValue = false,
9985
)
100-
val sut = createSyncOnNotifiableEvent(client = client, appForegroundStateService = appForegroundStateService, isSyncOnPushEnabled = true)
86+
val sut = createSyncOnNotifiableEvent(client = client, appForegroundStateService = appForegroundStateService)
10187

10288
val unlocked = AtomicBoolean(false)
10389
launch {
@@ -116,7 +102,7 @@ class SyncOnNotifiableEventTest {
116102
val appForegroundStateService = FakeAppForegroundStateService(
117103
initialForegroundValue = false,
118104
)
119-
val sut = createSyncOnNotifiableEvent(client = client, appForegroundStateService = appForegroundStateService, isSyncOnPushEnabled = true)
105+
val sut = createSyncOnNotifiableEvent(client = client, appForegroundStateService = appForegroundStateService)
120106

121107
appForegroundStateService.isSyncingNotificationEvent.test {
122108
syncService.emitSyncState(SyncState.Running)
@@ -138,7 +124,7 @@ class SyncOnNotifiableEventTest {
138124
val appForegroundStateService = FakeAppForegroundStateService(
139125
initialForegroundValue = false,
140126
)
141-
val sut = createSyncOnNotifiableEvent(client = client, appForegroundStateService = appForegroundStateService, isSyncOnPushEnabled = true)
127+
val sut = createSyncOnNotifiableEvent(client = client, appForegroundStateService = appForegroundStateService)
142128

143129
appForegroundStateService.isSyncingNotificationEvent.test {
144130
launch { sut(listOf(notifiableEvent)) }
@@ -157,20 +143,13 @@ class SyncOnNotifiableEventTest {
157143

158144
private fun TestScope.createSyncOnNotifiableEvent(
159145
client: MatrixClient = FakeMatrixClient(),
160-
isSyncOnPushEnabled: Boolean = true,
161146
appForegroundStateService: FakeAppForegroundStateService = FakeAppForegroundStateService(
162147
initialForegroundValue = true,
163148
),
164149
): SyncOnNotifiableEvent {
165-
val featureFlagService = FakeFeatureFlagService(
166-
initialState = mapOf(
167-
FeatureFlags.SyncOnPush.key to isSyncOnPushEnabled
168-
)
169-
)
170150
val matrixClientProvider = FakeMatrixClientProvider { Result.success(client) }
171151
return SyncOnNotifiableEvent(
172152
matrixClientProvider = matrixClientProvider,
173-
featureFlagService = featureFlagService,
174153
appForegroundStateService = appForegroundStateService,
175154
dispatchers = testCoroutineDispatchers(),
176155
)

0 commit comments

Comments
 (0)