From cb4d68a75659b2f78b165002423d181ab6c98d06 Mon Sep 17 00:00:00 2001 From: Doug <6060466+pixlwave@users.noreply.github.com> Date: Thu, 24 Oct 2024 12:54:52 +0100 Subject: [PATCH] Fix a bug where the room state wouldn't indicate when a call was in progress. (#3442) * Fix breaking changes on decryption errors and sending failures. * Update SDK and analytics events. * Add extra UTD strings. --------- Co-authored-by: Stefan Ceriu --- ElementX.xcodeproj/project.pbxproj | 4 +- .../xcshareddata/swiftpm/Package.resolved | 12 ++--- .../en.lproj/Localizable.strings | 2 + .../UserSessionFlowCoordinator.swift | 13 +++-- ElementX/Sources/Generated/Strings.swift | 4 ++ .../Mocks/Generated/GeneratedMocks.swift | 48 ++++++++--------- .../Mocks/Generated/SDKGeneratedMocks.swift | 52 +++++++++---------- .../JoinRoomScreenViewModel.swift | 1 + .../EncryptedRoomTimelineView.swift | 6 ++- .../Sources/Services/Client/ClientProxy.swift | 6 +-- .../Services/Client/ClientProxyProtocol.swift | 2 +- .../RoomSummary/RoomEventStringBuilder.swift | 4 +- .../Services/Timeline/TimelineItemProxy.swift | 17 +++--- .../Other/EncryptedRoomTimelineItem.swift | 4 +- .../RoomTimelineItemFactory.swift | 10 +++- project.yml | 4 +- 16 files changed, 108 insertions(+), 81 deletions(-) diff --git a/ElementX.xcodeproj/project.pbxproj b/ElementX.xcodeproj/project.pbxproj index f36c1fb660..b21e08b5b3 100644 --- a/ElementX.xcodeproj/project.pbxproj +++ b/ElementX.xcodeproj/project.pbxproj @@ -7822,7 +7822,7 @@ repositoryURL = "https://github.com/element-hq/matrix-rust-components-swift"; requirement = { kind = exactVersion; - version = 1.0.60; + version = 1.0.61; }; }; 701C7BEF8F70F7A83E852DCC /* XCRemoteSwiftPackageReference "GZIP" */ = { @@ -7862,7 +7862,7 @@ repositoryURL = "https://github.com/matrix-org/matrix-analytics-events"; requirement = { kind = upToNextMinorVersion; - minimumVersion = 0.25.0; + minimumVersion = 0.27.0; }; }; C13F55E4518415CB4C278E73 /* XCRemoteSwiftPackageReference "DTCoreText" */ = { diff --git a/ElementX.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/ElementX.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index ec71df9429..5e7bb11b63 100644 --- a/ElementX.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/ElementX.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -6,8 +6,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/element-hq/compound-design-tokens", "state" : { - "revision" : "2af7bb571eb30cbfbd67cdda6617500507ef46aa", - "version" : "1.8.0" + "revision" : "976db67b849775799b4153e7894d61e90fc96888", + "version" : "1.9.0" } }, { @@ -131,8 +131,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/matrix-org/matrix-analytics-events", "state" : { - "revision" : "c9b40120a5f7b8ce1bab3f09f8417fdc9407f006", - "version" : "0.25.0" + "revision" : "9bd3c57e84f87d56b69862369f3b9da714d1d151", + "version" : "0.27.0" } }, { @@ -149,8 +149,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/element-hq/matrix-rust-components-swift", "state" : { - "revision" : "dc3a2199b0e87824ccf06d1207487d2e49c5e584", - "version" : "1.0.60" + "revision" : "2e6378514e79a648d436e8faeb8cd8106910cf0b", + "version" : "1.0.61" } }, { diff --git a/ElementX/Resources/Localizations/en.lproj/Localizable.strings b/ElementX/Resources/Localizations/en.lproj/Localizable.strings index 9b9b71021b..6e49740a0e 100644 --- a/ElementX/Resources/Localizations/en.lproj/Localizable.strings +++ b/ElementX/Resources/Localizations/en.lproj/Localizable.strings @@ -241,6 +241,8 @@ "common.pinned" = "Pinned"; "common.send_to" = "Send to"; "common.you" = "You"; +"common_unable_to_decrypt_insecure_device" = "Sent from an insecure device"; +"common_unable_to_decrypt_verification_violation" = "Sender's verified identity has changed"; "confirm_recovery_key_banner_message" = "Your chat backup is currently out of sync. You need to enter your recovery key to maintain access to your chat backup."; "confirm_recovery_key_banner_title" = "Enter your recovery key"; "crash_detection_dialog_content" = "%1$@ crashed the last time it was used. Would you like to share a crash report with us?"; diff --git a/ElementX/Sources/FlowCoordinators/UserSessionFlowCoordinator.swift b/ElementX/Sources/FlowCoordinators/UserSessionFlowCoordinator.swift index ff14107d35..e99fc21f61 100644 --- a/ElementX/Sources/FlowCoordinators/UserSessionFlowCoordinator.swift +++ b/ElementX/Sources/FlowCoordinators/UserSessionFlowCoordinator.swift @@ -59,6 +59,7 @@ class UserSessionFlowCoordinator: FlowCoordinatorProtocol { /// For testing purposes. var statePublisher: AnyPublisher { stateMachine.statePublisher } + // swiftlint:disable:next function_body_length init(userSession: UserSessionProtocol, navigationRootCoordinator: NavigationRootCoordinator, appLockService: AppLockServiceProtocol, @@ -158,9 +159,15 @@ class UserSessionFlowCoordinator: FlowCoordinatorProtocol { switch info.cause { case .unknown: - analytics.trackError(context: nil, domain: .E2EE, name: .OlmKeysNotSentError, timeToDecryptMillis: timeToDecryptMs) - case .membership: - analytics.trackError(context: nil, domain: .E2EE, name: .HistoricalMessage, timeToDecryptMillis: timeToDecryptMs) + analytics.trackError(context: nil, domain: .E2EE, name: .UnknownError, timeToDecryptMillis: timeToDecryptMs) + case .unknownDevice: + analytics.trackError(context: nil, domain: .E2EE, name: .ExpectedSentByInsecureDevice, timeToDecryptMillis: timeToDecryptMs) + case .unsignedDevice: + analytics.trackError(context: nil, domain: .E2EE, name: .ExpectedSentByInsecureDevice, timeToDecryptMillis: timeToDecryptMs) + case .verificationViolation: + analytics.trackError(context: nil, domain: .E2EE, name: .ExpectedVerificationViolation, timeToDecryptMillis: timeToDecryptMs) + case .sentBeforeWeJoined: + analytics.trackError(context: nil, domain: .E2EE, name: .ExpectedDueToMembership, timeToDecryptMillis: timeToDecryptMs) } } .store(in: &cancellables) diff --git a/ElementX/Sources/Generated/Strings.swift b/ElementX/Sources/Generated/Strings.swift index 0543707297..2439a43468 100644 --- a/ElementX/Sources/Generated/Strings.swift +++ b/ElementX/Sources/Generated/Strings.swift @@ -488,8 +488,12 @@ internal enum L10n { internal static var commonTouchIdIos: String { return L10n.tr("Localizable", "common_touch_id_ios") } /// Unable to decrypt internal static var commonUnableToDecrypt: String { return L10n.tr("Localizable", "common_unable_to_decrypt") } + /// Sent from an insecure device + internal static var commonUnableToDecryptInsecureDevice: String { return L10n.tr("Localizable", "common_unable_to_decrypt_insecure_device") } /// You don't have access to this message internal static var commonUnableToDecryptNoAccess: String { return L10n.tr("Localizable", "common_unable_to_decrypt_no_access") } + /// Sender's verified identity has changed + internal static var commonUnableToDecryptVerificationViolation: String { return L10n.tr("Localizable", "common_unable_to_decrypt_verification_violation") } /// Invites couldn't be sent to one or more users. internal static var commonUnableToInviteMessage: String { return L10n.tr("Localizable", "common_unable_to_invite_message") } /// Unable to send invite(s) diff --git a/ElementX/Sources/Mocks/Generated/GeneratedMocks.swift b/ElementX/Sources/Mocks/Generated/GeneratedMocks.swift index f5d9d148ff..9755771e0b 100644 --- a/ElementX/Sources/Mocks/Generated/GeneratedMocks.swift +++ b/ElementX/Sources/Mocks/Generated/GeneratedMocks.swift @@ -2837,15 +2837,15 @@ class ClientProxyMock: ClientProxyProtocol { } //MARK: - knockRoom - var knockRoomMessageUnderlyingCallsCount = 0 - var knockRoomMessageCallsCount: Int { + var knockRoomViaMessageUnderlyingCallsCount = 0 + var knockRoomViaMessageCallsCount: Int { get { if Thread.isMainThread { - return knockRoomMessageUnderlyingCallsCount + return knockRoomViaMessageUnderlyingCallsCount } else { var returnValue: Int? = nil DispatchQueue.main.sync { - returnValue = knockRoomMessageUnderlyingCallsCount + returnValue = knockRoomViaMessageUnderlyingCallsCount } return returnValue! @@ -2853,29 +2853,29 @@ class ClientProxyMock: ClientProxyProtocol { } set { if Thread.isMainThread { - knockRoomMessageUnderlyingCallsCount = newValue + knockRoomViaMessageUnderlyingCallsCount = newValue } else { DispatchQueue.main.sync { - knockRoomMessageUnderlyingCallsCount = newValue + knockRoomViaMessageUnderlyingCallsCount = newValue } } } } - var knockRoomMessageCalled: Bool { - return knockRoomMessageCallsCount > 0 + var knockRoomViaMessageCalled: Bool { + return knockRoomViaMessageCallsCount > 0 } - var knockRoomMessageReceivedArguments: (roomID: String, message: String?)? - var knockRoomMessageReceivedInvocations: [(roomID: String, message: String?)] = [] + var knockRoomViaMessageReceivedArguments: (roomID: String, via: [String], message: String?)? + var knockRoomViaMessageReceivedInvocations: [(roomID: String, via: [String], message: String?)] = [] - var knockRoomMessageUnderlyingReturnValue: Result! - var knockRoomMessageReturnValue: Result! { + var knockRoomViaMessageUnderlyingReturnValue: Result! + var knockRoomViaMessageReturnValue: Result! { get { if Thread.isMainThread { - return knockRoomMessageUnderlyingReturnValue + return knockRoomViaMessageUnderlyingReturnValue } else { var returnValue: Result? = nil DispatchQueue.main.sync { - returnValue = knockRoomMessageUnderlyingReturnValue + returnValue = knockRoomViaMessageUnderlyingReturnValue } return returnValue! @@ -2883,26 +2883,26 @@ class ClientProxyMock: ClientProxyProtocol { } set { if Thread.isMainThread { - knockRoomMessageUnderlyingReturnValue = newValue + knockRoomViaMessageUnderlyingReturnValue = newValue } else { DispatchQueue.main.sync { - knockRoomMessageUnderlyingReturnValue = newValue + knockRoomViaMessageUnderlyingReturnValue = newValue } } } } - var knockRoomMessageClosure: ((String, String?) async -> Result)? + var knockRoomViaMessageClosure: ((String, [String], String?) async -> Result)? - func knockRoom(_ roomID: String, message: String?) async -> Result { - knockRoomMessageCallsCount += 1 - knockRoomMessageReceivedArguments = (roomID: roomID, message: message) + func knockRoom(_ roomID: String, via: [String], message: String?) async -> Result { + knockRoomViaMessageCallsCount += 1 + knockRoomViaMessageReceivedArguments = (roomID: roomID, via: via, message: message) DispatchQueue.main.async { - self.knockRoomMessageReceivedInvocations.append((roomID: roomID, message: message)) + self.knockRoomViaMessageReceivedInvocations.append((roomID: roomID, via: via, message: message)) } - if let knockRoomMessageClosure = knockRoomMessageClosure { - return await knockRoomMessageClosure(roomID, message) + if let knockRoomViaMessageClosure = knockRoomViaMessageClosure { + return await knockRoomViaMessageClosure(roomID, via, message) } else { - return knockRoomMessageReturnValue + return knockRoomViaMessageReturnValue } } //MARK: - knockRoomAlias diff --git a/ElementX/Sources/Mocks/Generated/SDKGeneratedMocks.swift b/ElementX/Sources/Mocks/Generated/SDKGeneratedMocks.swift index efa0f5bb26..abc5a60990 100644 --- a/ElementX/Sources/Mocks/Generated/SDKGeneratedMocks.swift +++ b/ElementX/Sources/Mocks/Generated/SDKGeneratedMocks.swift @@ -2208,16 +2208,16 @@ open class ClientSDKMock: MatrixRustSDK.Client { //MARK: - knock - open var knockRoomIdOrAliasThrowableError: Error? - var knockRoomIdOrAliasUnderlyingCallsCount = 0 - open var knockRoomIdOrAliasCallsCount: Int { + open var knockRoomIdOrAliasReasonServerNamesThrowableError: Error? + var knockRoomIdOrAliasReasonServerNamesUnderlyingCallsCount = 0 + open var knockRoomIdOrAliasReasonServerNamesCallsCount: Int { get { if Thread.isMainThread { - return knockRoomIdOrAliasUnderlyingCallsCount + return knockRoomIdOrAliasReasonServerNamesUnderlyingCallsCount } else { var returnValue: Int? = nil DispatchQueue.main.sync { - returnValue = knockRoomIdOrAliasUnderlyingCallsCount + returnValue = knockRoomIdOrAliasReasonServerNamesUnderlyingCallsCount } return returnValue! @@ -2225,29 +2225,29 @@ open class ClientSDKMock: MatrixRustSDK.Client { } set { if Thread.isMainThread { - knockRoomIdOrAliasUnderlyingCallsCount = newValue + knockRoomIdOrAliasReasonServerNamesUnderlyingCallsCount = newValue } else { DispatchQueue.main.sync { - knockRoomIdOrAliasUnderlyingCallsCount = newValue + knockRoomIdOrAliasReasonServerNamesUnderlyingCallsCount = newValue } } } } - open var knockRoomIdOrAliasCalled: Bool { - return knockRoomIdOrAliasCallsCount > 0 + open var knockRoomIdOrAliasReasonServerNamesCalled: Bool { + return knockRoomIdOrAliasReasonServerNamesCallsCount > 0 } - open var knockRoomIdOrAliasReceivedRoomIdOrAlias: String? - open var knockRoomIdOrAliasReceivedInvocations: [String] = [] + open var knockRoomIdOrAliasReasonServerNamesReceivedArguments: (roomIdOrAlias: String, reason: String?, serverNames: [String])? + open var knockRoomIdOrAliasReasonServerNamesReceivedInvocations: [(roomIdOrAlias: String, reason: String?, serverNames: [String])] = [] - var knockRoomIdOrAliasUnderlyingReturnValue: Room! - open var knockRoomIdOrAliasReturnValue: Room! { + var knockRoomIdOrAliasReasonServerNamesUnderlyingReturnValue: Room! + open var knockRoomIdOrAliasReasonServerNamesReturnValue: Room! { get { if Thread.isMainThread { - return knockRoomIdOrAliasUnderlyingReturnValue + return knockRoomIdOrAliasReasonServerNamesUnderlyingReturnValue } else { var returnValue: Room? = nil DispatchQueue.main.sync { - returnValue = knockRoomIdOrAliasUnderlyingReturnValue + returnValue = knockRoomIdOrAliasReasonServerNamesUnderlyingReturnValue } return returnValue! @@ -2255,29 +2255,29 @@ open class ClientSDKMock: MatrixRustSDK.Client { } set { if Thread.isMainThread { - knockRoomIdOrAliasUnderlyingReturnValue = newValue + knockRoomIdOrAliasReasonServerNamesUnderlyingReturnValue = newValue } else { DispatchQueue.main.sync { - knockRoomIdOrAliasUnderlyingReturnValue = newValue + knockRoomIdOrAliasReasonServerNamesUnderlyingReturnValue = newValue } } } } - open var knockRoomIdOrAliasClosure: ((String) async throws -> Room)? + open var knockRoomIdOrAliasReasonServerNamesClosure: ((String, String?, [String]) async throws -> Room)? - open override func knock(roomIdOrAlias: String) async throws -> Room { - if let error = knockRoomIdOrAliasThrowableError { + open override func knock(roomIdOrAlias: String, reason: String?, serverNames: [String]) async throws -> Room { + if let error = knockRoomIdOrAliasReasonServerNamesThrowableError { throw error } - knockRoomIdOrAliasCallsCount += 1 - knockRoomIdOrAliasReceivedRoomIdOrAlias = roomIdOrAlias + knockRoomIdOrAliasReasonServerNamesCallsCount += 1 + knockRoomIdOrAliasReasonServerNamesReceivedArguments = (roomIdOrAlias: roomIdOrAlias, reason: reason, serverNames: serverNames) DispatchQueue.main.async { - self.knockRoomIdOrAliasReceivedInvocations.append(roomIdOrAlias) + self.knockRoomIdOrAliasReasonServerNamesReceivedInvocations.append((roomIdOrAlias: roomIdOrAlias, reason: reason, serverNames: serverNames)) } - if let knockRoomIdOrAliasClosure = knockRoomIdOrAliasClosure { - return try await knockRoomIdOrAliasClosure(roomIdOrAlias) + if let knockRoomIdOrAliasReasonServerNamesClosure = knockRoomIdOrAliasReasonServerNamesClosure { + return try await knockRoomIdOrAliasReasonServerNamesClosure(roomIdOrAlias, reason, serverNames) } else { - return knockRoomIdOrAliasReturnValue + return knockRoomIdOrAliasReasonServerNamesReturnValue } } diff --git a/ElementX/Sources/Screens/JoinRoomScreen/JoinRoomScreenViewModel.swift b/ElementX/Sources/Screens/JoinRoomScreen/JoinRoomScreenViewModel.swift index 5088efa29f..74e7a69666 100644 --- a/ElementX/Sources/Screens/JoinRoomScreen/JoinRoomScreenViewModel.swift +++ b/ElementX/Sources/Screens/JoinRoomScreen/JoinRoomScreenViewModel.swift @@ -195,6 +195,7 @@ class JoinRoomScreenViewModel: JoinRoomScreenViewModelType, JoinRoomScreenViewMo } } else { switch await clientProxy.knockRoom(roomID, + via: via, message: state.bindings.knockMessage.isBlank ? nil : state.bindings.knockMessage) { case .success: state.mode = .knocked diff --git a/ElementX/Sources/Screens/Timeline/View/TimelineItemViews/EncryptedRoomTimelineView.swift b/ElementX/Sources/Screens/Timeline/View/TimelineItemViews/EncryptedRoomTimelineView.swift index ff3f5d3697..4febbbdc3a 100644 --- a/ElementX/Sources/Screens/Timeline/View/TimelineItemViews/EncryptedRoomTimelineView.swift +++ b/ElementX/Sources/Screens/Timeline/View/TimelineItemViews/EncryptedRoomTimelineView.swift @@ -17,7 +17,9 @@ struct EncryptedRoomTimelineView: View { switch cause { case .unknown: return \.time - case .membership: + case .sentBeforeWeJoined, + .verificationViolation, + .insecureDevice: return \.block } default: @@ -90,7 +92,7 @@ struct EncryptedRoomTimelineView_Previews: PreviewProvider, TestablePreview { private static func expectedItemWith(timestamp: String, isOutgoing: Bool, senderId: String) -> EncryptedRoomTimelineItem { EncryptedRoomTimelineItem(id: .randomEvent, body: L10n.commonUnableToDecryptNoAccess, - encryptionType: .megolmV1AesSha2(sessionID: "foo", cause: .membership), + encryptionType: .megolmV1AesSha2(sessionID: "foo", cause: .sentBeforeWeJoined), timestamp: timestamp, isOutgoing: isOutgoing, isEditable: false, diff --git a/ElementX/Sources/Services/Client/ClientProxy.swift b/ElementX/Sources/Services/Client/ClientProxy.swift index be954997a9..643b8844ef 100644 --- a/ElementX/Sources/Services/Client/ClientProxy.swift +++ b/ElementX/Sources/Services/Client/ClientProxy.swift @@ -415,9 +415,9 @@ class ClientProxy: ClientProxyProtocol { } } - func knockRoom(_ roomID: String, message: String?) async -> Result { + func knockRoom(_ roomID: String, via: [String], message: String?) async -> Result { do { - let _ = try await client.knock(roomIdOrAlias: roomID) + let _ = try await client.knock(roomIdOrAlias: roomID, reason: nil, serverNames: via) await waitForRoomToSync(roomID: roomID, timeout: .seconds(30)) return .success(()) } catch { @@ -428,7 +428,7 @@ class ClientProxy: ClientProxyProtocol { func knockRoomAlias(_ roomAlias: String, message: String?) async -> Result { do { - let room = try await client.knock(roomIdOrAlias: roomAlias) + let room = try await client.knock(roomIdOrAlias: roomAlias, reason: nil, serverNames: []) await waitForRoomToSync(roomID: room.id(), timeout: .seconds(30)) return .success(()) } catch { diff --git a/ElementX/Sources/Services/Client/ClientProxyProtocol.swift b/ElementX/Sources/Services/Client/ClientProxyProtocol.swift index d524dbb435..8bbf4ecb55 100644 --- a/ElementX/Sources/Services/Client/ClientProxyProtocol.swift +++ b/ElementX/Sources/Services/Client/ClientProxyProtocol.swift @@ -136,7 +136,7 @@ protocol ClientProxyProtocol: AnyObject, MediaLoaderProtocol { func joinRoomAlias(_ roomAlias: String) async -> Result - func knockRoom(_ roomID: String, message: String?) async -> Result + func knockRoom(_ roomID: String, via: [String], message: String?) async -> Result func knockRoomAlias(_ roomAlias: String, message: String?) async -> Result diff --git a/ElementX/Sources/Services/Room/RoomSummary/RoomEventStringBuilder.swift b/ElementX/Sources/Services/Room/RoomSummary/RoomEventStringBuilder.swift index 55a05efd2a..a5948fc4e7 100644 --- a/ElementX/Sources/Services/Room/RoomSummary/RoomEventStringBuilder.swift +++ b/ElementX/Sources/Services/Room/RoomSummary/RoomEventStringBuilder.swift @@ -26,7 +26,9 @@ struct RoomEventStringBuilder { switch eventItemProxy.content { case .unableToDecrypt(let encryptedMessage): let errorMessage = switch encryptedMessage { - case .megolmV1AesSha2(_, .membership): L10n.commonUnableToDecryptNoAccess + case .megolmV1AesSha2(_, .sentBeforeWeJoined): L10n.commonUnableToDecryptNoAccess + case .megolmV1AesSha2(_, .verificationViolation): L10n.commonUnableToDecryptVerificationViolation + case .megolmV1AesSha2(_, .unknownDevice), .megolmV1AesSha2(_, .unsignedDevice): L10n.commonUnableToDecryptInsecureDevice default: L10n.commonWaitingForDecryptionKey } return prefix(errorMessage, with: displayName) diff --git a/ElementX/Sources/Services/Timeline/TimelineItemProxy.swift b/ElementX/Sources/Services/Timeline/TimelineItemProxy.swift index bb939082f8..346fad5845 100644 --- a/ElementX/Sources/Services/Timeline/TimelineItemProxy.swift +++ b/ElementX/Sources/Services/Timeline/TimelineItemProxy.swift @@ -83,18 +83,19 @@ class EventTimelineItemProxy { } switch localSendState { - case .sendingFailed(_, let isRecoverable): - return isRecoverable ? .sending : .sendingFailed(.unknown) + case .sendingFailed(let error, let isRecoverable): + switch error { + case .identityViolations(let users): + return .sendingFailed(.verifiedUser(.changedIdentity(users: users))) + case .insecureDevices(let userDeviceMap): + return .sendingFailed(.verifiedUser(.hasUnsignedDevice(devices: userDeviceMap))) + default: + return .sendingFailed(.unknown) + } case .notSentYet: return .sending case .sent: return .sent - case .verifiedUserHasUnsignedDevice(devices: let devices): - return .sendingFailed(.verifiedUser(.hasUnsignedDevice(devices: devices))) - case .verifiedUserChangedIdentity(users: let users): - return .sendingFailed(.verifiedUser(.changedIdentity(users: users))) - case .crossSigningNotSetup, .sendingFromUnverifiedDevice: - return .sendingFailed(.unknown) } }() diff --git a/ElementX/Sources/Services/Timeline/TimelineItems/Items/Other/EncryptedRoomTimelineItem.swift b/ElementX/Sources/Services/Timeline/TimelineItems/Items/Other/EncryptedRoomTimelineItem.swift index 8eefe273fe..eaed672901 100644 --- a/ElementX/Sources/Services/Timeline/TimelineItems/Items/Other/EncryptedRoomTimelineItem.swift +++ b/ElementX/Sources/Services/Timeline/TimelineItems/Items/Other/EncryptedRoomTimelineItem.swift @@ -15,7 +15,9 @@ struct EncryptedRoomTimelineItem: EventBasedTimelineItemProtocol, Equatable { } enum UTDCause: Hashable { - case membership + case sentBeforeWeJoined + case verificationViolation + case insecureDevice case unknown } diff --git a/ElementX/Sources/Services/Timeline/TimelineItems/RoomTimelineItemFactory.swift b/ElementX/Sources/Services/Timeline/TimelineItems/RoomTimelineItemFactory.swift index f43d5e4c83..7a3d1e9ba3 100644 --- a/ElementX/Sources/Services/Timeline/TimelineItems/RoomTimelineItemFactory.swift +++ b/ElementX/Sources/Services/Timeline/TimelineItems/RoomTimelineItemFactory.swift @@ -157,8 +157,14 @@ struct RoomTimelineItemFactory: RoomTimelineItemFactoryProtocol { case .unknown: encryptionType = .megolmV1AesSha2(sessionID: sessionID, cause: .unknown) errorLabel = L10n.commonWaitingForDecryptionKey - case .membership: - encryptionType = .megolmV1AesSha2(sessionID: sessionID, cause: .membership) + case .verificationViolation: + encryptionType = .megolmV1AesSha2(sessionID: sessionID, cause: .verificationViolation) + errorLabel = L10n.commonUnableToDecryptVerificationViolation + case .unsignedDevice, .unknownDevice: + encryptionType = .megolmV1AesSha2(sessionID: sessionID, cause: .insecureDevice) + errorLabel = L10n.commonUnableToDecryptInsecureDevice + case .sentBeforeWeJoined: + encryptionType = .megolmV1AesSha2(sessionID: sessionID, cause: .sentBeforeWeJoined) errorLabel = L10n.commonUnableToDecryptNoAccess } case .olmV1Curve25519AesSha2(let senderKey): diff --git a/project.yml b/project.yml index 250bbe97ca..139fc42119 100644 --- a/project.yml +++ b/project.yml @@ -60,7 +60,7 @@ packages: # Element/Matrix dependencies MatrixRustSDK: url: https://github.com/element-hq/matrix-rust-components-swift - exactVersion: 1.0.60 + exactVersion: 1.0.61 # path: ../matrix-rust-sdk Compound: url: https://github.com/element-hq/compound-ios @@ -68,7 +68,7 @@ packages: # path: ../compound-ios AnalyticsEvents: url: https://github.com/matrix-org/matrix-analytics-events - minorVersion: 0.25.0 + minorVersion: 0.27.0 # path: ../matrix-analytics-events Emojibase: url: https://github.com/matrix-org/emojibase-bindings