Skip to content

Commit

Permalink
Update SDK and analytics events.
Browse files Browse the repository at this point in the history
  • Loading branch information
pixlwave committed Oct 24, 2024
1 parent 2cc3cda commit 424dbd7
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 46 deletions.
4 changes: 2 additions & 2 deletions ElementX.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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" */ = {
Expand Down Expand Up @@ -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" */ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
},
{
Expand Down Expand Up @@ -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"
}
},
{
Expand All @@ -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"
}
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,11 @@ class UserSessionFlowCoordinator: FlowCoordinatorProtocol {
case .unknown:
analytics.trackError(context: nil, domain: .E2EE, name: .UnknownError, timeToDecryptMillis: timeToDecryptMs)
case .unknownDevice:
analytics.trackError(context: nil, domain: .E2EE, name: .UnknownError, timeToDecryptMillis: timeToDecryptMs)
analytics.trackError(context: nil, domain: .E2EE, name: .ExpectedSentByInsecureDevice, timeToDecryptMillis: timeToDecryptMs)
case .unsignedDevice:
analytics.trackError(context: nil, domain: .E2EE, name: .RoomKeysWithheldForUnverifiedDevice, timeToDecryptMillis: timeToDecryptMs)
analytics.trackError(context: nil, domain: .E2EE, name: .ExpectedSentByInsecureDevice, timeToDecryptMillis: timeToDecryptMs)
case .verificationViolation:
analytics.trackError(context: nil, domain: .E2EE, name: .RoomKeysWithheldForUnverifiedDevice, timeToDecryptMillis: timeToDecryptMs)
analytics.trackError(context: nil, domain: .E2EE, name: .ExpectedVerificationViolation, timeToDecryptMillis: timeToDecryptMs)
case .sentBeforeWeJoined:
analytics.trackError(context: nil, domain: .E2EE, name: .ExpectedDueToMembership, timeToDecryptMillis: timeToDecryptMs)
}
Expand Down
48 changes: 24 additions & 24 deletions ElementX/Sources/Mocks/Generated/GeneratedMocks.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2837,72 +2837,72 @@ 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!
}
}
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<Void, ClientProxyError>!
var knockRoomMessageReturnValue: Result<Void, ClientProxyError>! {
var knockRoomViaMessageUnderlyingReturnValue: Result<Void, ClientProxyError>!
var knockRoomViaMessageReturnValue: Result<Void, ClientProxyError>! {
get {
if Thread.isMainThread {
return knockRoomMessageUnderlyingReturnValue
return knockRoomViaMessageUnderlyingReturnValue
} else {
var returnValue: Result<Void, ClientProxyError>? = nil
DispatchQueue.main.sync {
returnValue = knockRoomMessageUnderlyingReturnValue
returnValue = knockRoomViaMessageUnderlyingReturnValue
}

return returnValue!
}
}
set {
if Thread.isMainThread {
knockRoomMessageUnderlyingReturnValue = newValue
knockRoomViaMessageUnderlyingReturnValue = newValue
} else {
DispatchQueue.main.sync {
knockRoomMessageUnderlyingReturnValue = newValue
knockRoomViaMessageUnderlyingReturnValue = newValue
}
}
}
}
var knockRoomMessageClosure: ((String, String?) async -> Result<Void, ClientProxyError>)?
var knockRoomViaMessageClosure: ((String, [String], String?) async -> Result<Void, ClientProxyError>)?

func knockRoom(_ roomID: String, message: String?) async -> Result<Void, ClientProxyError> {
knockRoomMessageCallsCount += 1
knockRoomMessageReceivedArguments = (roomID: roomID, message: message)
func knockRoom(_ roomID: String, via: [String], message: String?) async -> Result<Void, ClientProxyError> {
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions ElementX/Sources/Services/Client/ClientProxy.swift
Original file line number Diff line number Diff line change
Expand Up @@ -415,9 +415,9 @@ class ClientProxy: ClientProxyProtocol {
}
}

func knockRoom(_ roomID: String, message: String?) async -> Result<Void, ClientProxyError> {
func knockRoom(_ roomID: String, via: [String], message: String?) async -> Result<Void, ClientProxyError> {
do {
let _ = try await client.knock(roomIdOrAlias: roomID, reason: nil, serverNames: [])
let _ = try await client.knock(roomIdOrAlias: roomID, reason: nil, serverNames: via)
await waitForRoomToSync(roomID: roomID, timeout: .seconds(30))
return .success(())
} catch {
Expand Down
2 changes: 1 addition & 1 deletion ElementX/Sources/Services/Client/ClientProxyProtocol.swift
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ protocol ClientProxyProtocol: AnyObject, MediaLoaderProtocol {

func joinRoomAlias(_ roomAlias: String) async -> Result<Void, ClientProxyError>

func knockRoom(_ roomID: String, message: String?) async -> Result<Void, ClientProxyError>
func knockRoom(_ roomID: String, via: [String], message: String?) async -> Result<Void, ClientProxyError>

func knockRoomAlias(_ roomAlias: String, message: String?) async -> Result<Void, ClientProxyError>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,8 @@ struct RoomEventStringBuilder {
switch eventItemProxy.content {
case .unableToDecrypt(let encryptedMessage):
let errorMessage = switch encryptedMessage {
case .unknown:
L10n.commonWaitingForDecryptionKey
default:
L10n.commonUnableToDecryptNoAccess
case .megolmV1AesSha2(_, .sentBeforeWeJoined): L10n.commonUnableToDecryptNoAccess
default: L10n.commonWaitingForDecryptionKey
}
return prefix(errorMessage, with: displayName)
case .redactedMessage:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,10 @@ struct RoomTimelineItemFactory: RoomTimelineItemFactoryProtocol {
switch encryptedMessage {
case .megolmV1AesSha2(let sessionID, let cause):
switch cause {
case .unknown:
case .unknown, .verificationViolation, .unsignedDevice, .unknownDevice:
encryptionType = .megolmV1AesSha2(sessionID: sessionID, cause: .unknown)
errorLabel = L10n.commonWaitingForDecryptionKey
default:
case .sentBeforeWeJoined:
encryptionType = .megolmV1AesSha2(sessionID: sessionID, cause: .membership)
errorLabel = L10n.commonUnableToDecryptNoAccess
}
Expand Down
4 changes: 2 additions & 2 deletions project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,15 @@ 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
revision: e3f9665621872f60d3652579c3f0dc7bf806e72c
# 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
Expand Down

0 comments on commit 424dbd7

Please sign in to comment.