Add specific UX for Expected UTDs due to membership (#2740)

* Add specific UX for Expected UTDs due to membership

* Update analytics package and snapshots.

* Add changelog
This commit is contained in:
Valere
2024-04-26 18:22:01 +02:00
committed by GitHub
parent 1b8d895e98
commit bd9a171c7c
16 changed files with 79 additions and 29 deletions
+1 -1
View File
@@ -7372,7 +7372,7 @@
repositoryURL = "https://github.com/matrix-org/matrix-analytics-events"; repositoryURL = "https://github.com/matrix-org/matrix-analytics-events";
requirement = { requirement = {
kind = upToNextMinorVersion; kind = upToNextMinorVersion;
minimumVersion = 0.14.0; minimumVersion = 0.20.0;
}; };
}; };
C13F55E4518415CB4C278E73 /* XCRemoteSwiftPackageReference "DTCoreText" */ = { C13F55E4518415CB4C278E73 /* XCRemoteSwiftPackageReference "DTCoreText" */ = {
@@ -121,8 +121,8 @@
"kind" : "remoteSourceControl", "kind" : "remoteSourceControl",
"location" : "https://github.com/matrix-org/matrix-analytics-events", "location" : "https://github.com/matrix-org/matrix-analytics-events",
"state" : { "state" : {
"revision" : "f756bf0756b7349a1d3ccee0d038790d1ab2ec56", "revision" : "e4e49896331c9dcf7346c90529a9aad7944a3259",
"version" : "0.14.0" "version" : "0.20.0"
} }
}, },
{ {
@@ -156,8 +156,13 @@ class UserSessionFlowCoordinator: FlowCoordinatorProtocol {
} else { } else {
timeToDecryptMs = -1 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) .store(in: &cancellables)
} }
@@ -14,14 +14,29 @@
// limitations under the License. // limitations under the License.
// //
import Compound
import SwiftUI import SwiftUI
struct EncryptedRoomTimelineView: View { struct EncryptedRoomTimelineView: View {
let timelineItem: EncryptedRoomTimelineItem let timelineItem: EncryptedRoomTimelineItem
var icon: KeyPath<CompoundIcons, Image> {
switch timelineItem.encryptionType {
case .megolmV1AesSha2(_, let cause):
switch cause {
case .unknown:
return \.time
case .membership:
return \.block
}
default:
return \.time
}
}
var body: some View { var body: some View {
TimelineStyler(timelineItem: timelineItem) { 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()) .labelStyle(RoomTimelineViewLabelStyle())
.font(.compound.bodyLG) .font(.compound.bodyLG)
} }
@@ -68,6 +83,10 @@ struct EncryptedRoomTimelineView_Previews: PreviewProvider, TestablePreview {
timestamp: "Later", timestamp: "Later",
isOutgoing: true, isOutgoing: true,
senderId: "Anne")) senderId: "Anne"))
EncryptedRoomTimelineView(timelineItem: expectedItemWith(timestamp: "Now",
isOutgoing: false,
senderId: "Bob"))
} }
} }
@@ -81,4 +100,15 @@ struct EncryptedRoomTimelineView_Previews: PreviewProvider, TestablePreview {
canBeRepliedTo: false, canBeRepliedTo: false,
sender: .init(id: senderId)) 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))
}
} }
@@ -139,7 +139,17 @@ extension AnalyticsService {
/// Can be found in `UnableToDecryptInfo`. In case the `UnableToDecryptInfo` contains the value as nil, pass it as `-1` /// 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) { func trackError(context: String?, domain: AnalyticsEvent.Error.Domain, name: AnalyticsEvent.Error.Name, timeToDecryptMillis: Int? = nil) {
// CryptoModule is deprecated // 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 /// Track the creation of a room
@@ -161,13 +161,17 @@ struct RoomTimelineItemFactory: RoomTimelineItemFactoryProtocol {
_ encryptedMessage: EncryptedMessage, _ encryptedMessage: EncryptedMessage,
_ isOutgoing: Bool) -> RoomTimelineItemProtocol { _ isOutgoing: Bool) -> RoomTimelineItemProtocol {
var encryptionType = EncryptedRoomTimelineItem.EncryptionType.unknown var encryptionType = EncryptedRoomTimelineItem.EncryptionType.unknown
var errorLabel = L10n.commonWaitingForDecryptionKey
switch encryptedMessage { switch encryptedMessage {
case .megolmV1AesSha2(let sessionID, let cause): case .megolmV1AesSha2(let sessionID, let cause):
let cause: EncryptedRoomTimelineItem.UTDCause = switch cause { switch cause {
case .unknown: .unknown case .unknown:
case .membership: .membership 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): case .olmV1Curve25519AesSha2(let senderKey):
encryptionType = .olmV1Curve25519AesSha2(senderKey: senderKey) encryptionType = .olmV1Curve25519AesSha2(senderKey: senderKey)
case .unknown: case .unknown:
@@ -175,7 +179,7 @@ struct RoomTimelineItemFactory: RoomTimelineItemFactoryProtocol {
} }
return EncryptedRoomTimelineItem(id: eventItemProxy.id, return EncryptedRoomTimelineItem(id: eventItemProxy.id,
body: L10n.commonWaitingForDecryptionKey, body: errorLabel,
encryptionType: encryptionType, encryptionType: encryptionType,
timestamp: eventItemProxy.timestamp.formatted(date: .omitted, time: .shortened), timestamp: eventItemProxy.timestamp.formatted(date: .omitted, time: .shortened),
isOutgoing: isOutgoing, isOutgoing: isOutgoing,
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:fa2e560bb9d8712fb15d42659c71b3d792107cc19c2ceabf1e75ccf8b968aa22 oid sha256:60ff13fdf6f96b8cfabcca3f2af9597a7a1269c8e8bb8cc5ea0b6cba7afc8b54
size 141818 size 172573
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:43b49691652bd10bb2b9084fd2d99c1aa6ef6be856876ac37e982c77fa7f948b oid sha256:79dfdab60e68f7570b35c1be739782dd14ae4fc4538f4cdaf7bed2fa80c4e3a4
size 147924 size 176532
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:b37afbd96b254929526afb83349b7630d12052c4de8e1cb68b4cbcede892ab5b oid sha256:702f5ebba9aa0008981f67563534ef9f0b3ebfb6e50f6b4224a958372d40e918
size 170707 size 215194
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:fdd421633d635ddbc97e6b70af7c250c5f6745a6cddf836bb52068e51b8e064b oid sha256:5c5becb4be95f535c898af26910fff9440b77df868af160ae19b0320131df581
size 174448 size 220091
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:0cb4899a4b8c8137032a3fd1bbebb90ee6cbbb046fa63e9ee93cbc006967dc0b oid sha256:0dafdd142c7f91b7adce004da3f7b92b557c286f38132c3133c98e1eda13f894
size 95288 size 118943
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:795fa3d15330da37ce618aca7cbcad354cb682ab9b8a25db9b95fdf574d674e1 oid sha256:084a0170d47ecebf2f98ac1a1b529bce872acd5da84cd300a05c395ca22bf06a
size 96872 size 117520
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:302db60dd203b46fc0f2e86c1fe4b3a10e0c1e7a87a58c94271aff16b09ad286 oid sha256:8cd8e66a64e4b54282f75ace8a1f09ec1be36fd860e3efa2f3d8e17c187a0e0a
size 119698 size 162975
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:782db7ccbb921306596333d6facf9230103b3811f3b84d6039795fb0594d376b oid sha256:5e580c0744661dc37ce13be1adf136557b469c15a22221052ba3586997261dfe
size 117937 size 154917
+1
View File
@@ -0,0 +1 @@
Add specific UX for Expected UTDs due to membership
+1 -1
View File
@@ -57,7 +57,7 @@ packages:
# path: ../compound-ios # path: ../compound-ios
AnalyticsEvents: AnalyticsEvents:
url: https://github.com/matrix-org/matrix-analytics-events url: https://github.com/matrix-org/matrix-analytics-events
minorVersion: 0.14.0 minorVersion: 0.20.0
# path: ../matrix-analytics-events # path: ../matrix-analytics-events
Emojibase: Emojibase:
url: https://github.com/matrix-org/emojibase-bindings url: https://github.com/matrix-org/emojibase-bindings