diff --git a/ElementX.xcodeproj/project.pbxproj b/ElementX.xcodeproj/project.pbxproj index 452690d998..214c3c4eb3 100644 --- a/ElementX.xcodeproj/project.pbxproj +++ b/ElementX.xcodeproj/project.pbxproj @@ -7372,7 +7372,7 @@ repositoryURL = "https://github.com/matrix-org/matrix-analytics-events"; requirement = { kind = upToNextMinorVersion; - minimumVersion = 0.14.0; + minimumVersion = 0.20.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 38e7585201..1f220e10a1 100644 --- a/ElementX.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/ElementX.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -121,8 +121,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/matrix-org/matrix-analytics-events", "state" : { - "revision" : "f756bf0756b7349a1d3ccee0d038790d1ab2ec56", - "version" : "0.14.0" + "revision" : "e4e49896331c9dcf7346c90529a9aad7944a3259", + "version" : "0.20.0" } }, { diff --git a/ElementX/Sources/FlowCoordinators/UserSessionFlowCoordinator.swift b/ElementX/Sources/FlowCoordinators/UserSessionFlowCoordinator.swift index 2cd780d67d..0887ede49d 100644 --- a/ElementX/Sources/FlowCoordinators/UserSessionFlowCoordinator.swift +++ b/ElementX/Sources/FlowCoordinators/UserSessionFlowCoordinator.swift @@ -156,8 +156,13 @@ class UserSessionFlowCoordinator: FlowCoordinatorProtocol { } else { timeToDecryptMs = -1 } - - analytics.trackError(context: nil, domain: .E2EE, name: .OlmKeysNotSentError, timeToDecryptMillis: timeToDecryptMs) + + 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) + } } .store(in: &cancellables) } diff --git a/ElementX/Sources/Screens/RoomScreen/View/Timeline/EncryptedRoomTimelineView.swift b/ElementX/Sources/Screens/RoomScreen/View/Timeline/EncryptedRoomTimelineView.swift index b0ccd7e57e..06965c48de 100644 --- a/ElementX/Sources/Screens/RoomScreen/View/Timeline/EncryptedRoomTimelineView.swift +++ b/ElementX/Sources/Screens/RoomScreen/View/Timeline/EncryptedRoomTimelineView.swift @@ -14,14 +14,29 @@ // limitations under the License. // +import Compound import SwiftUI struct EncryptedRoomTimelineView: View { let timelineItem: EncryptedRoomTimelineItem + var icon: KeyPath { + switch timelineItem.encryptionType { + case .megolmV1AesSha2(_, let cause): + switch cause { + case .unknown: + return \.time + case .membership: + return \.block + } + default: + return \.time + } + } + var body: some View { TimelineStyler(timelineItem: timelineItem) { - Label(timelineItem.body, icon: \.time, iconSize: .small, relativeTo: .compound.bodyLG) + Label(timelineItem.body, icon: icon, iconSize: .small, relativeTo: .compound.bodyLG) .labelStyle(RoomTimelineViewLabelStyle()) .font(.compound.bodyLG) } @@ -68,6 +83,10 @@ struct EncryptedRoomTimelineView_Previews: PreviewProvider, TestablePreview { timestamp: "Later", isOutgoing: true, senderId: "Anne")) + + EncryptedRoomTimelineView(timelineItem: expectedItemWith(timestamp: "Now", + isOutgoing: false, + senderId: "Bob")) } } @@ -81,4 +100,15 @@ struct EncryptedRoomTimelineView_Previews: PreviewProvider, TestablePreview { canBeRepliedTo: false, sender: .init(id: senderId)) } + + private static func expectedItemWith(timestamp: String, isOutgoing: Bool, senderId: String) -> EncryptedRoomTimelineItem { + EncryptedRoomTimelineItem(id: .random, + body: L10n.commonUnableToDecryptNoAccess, + encryptionType: .megolmV1AesSha2(sessionID: "foo", cause: .membership), + timestamp: timestamp, + isOutgoing: isOutgoing, + isEditable: false, + canBeRepliedTo: false, + sender: .init(id: senderId)) + } } diff --git a/ElementX/Sources/Services/Analytics/AnalyticsService.swift b/ElementX/Sources/Services/Analytics/AnalyticsService.swift index aa5454cc53..e32f9a52bf 100644 --- a/ElementX/Sources/Services/Analytics/AnalyticsService.swift +++ b/ElementX/Sources/Services/Analytics/AnalyticsService.swift @@ -139,7 +139,17 @@ extension AnalyticsService { /// Can be found in `UnableToDecryptInfo`. In case the `UnableToDecryptInfo` contains the value as nil, pass it as `-1` func trackError(context: String?, domain: AnalyticsEvent.Error.Domain, name: AnalyticsEvent.Error.Name, timeToDecryptMillis: Int? = nil) { // CryptoModule is deprecated - capture(event: AnalyticsEvent.Error(context: context, cryptoModule: nil, cryptoSDK: .Rust, domain: domain, name: name, timeToDecryptMillis: timeToDecryptMillis)) + capture(event: AnalyticsEvent.Error(context: context, + cryptoModule: .Rust, + cryptoSDK: .Rust, + domain: domain, + eventLocalAgeMillis: nil, + isFederated: nil, + isMatrixDotOrg: nil, + name: name, + timeToDecryptMillis: timeToDecryptMillis, + userTrustsOwnIdentity: nil, + wasVisibleToUser: nil)) } /// Track the creation of a room diff --git a/ElementX/Sources/Services/Timeline/TimelineItems/RoomTimelineItemFactory.swift b/ElementX/Sources/Services/Timeline/TimelineItems/RoomTimelineItemFactory.swift index 3faca14c29..43dcf36f71 100644 --- a/ElementX/Sources/Services/Timeline/TimelineItems/RoomTimelineItemFactory.swift +++ b/ElementX/Sources/Services/Timeline/TimelineItems/RoomTimelineItemFactory.swift @@ -161,13 +161,17 @@ struct RoomTimelineItemFactory: RoomTimelineItemFactoryProtocol { _ encryptedMessage: EncryptedMessage, _ isOutgoing: Bool) -> RoomTimelineItemProtocol { var encryptionType = EncryptedRoomTimelineItem.EncryptionType.unknown + var errorLabel = L10n.commonWaitingForDecryptionKey switch encryptedMessage { case .megolmV1AesSha2(let sessionID, let cause): - let cause: EncryptedRoomTimelineItem.UTDCause = switch cause { - case .unknown: .unknown - case .membership: .membership + switch cause { + case .unknown: + encryptionType = .megolmV1AesSha2(sessionID: sessionID, cause: .unknown) + errorLabel = L10n.commonWaitingForDecryptionKey + case .membership: + encryptionType = .megolmV1AesSha2(sessionID: sessionID, cause: .membership) + errorLabel = L10n.commonUnableToDecryptNoAccess } - encryptionType = .megolmV1AesSha2(sessionID: sessionID, cause: cause) case .olmV1Curve25519AesSha2(let senderKey): encryptionType = .olmV1Curve25519AesSha2(senderKey: senderKey) case .unknown: @@ -175,7 +179,7 @@ struct RoomTimelineItemFactory: RoomTimelineItemFactoryProtocol { } return EncryptedRoomTimelineItem(id: eventItemProxy.id, - body: L10n.commonWaitingForDecryptionKey, + body: errorLabel, encryptionType: encryptionType, timestamp: eventItemProxy.timestamp.formatted(date: .omitted, time: .shortened), isOutgoing: isOutgoing, diff --git a/PreviewTests/__Snapshots__/PreviewTests/test_encryptedRoomTimelineView-iPad-en-GB.1.png b/PreviewTests/__Snapshots__/PreviewTests/test_encryptedRoomTimelineView-iPad-en-GB.1.png index f8c44668f8..7c7a71034d 100644 --- a/PreviewTests/__Snapshots__/PreviewTests/test_encryptedRoomTimelineView-iPad-en-GB.1.png +++ b/PreviewTests/__Snapshots__/PreviewTests/test_encryptedRoomTimelineView-iPad-en-GB.1.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:fa2e560bb9d8712fb15d42659c71b3d792107cc19c2ceabf1e75ccf8b968aa22 -size 141818 +oid sha256:60ff13fdf6f96b8cfabcca3f2af9597a7a1269c8e8bb8cc5ea0b6cba7afc8b54 +size 172573 diff --git a/PreviewTests/__Snapshots__/PreviewTests/test_encryptedRoomTimelineView-iPad-en-GB.2.png b/PreviewTests/__Snapshots__/PreviewTests/test_encryptedRoomTimelineView-iPad-en-GB.2.png index 42160289db..2529ce6699 100644 --- a/PreviewTests/__Snapshots__/PreviewTests/test_encryptedRoomTimelineView-iPad-en-GB.2.png +++ b/PreviewTests/__Snapshots__/PreviewTests/test_encryptedRoomTimelineView-iPad-en-GB.2.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:43b49691652bd10bb2b9084fd2d99c1aa6ef6be856876ac37e982c77fa7f948b -size 147924 +oid sha256:79dfdab60e68f7570b35c1be739782dd14ae4fc4538f4cdaf7bed2fa80c4e3a4 +size 176532 diff --git a/PreviewTests/__Snapshots__/PreviewTests/test_encryptedRoomTimelineView-iPad-pseudo.1.png b/PreviewTests/__Snapshots__/PreviewTests/test_encryptedRoomTimelineView-iPad-pseudo.1.png index 3f728c77a0..0df6411c6e 100644 --- a/PreviewTests/__Snapshots__/PreviewTests/test_encryptedRoomTimelineView-iPad-pseudo.1.png +++ b/PreviewTests/__Snapshots__/PreviewTests/test_encryptedRoomTimelineView-iPad-pseudo.1.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b37afbd96b254929526afb83349b7630d12052c4de8e1cb68b4cbcede892ab5b -size 170707 +oid sha256:702f5ebba9aa0008981f67563534ef9f0b3ebfb6e50f6b4224a958372d40e918 +size 215194 diff --git a/PreviewTests/__Snapshots__/PreviewTests/test_encryptedRoomTimelineView-iPad-pseudo.2.png b/PreviewTests/__Snapshots__/PreviewTests/test_encryptedRoomTimelineView-iPad-pseudo.2.png index 656602f105..96fd204edf 100644 --- a/PreviewTests/__Snapshots__/PreviewTests/test_encryptedRoomTimelineView-iPad-pseudo.2.png +++ b/PreviewTests/__Snapshots__/PreviewTests/test_encryptedRoomTimelineView-iPad-pseudo.2.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:fdd421633d635ddbc97e6b70af7c250c5f6745a6cddf836bb52068e51b8e064b -size 174448 +oid sha256:5c5becb4be95f535c898af26910fff9440b77df868af160ae19b0320131df581 +size 220091 diff --git a/PreviewTests/__Snapshots__/PreviewTests/test_encryptedRoomTimelineView-iPhone-15-en-GB.1.png b/PreviewTests/__Snapshots__/PreviewTests/test_encryptedRoomTimelineView-iPhone-15-en-GB.1.png index 3fa91fb7af..732d9e92fe 100644 --- a/PreviewTests/__Snapshots__/PreviewTests/test_encryptedRoomTimelineView-iPhone-15-en-GB.1.png +++ b/PreviewTests/__Snapshots__/PreviewTests/test_encryptedRoomTimelineView-iPhone-15-en-GB.1.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0cb4899a4b8c8137032a3fd1bbebb90ee6cbbb046fa63e9ee93cbc006967dc0b -size 95288 +oid sha256:0dafdd142c7f91b7adce004da3f7b92b557c286f38132c3133c98e1eda13f894 +size 118943 diff --git a/PreviewTests/__Snapshots__/PreviewTests/test_encryptedRoomTimelineView-iPhone-15-en-GB.2.png b/PreviewTests/__Snapshots__/PreviewTests/test_encryptedRoomTimelineView-iPhone-15-en-GB.2.png index 262700e3fb..43dcf0bc84 100644 --- a/PreviewTests/__Snapshots__/PreviewTests/test_encryptedRoomTimelineView-iPhone-15-en-GB.2.png +++ b/PreviewTests/__Snapshots__/PreviewTests/test_encryptedRoomTimelineView-iPhone-15-en-GB.2.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:795fa3d15330da37ce618aca7cbcad354cb682ab9b8a25db9b95fdf574d674e1 -size 96872 +oid sha256:084a0170d47ecebf2f98ac1a1b529bce872acd5da84cd300a05c395ca22bf06a +size 117520 diff --git a/PreviewTests/__Snapshots__/PreviewTests/test_encryptedRoomTimelineView-iPhone-15-pseudo.1.png b/PreviewTests/__Snapshots__/PreviewTests/test_encryptedRoomTimelineView-iPhone-15-pseudo.1.png index 57129a5da3..059607460e 100644 --- a/PreviewTests/__Snapshots__/PreviewTests/test_encryptedRoomTimelineView-iPhone-15-pseudo.1.png +++ b/PreviewTests/__Snapshots__/PreviewTests/test_encryptedRoomTimelineView-iPhone-15-pseudo.1.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:302db60dd203b46fc0f2e86c1fe4b3a10e0c1e7a87a58c94271aff16b09ad286 -size 119698 +oid sha256:8cd8e66a64e4b54282f75ace8a1f09ec1be36fd860e3efa2f3d8e17c187a0e0a +size 162975 diff --git a/PreviewTests/__Snapshots__/PreviewTests/test_encryptedRoomTimelineView-iPhone-15-pseudo.2.png b/PreviewTests/__Snapshots__/PreviewTests/test_encryptedRoomTimelineView-iPhone-15-pseudo.2.png index 4286ef7242..487974cc93 100644 --- a/PreviewTests/__Snapshots__/PreviewTests/test_encryptedRoomTimelineView-iPhone-15-pseudo.2.png +++ b/PreviewTests/__Snapshots__/PreviewTests/test_encryptedRoomTimelineView-iPhone-15-pseudo.2.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:782db7ccbb921306596333d6facf9230103b3811f3b84d6039795fb0594d376b -size 117937 +oid sha256:5e580c0744661dc37ce13be1adf136557b469c15a22221052ba3586997261dfe +size 154917 diff --git a/changelog.d/2740.feature b/changelog.d/2740.feature new file mode 100644 index 0000000000..48c916197b --- /dev/null +++ b/changelog.d/2740.feature @@ -0,0 +1 @@ +Add specific UX for Expected UTDs due to membership \ No newline at end of file diff --git a/project.yml b/project.yml index c3694145cf..2a98b78075 100644 --- a/project.yml +++ b/project.yml @@ -57,7 +57,7 @@ packages: # path: ../compound-ios AnalyticsEvents: url: https://github.com/matrix-org/matrix-analytics-events - minorVersion: 0.14.0 + minorVersion: 0.20.0 # path: ../matrix-analytics-events Emojibase: url: https://github.com/matrix-org/emojibase-bindings