From b2e99bcfc584b8edcae8ba197aac88bbd9ca66b8 Mon Sep 17 00:00:00 2001 From: Mauro <34335419+Velin92@users.noreply.github.com> Date: Tue, 12 Dec 2023 15:27:15 +0100 Subject: [PATCH] Remove Read Receipts Feature Flag (#2228) --- ElementX/Sources/Application/AppSettings.swift | 4 ---- ElementX/Sources/Screens/RoomScreen/RoomScreenModels.swift | 1 - .../Sources/Screens/RoomScreen/RoomScreenViewModel.swift | 5 ----- ElementX/Sources/Screens/RoomScreen/View/RoomScreen.swift | 1 - .../View/Style/TimelineItemBubbledStylerView.swift | 3 --- .../Screens/RoomScreen/View/Style/TimelineStyle.swift | 5 ----- .../View/Supplementary/TimelineItemStatusView.swift | 3 +-- .../DeveloperOptionsScreenModels.swift | 1 - .../DeveloperOptionsScreen/View/DeveloperOptionsScreen.swift | 5 ----- ElementX/Sources/UITests/UITestsAppCoordinator.swift | 1 - .../test_timelineItemBubbledStylerView.Mock-Timeline-RTL.png | 4 ++-- ...temBubbledStylerView.Mock-Timeline-with-read-receipts.png | 3 --- .../test_timelineItemBubbledStylerView.Mock-Timeline.png | 4 ++-- .../PreviewTests/test_timelineItemPlainStylerView.1.png | 4 ++-- 14 files changed, 7 insertions(+), 37 deletions(-) delete mode 100644 UnitTests/__Snapshots__/PreviewTests/test_timelineItemBubbledStylerView.Mock-Timeline-with-read-receipts.png diff --git a/ElementX/Sources/Application/AppSettings.swift b/ElementX/Sources/Application/AppSettings.swift index 014b757a0..45da91cd6 100644 --- a/ElementX/Sources/Application/AppSettings.swift +++ b/ElementX/Sources/Application/AppSettings.swift @@ -44,7 +44,6 @@ final class AppSettings { // Feature flags case shouldCollapseRoomStateEvents case userSuggestionsEnabled - case readReceiptsEnabled case swiftUITimelineEnabled case chatBackupEnabled } @@ -265,9 +264,6 @@ final class AppSettings { @UserPreference(key: UserDefaultsKeys.userSuggestionsEnabled, defaultValue: false, storageType: .volatile) var userSuggestionsEnabled - - @UserPreference(key: UserDefaultsKeys.readReceiptsEnabled, defaultValue: true, storageType: .userDefaults(store)) - var readReceiptsEnabled @UserPreference(key: UserDefaultsKeys.swiftUITimelineEnabled, defaultValue: false, storageType: .volatile) var swiftUITimelineEnabled diff --git a/ElementX/Sources/Screens/RoomScreen/RoomScreenModels.swift b/ElementX/Sources/Screens/RoomScreen/RoomScreenModels.swift index 1996b25a0..e8b7c1f38 100644 --- a/ElementX/Sources/Screens/RoomScreen/RoomScreenModels.swift +++ b/ElementX/Sources/Screens/RoomScreen/RoomScreenModels.swift @@ -122,7 +122,6 @@ struct RoomScreenViewState: BindableState { var members: [String: RoomMemberState] = [:] var showLoading = false var timelineStyle: TimelineStyle - var readReceiptsEnabled: Bool var isEncryptedOneToOneRoom = false var timelineViewState = TimelineViewState() // check the doc before changing this var swiftUITimelineEnabled = false diff --git a/ElementX/Sources/Screens/RoomScreen/RoomScreenViewModel.swift b/ElementX/Sources/Screens/RoomScreen/RoomScreenViewModel.swift index 492311628..ed460ae87 100644 --- a/ElementX/Sources/Screens/RoomScreen/RoomScreenViewModel.swift +++ b/ElementX/Sources/Screens/RoomScreen/RoomScreenViewModel.swift @@ -84,7 +84,6 @@ class RoomScreenViewModel: RoomScreenViewModelType, RoomScreenViewModelProtocol roomTitle: roomProxy.roomTitle, roomAvatarURL: roomProxy.avatarURL, timelineStyle: appSettings.timelineStyle, - readReceiptsEnabled: appSettings.readReceiptsEnabled, isEncryptedOneToOneRoom: roomProxy.isEncryptedOneToOneRoom, ownUserID: roomProxy.ownUserID, hasOngoingCall: roomProxy.hasOngoingCall, @@ -315,10 +314,6 @@ class RoomScreenViewModel: RoomScreenViewModelType, RoomScreenViewModelProtocol appSettings.$timelineStyle .weakAssign(to: \.state.timelineStyle, on: self) .store(in: &cancellables) - - appSettings.$readReceiptsEnabled - .weakAssign(to: \.state.readReceiptsEnabled, on: self) - .store(in: &cancellables) roomProxy.members .map { members in diff --git a/ElementX/Sources/Screens/RoomScreen/View/RoomScreen.swift b/ElementX/Sources/Screens/RoomScreen/View/RoomScreen.swift index 97e157cef..e837f1cb2 100644 --- a/ElementX/Sources/Screens/RoomScreen/View/RoomScreen.swift +++ b/ElementX/Sources/Screens/RoomScreen/View/RoomScreen.swift @@ -100,7 +100,6 @@ struct RoomScreen: View { .id(context.viewState.roomID) .environmentObject(context) .environment(\.timelineStyle, context.viewState.timelineStyle) - .environment(\.readReceiptsEnabled, context.viewState.readReceiptsEnabled) } @ViewBuilder diff --git a/ElementX/Sources/Screens/RoomScreen/View/Style/TimelineItemBubbledStylerView.swift b/ElementX/Sources/Screens/RoomScreen/View/Style/TimelineItemBubbledStylerView.swift index de17d52da..b344f78fe 100644 --- a/ElementX/Sources/Screens/RoomScreen/View/Style/TimelineItemBubbledStylerView.swift +++ b/ElementX/Sources/Screens/RoomScreen/View/Style/TimelineItemBubbledStylerView.swift @@ -399,9 +399,6 @@ struct TimelineItemBubbledStylerView_Previews: PreviewProvider, TestablePreview static var previews: some View { mockTimeline .previewDisplayName("Mock Timeline") - mockTimeline - .environment(\.readReceiptsEnabled, true) - .previewDisplayName("Mock Timeline with read receipts") mockTimeline .environment(\.layoutDirection, .rightToLeft) .previewDisplayName("Mock Timeline RTL") diff --git a/ElementX/Sources/Screens/RoomScreen/View/Style/TimelineStyle.swift b/ElementX/Sources/Screens/RoomScreen/View/Style/TimelineStyle.swift index f5dc0711d..dd6d58cde 100644 --- a/ElementX/Sources/Screens/RoomScreen/View/Style/TimelineStyle.swift +++ b/ElementX/Sources/Screens/RoomScreen/View/Style/TimelineStyle.swift @@ -82,9 +82,4 @@ extension EnvironmentValues { get { self[TimelineGroupStyleKey.self] } set { self[TimelineGroupStyleKey.self] = newValue } } - - var readReceiptsEnabled: Bool { - get { self[ReadReceiptsEnabledKey.self] } - set { self[ReadReceiptsEnabledKey.self] = newValue } - } } diff --git a/ElementX/Sources/Screens/RoomScreen/View/Supplementary/TimelineItemStatusView.swift b/ElementX/Sources/Screens/RoomScreen/View/Supplementary/TimelineItemStatusView.swift index d864e7a48..d6e2305b2 100644 --- a/ElementX/Sources/Screens/RoomScreen/View/Supplementary/TimelineItemStatusView.swift +++ b/ElementX/Sources/Screens/RoomScreen/View/Supplementary/TimelineItemStatusView.swift @@ -21,7 +21,6 @@ struct TimelineItemStatusView: View { let timelineItem: EventBasedTimelineItemProtocol let adjustedDeliveryStatus: TimelineItemDeliveryStatus? @Environment(\.timelineStyle) private var style - @Environment(\.readReceiptsEnabled) private var readReceiptsEnabled @EnvironmentObject private var context: RoomScreenViewModel.Context private var isLastOutgoingMessage: Bool { @@ -34,7 +33,7 @@ struct TimelineItemStatusView: View { @ViewBuilder private var mainContent: some View { - if !timelineItem.properties.orderedReadReceipts.isEmpty, readReceiptsEnabled { + if !timelineItem.properties.orderedReadReceipts.isEmpty { readReceipts } else { deliveryStatusBadge diff --git a/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/DeveloperOptionsScreenModels.swift b/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/DeveloperOptionsScreenModels.swift index 3fdc4209e..22d5f7eca 100644 --- a/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/DeveloperOptionsScreenModels.swift +++ b/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/DeveloperOptionsScreenModels.swift @@ -47,7 +47,6 @@ protocol DeveloperOptionsProtocol: AnyObject { var otlpTracingEnabled: Bool { get set } var shouldCollapseRoomStateEvents: Bool { get set } var userSuggestionsEnabled: Bool { get set } - var readReceiptsEnabled: Bool { get set } var swiftUITimelineEnabled: Bool { get set } var chatBackupEnabled: Bool { get set } diff --git a/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/View/DeveloperOptionsScreen.swift b/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/View/DeveloperOptionsScreen.swift index ba5ee5643..b8639b5f5 100644 --- a/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/View/DeveloperOptionsScreen.swift +++ b/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/View/DeveloperOptionsScreen.swift @@ -43,11 +43,6 @@ struct DeveloperOptionsScreen: View { Toggle(isOn: $context.shouldCollapseRoomStateEvents) { Text("Collapse room state events") } - - Toggle(isOn: $context.readReceiptsEnabled) { - Text("Show read receipts") - Text("Requires app reboot") - } Toggle(isOn: $context.swiftUITimelineEnabled) { Text("SwiftUI Timeline") diff --git a/ElementX/Sources/UITests/UITestsAppCoordinator.swift b/ElementX/Sources/UITests/UITestsAppCoordinator.swift index 6d46cb67f..2d895a103 100644 --- a/ElementX/Sources/UITests/UITestsAppCoordinator.swift +++ b/ElementX/Sources/UITests/UITestsAppCoordinator.swift @@ -388,7 +388,6 @@ class MockScreen: Identifiable { navigationStackCoordinator.setRootCoordinator(coordinator) return navigationStackCoordinator case .roomSmallTimelineWithReadReceipts: - ServiceLocator.shared.settings.readReceiptsEnabled = true let navigationStackCoordinator = NavigationStackCoordinator() let timelineController = MockRoomTimelineController() timelineController.timelineItems = RoomTimelineItemFixtures.smallChunkWithReadReceipts diff --git a/UnitTests/__Snapshots__/PreviewTests/test_timelineItemBubbledStylerView.Mock-Timeline-RTL.png b/UnitTests/__Snapshots__/PreviewTests/test_timelineItemBubbledStylerView.Mock-Timeline-RTL.png index 33da2e84b..a31a5168d 100644 --- a/UnitTests/__Snapshots__/PreviewTests/test_timelineItemBubbledStylerView.Mock-Timeline-RTL.png +++ b/UnitTests/__Snapshots__/PreviewTests/test_timelineItemBubbledStylerView.Mock-Timeline-RTL.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5d9b24eabfe1a1e9b20e073a54b502fe2dd931888bbdfc0f9e3f80daf47da086 -size 340654 +oid sha256:ad878b38347d644944ca7b9f77bc62f69ec8243de0b9f2b6b8b9291eecc82309 +size 338034 diff --git a/UnitTests/__Snapshots__/PreviewTests/test_timelineItemBubbledStylerView.Mock-Timeline-with-read-receipts.png b/UnitTests/__Snapshots__/PreviewTests/test_timelineItemBubbledStylerView.Mock-Timeline-with-read-receipts.png deleted file mode 100644 index 0155743a1..000000000 --- a/UnitTests/__Snapshots__/PreviewTests/test_timelineItemBubbledStylerView.Mock-Timeline-with-read-receipts.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:cd888b282323ffde3f179aaa9b30239e1801bc0afb7af1f7b3f6410b42e62583 -size 337169 diff --git a/UnitTests/__Snapshots__/PreviewTests/test_timelineItemBubbledStylerView.Mock-Timeline.png b/UnitTests/__Snapshots__/PreviewTests/test_timelineItemBubbledStylerView.Mock-Timeline.png index b547476ad..0155743a1 100644 --- a/UnitTests/__Snapshots__/PreviewTests/test_timelineItemBubbledStylerView.Mock-Timeline.png +++ b/UnitTests/__Snapshots__/PreviewTests/test_timelineItemBubbledStylerView.Mock-Timeline.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b90380fb1e7089bf7d47cab12667adbce4249b2ec78b4eb112f0b244cbe3d72e -size 339386 +oid sha256:cd888b282323ffde3f179aaa9b30239e1801bc0afb7af1f7b3f6410b42e62583 +size 337169 diff --git a/UnitTests/__Snapshots__/PreviewTests/test_timelineItemPlainStylerView.1.png b/UnitTests/__Snapshots__/PreviewTests/test_timelineItemPlainStylerView.1.png index c26b57f9b..0b8ada83d 100644 --- a/UnitTests/__Snapshots__/PreviewTests/test_timelineItemPlainStylerView.1.png +++ b/UnitTests/__Snapshots__/PreviewTests/test_timelineItemPlainStylerView.1.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b26642d6f01ae553147d66e347da12469ea642a1fa27f70ed802a703f27f54af -size 370905 +oid sha256:1063dd5c24689278e9adb10af716a3d40bcd78e0371a02669f97cfd470185224 +size 377469