From 6616d1799f61e760d7f643d5a7e8155c5e92f311 Mon Sep 17 00:00:00 2001 From: Doug <6060466+pixlwave@users.noreply.github.com> Date: Mon, 19 Aug 2024 09:49:10 +0100 Subject: [PATCH] Remove encryption authenticity feature flag. (#3180) --- ElementX/Sources/Application/AppSettings.swift | 4 ---- .../Sources/FlowCoordinators/RoomFlowCoordinator.swift | 3 --- .../DeveloperOptionsScreenModels.swift | 1 - .../View/DeveloperOptionsScreen.swift | 7 ------- .../Timeline/TimelineItems/RoomTimelineItemFactory.swift | 6 +----- ElementX/Sources/UITests/UITestsAppCoordinator.swift | 1 - UnitTests/Sources/TimelineItemFactoryTests.swift | 1 - 7 files changed, 1 insertion(+), 22 deletions(-) diff --git a/ElementX/Sources/Application/AppSettings.swift b/ElementX/Sources/Application/AppSettings.swift index 255960cc1..8ff6de726 100644 --- a/ElementX/Sources/Application/AppSettings.swift +++ b/ElementX/Sources/Application/AppSettings.swift @@ -47,7 +47,6 @@ final class AppSettings { case publicSearchEnabled case fuzzyRoomListSearchEnabled case pinningEnabled - case timelineItemAuthenticityEnabled } private static var suiteName: String = InfoPlistReader.main.appGroupIdentifier @@ -286,9 +285,6 @@ final class AppSettings { @UserPreference(key: UserDefaultsKeys.pinningEnabled, defaultValue: false, storageType: .userDefaults(store)) var pinningEnabled - @UserPreference(key: UserDefaultsKeys.timelineItemAuthenticityEnabled, defaultValue: false, storageType: .userDefaults(store)) - var timelineItemAuthenticityEnabled - // Not user configurable as it depends on work in EC too. let elementCallPictureInPictureEnabled = false diff --git a/ElementX/Sources/FlowCoordinators/RoomFlowCoordinator.swift b/ElementX/Sources/FlowCoordinators/RoomFlowCoordinator.swift index 66e57b04b..5e5d334f4 100644 --- a/ElementX/Sources/FlowCoordinators/RoomFlowCoordinator.swift +++ b/ElementX/Sources/FlowCoordinators/RoomFlowCoordinator.swift @@ -562,7 +562,6 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol { let userID = userSession.clientProxy.userID let timelineItemFactory = RoomTimelineItemFactory(userID: userID, - encryptionAuthenticityEnabled: appSettings.timelineItemAuthenticityEnabled, attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()), stateEventStringBuilder: RoomStateEventStringBuilder(userID: userID)) @@ -968,7 +967,6 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol { private func presentPinnedEventsTimeline() async { let userID = userSession.clientProxy.userID let timelineItemFactory = RoomTimelineItemFactory(userID: userID, - encryptionAuthenticityEnabled: appSettings.timelineItemAuthenticityEnabled, attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()), stateEventStringBuilder: RoomStateEventStringBuilder(userID: userID)) @@ -1098,7 +1096,6 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol { let userID = userSession.clientProxy.userID let timelineItemFactory = RoomTimelineItemFactory(userID: userID, - encryptionAuthenticityEnabled: appSettings.timelineItemAuthenticityEnabled, attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()), stateEventStringBuilder: RoomStateEventStringBuilder(userID: userID)) diff --git a/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/DeveloperOptionsScreenModels.swift b/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/DeveloperOptionsScreenModels.swift index a51b15b96..ba618ad29 100644 --- a/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/DeveloperOptionsScreenModels.swift +++ b/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/DeveloperOptionsScreenModels.swift @@ -53,7 +53,6 @@ protocol DeveloperOptionsProtocol: AnyObject { var elementCallBaseURLOverride: URL? { get set } var fuzzyRoomListSearchEnabled: Bool { get set } var pinningEnabled: Bool { get set } - var timelineItemAuthenticityEnabled: Bool { get set } } extension AppSettings: DeveloperOptionsProtocol { } diff --git a/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/View/DeveloperOptionsScreen.swift b/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/View/DeveloperOptionsScreen.swift index 8dc47cef4..990fb8470 100644 --- a/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/View/DeveloperOptionsScreen.swift +++ b/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/View/DeveloperOptionsScreen.swift @@ -50,13 +50,6 @@ struct DeveloperOptionsScreen: View { Text("Fuzzy searching") } } - - Section("Encryption") { - Toggle(isOn: $context.timelineItemAuthenticityEnabled) { - Text("Message authenticity warnings") - Text("Requires app reboot") - } - } Section("Element Call") { TextField(context.viewState.elementCallBaseURL.absoluteString, text: $elementCallBaseURLString) diff --git a/ElementX/Sources/Services/Timeline/TimelineItems/RoomTimelineItemFactory.swift b/ElementX/Sources/Services/Timeline/TimelineItems/RoomTimelineItemFactory.swift index f48a273e9..cbefa0895 100644 --- a/ElementX/Sources/Services/Timeline/TimelineItems/RoomTimelineItemFactory.swift +++ b/ElementX/Sources/Services/Timeline/TimelineItems/RoomTimelineItemFactory.swift @@ -24,14 +24,11 @@ struct RoomTimelineItemFactory: RoomTimelineItemFactoryProtocol { /// The Matrix ID of the current user. private let userID: String - private let encryptionAuthenticityEnabled: Bool init(userID: String, - encryptionAuthenticityEnabled: Bool, attributedStringBuilder: AttributedStringBuilderProtocol, stateEventStringBuilder: RoomStateEventStringBuilder) { self.userID = userID - self.encryptionAuthenticityEnabled = encryptionAuthenticityEnabled self.attributedStringBuilder = attributedStringBuilder self.stateEventStringBuilder = stateEventStringBuilder } @@ -503,8 +500,7 @@ struct RoomTimelineItemFactory: RoomTimelineItemFactoryProtocol { } private func authenticity(_ shieldState: ShieldState?) -> EncryptionAuthenticity? { - guard encryptionAuthenticityEnabled else { return nil } - return shieldState.flatMap(EncryptionAuthenticity.init) + shieldState.flatMap(EncryptionAuthenticity.init) } // MARK: - Message events content diff --git a/ElementX/Sources/UITests/UITestsAppCoordinator.swift b/ElementX/Sources/UITests/UITestsAppCoordinator.swift index 81eb82863..53d515909 100644 --- a/ElementX/Sources/UITests/UITestsAppCoordinator.swift +++ b/ElementX/Sources/UITests/UITestsAppCoordinator.swift @@ -637,7 +637,6 @@ class MockScreen: Identifiable { timelineProxy: roomProxy.timeline, initialFocussedEventID: nil, timelineItemFactory: RoomTimelineItemFactory(userID: "@alice:matrix.org", - encryptionAuthenticityEnabled: true, attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()), stateEventStringBuilder: RoomStateEventStringBuilder(userID: "@alice:matrix.org")), appSettings: ServiceLocator.shared.settings) diff --git a/UnitTests/Sources/TimelineItemFactoryTests.swift b/UnitTests/Sources/TimelineItemFactoryTests.swift index 9b75a6516..c7b840410 100644 --- a/UnitTests/Sources/TimelineItemFactoryTests.swift +++ b/UnitTests/Sources/TimelineItemFactoryTests.swift @@ -24,7 +24,6 @@ class TimelineItemFactoryTests: XCTestCase { let senderUserID = "@bob:matrix.org" let factory = RoomTimelineItemFactory(userID: ownUserID, - encryptionAuthenticityEnabled: true, attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()), stateEventStringBuilder: RoomStateEventStringBuilder(userID: ownUserID))