From 94c97ec7e9062601e126cfb82a2c4602acba6af4 Mon Sep 17 00:00:00 2001 From: Mauro <34335419+Velin92@users.noreply.github.com> Date: Mon, 12 Jun 2023 12:59:01 +0200 Subject: [PATCH] Disable RR extension when feature flag is off (#1068) * disable rr extension according to ff * fixed typos in the code --- .../View/DeveloperOptionsScreen.swift | 1 + ElementX/Sources/Services/Client/ClientProxy.swift | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/View/DeveloperOptionsScreen.swift b/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/View/DeveloperOptionsScreen.swift index 2531edcef..1e6e6a63a 100644 --- a/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/View/DeveloperOptionsScreen.swift +++ b/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/View/DeveloperOptionsScreen.swift @@ -39,6 +39,7 @@ struct DeveloperOptionsScreen: View { Toggle(isOn: $context.readReceiptsEnabled) { Text("Show read receipts") + Text("requires app reboot") } .onChange(of: context.readReceiptsEnabled) { _ in context.send(viewAction: .changedReadReceiptsEnabled) diff --git a/ElementX/Sources/Services/Client/ClientProxy.swift b/ElementX/Sources/Services/Client/ClientProxy.swift index 091a95df5..fc4289b44 100644 --- a/ElementX/Sources/Services/Client/ClientProxy.swift +++ b/ElementX/Sources/Services/Client/ClientProxy.swift @@ -415,10 +415,15 @@ class ClientProxy: ClientProxyProtocol { // Add the visibleRoomsSlidingSyncList here so that it can take advantage of the SS builder cold cache // We will still register the allRoomsSlidingSyncList later, and than will have no cache - let slidingSync = try slidingSyncBuilder + var slidingSyncBuilderWithExtension = slidingSyncBuilder .addList(listBuilder: visibleRoomsListBuilder) .withCommonExtensions() - .build() + + if !ServiceLocator.shared.settings.readReceiptsEnabled { + slidingSyncBuilderWithExtension = slidingSyncBuilderWithExtension.withoutReceiptExtension() + } + + let slidingSync = try slidingSyncBuilderWithExtension.build() // Don't forget to update the view proxies after building the slidingSync visibleRoomsListProxy?.setSlidingSync(slidingSync: slidingSync)