Skip to content

Commit 4d697a3

Browse files
committed
Introduce a feature flag for the new identity pinning violation notifications feature.
1 parent 13bc3a1 commit 4d697a3

File tree

4 files changed

+12
-1
lines changed

4 files changed

+12
-1
lines changed

ElementX/Sources/Application/AppSettings.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ final class AppSettings {
4646
case fuzzyRoomListSearchEnabled
4747
case pinningEnabled
4848
case enableOnlySignedDeviceIsolationMode
49+
case identityPinningViolationNotificationsEnabled
4950
}
5051

5152
private static var suiteName: String = InfoPlistReader.main.appGroupIdentifier
@@ -278,6 +279,9 @@ final class AppSettings {
278279
enum SlidingSyncDiscovery: Codable { case proxy, native, forceNative }
279280
@UserPreference(key: UserDefaultsKeys.slidingSyncDiscovery, defaultValue: .native, storageType: .userDefaults(store))
280281
var slidingSyncDiscovery: SlidingSyncDiscovery
282+
283+
@UserPreference(key: UserDefaultsKeys.identityPinningViolationNotificationsEnabled, defaultValue: isDevelopmentBuild, storageType: .userDefaults(store))
284+
var identityPinningViolationNotificationsEnabled
281285

282286
#endif
283287

ElementX/Sources/Screens/RoomScreen/RoomScreenViewModel.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,9 @@ class RoomScreenViewModel: RoomScreenViewModelType, RoomScreenViewModelProtocol
142142
}
143143
.store(in: &cancellables)
144144

145-
let identityStatusChangesPublisher = roomProxy.identityStatusChangesPublisher.receive(on: DispatchQueue.main)
145+
let identityStatusChangesPublisher = roomProxy.identityStatusChangesPublisher
146+
.receive(on: DispatchQueue.main)
147+
.filter { [weak self] _ in self?.appSettings.identityPinningViolationNotificationsEnabled ?? false }
146148

147149
Task { [weak self] in
148150
for await changes in identityStatusChangesPublisher.values {

ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/DeveloperOptionsScreenModels.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ protocol DeveloperOptionsProtocol: AnyObject {
4848
var hideTimelineMedia: Bool { get set }
4949
var enableOnlySignedDeviceIsolationMode: Bool { get set }
5050
var elementCallBaseURLOverride: URL? { get set }
51+
var identityPinningViolationNotificationsEnabled: Bool { get set }
5152
}
5253

5354
extension AppSettings: DeveloperOptionsProtocol { }

ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/View/DeveloperOptionsScreen.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ struct DeveloperOptionsScreen: View {
4949
Toggle(isOn: $context.hideTimelineMedia) {
5050
Text("Hide image & video previews")
5151
}
52+
53+
Toggle(isOn: $context.identityPinningViolationNotificationsEnabled) {
54+
Text("Identity pinning violation notifications")
55+
}
5256
}
5357

5458
Section {

0 commit comments

Comments
 (0)