Skip to content

Commit

Permalink
Remove encryption authenticity feature flag. (#3180)
Browse files Browse the repository at this point in the history
  • Loading branch information
pixlwave authored Aug 19, 2024
1 parent 4e66788 commit 6616d17
Show file tree
Hide file tree
Showing 7 changed files with 1 addition and 22 deletions.
4 changes: 0 additions & 4 deletions ElementX/Sources/Application/AppSettings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ final class AppSettings {
case publicSearchEnabled
case fuzzyRoomListSearchEnabled
case pinningEnabled
case timelineItemAuthenticityEnabled
}

private static var suiteName: String = InfoPlistReader.main.appGroupIdentifier
Expand Down Expand Up @@ -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

Expand Down
3 changes: 0 additions & 3 deletions ElementX/Sources/FlowCoordinators/RoomFlowCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down Expand Up @@ -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))

Expand Down Expand Up @@ -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))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 { }
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion ElementX/Sources/UITests/UITestsAppCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion UnitTests/Sources/TimelineItemFactoryTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down

0 comments on commit 6616d17

Please sign in to comment.