mirror of
https://github.com/element-hq/element-x-ios.git
synced 2025-03-10 21:39:12 +00:00
Send UTD occurences to Posthog (#2575)
Co-authored-by: Stefan Ceriu <stefan.ceriu@gmail.com>
This commit is contained in:
parent
c68ec2c382
commit
7611123ae1
@ -7080,7 +7080,7 @@
|
|||||||
repositoryURL = "https://github.com/matrix-org/matrix-rust-components-swift";
|
repositoryURL = "https://github.com/matrix-org/matrix-rust-components-swift";
|
||||||
requirement = {
|
requirement = {
|
||||||
kind = exactVersion;
|
kind = exactVersion;
|
||||||
version = 1.1.49;
|
version = 1.1.50;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
821C67C9A7F8CC3FD41B28B4 /* XCRemoteSwiftPackageReference "emojibase-bindings" */ = {
|
821C67C9A7F8CC3FD41B28B4 /* XCRemoteSwiftPackageReference "emojibase-bindings" */ = {
|
||||||
@ -7128,7 +7128,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.13.0;
|
minimumVersion = 0.14.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" : "ccc4af6aa00987abe7135fa0b7cea97c8cfb3d26",
|
"revision" : "f756bf0756b7349a1d3ccee0d038790d1ab2ec56",
|
||||||
"version" : "0.13.0"
|
"version" : "0.14.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -130,8 +130,8 @@
|
|||||||
"kind" : "remoteSourceControl",
|
"kind" : "remoteSourceControl",
|
||||||
"location" : "https://github.com/matrix-org/matrix-rust-components-swift",
|
"location" : "https://github.com/matrix-org/matrix-rust-components-swift",
|
||||||
"state" : {
|
"state" : {
|
||||||
"revision" : "0361eac2610f0007f2a6880a88c750a1bbb405b9",
|
"revision" : "e6b350d257aeb7395e003c3d0c26ae65c2e2e349",
|
||||||
"version" : "1.1.49"
|
"version" : "1.1.50"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -139,6 +139,24 @@ class UserSessionFlowCoordinator: FlowCoordinatorProtocol {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
.store(in: &cancellables)
|
.store(in: &cancellables)
|
||||||
|
|
||||||
|
userSession.clientProxy.actionsPublisher
|
||||||
|
.receive(on: DispatchQueue.main)
|
||||||
|
.sink { action in
|
||||||
|
guard case let .receivedDecryptionError(info) = action else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
let timeToDecryptMs: Int
|
||||||
|
if let unsignedTimeToDecryptMs = info.timeToDecryptMs {
|
||||||
|
timeToDecryptMs = Int(unsignedTimeToDecryptMs)
|
||||||
|
} else {
|
||||||
|
timeToDecryptMs = -1
|
||||||
|
}
|
||||||
|
|
||||||
|
analytics.trackError(context: nil, domain: .E2EE, name: .OlmKeysNotSentError, timeToDecryptMillis: timeToDecryptMs)
|
||||||
|
}
|
||||||
|
.store(in: &cancellables)
|
||||||
}
|
}
|
||||||
|
|
||||||
func start() {
|
func start() {
|
||||||
|
@ -131,6 +131,17 @@ extension AnalyticsService {
|
|||||||
capture(event: AnalyticsEvent.Interaction(index: index, interactionType: .Touch, name: name))
|
capture(event: AnalyticsEvent.Interaction(index: index, interactionType: .Touch, name: name))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Track the presentation of a screen
|
||||||
|
/// - Parameter context: To provide additional context or description for the error
|
||||||
|
/// - Parameter domain: The domain to which the error belongs to.
|
||||||
|
/// - Parameter name: The name of the error
|
||||||
|
/// - Parameter timeToDecryptMillis: The time it took to decrypt the event in milliseconds, needs to be used only to track UTD errors, otherwise if the error is nort related to UTD it should be nil.
|
||||||
|
/// 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))
|
||||||
|
}
|
||||||
|
|
||||||
/// Track the creation of a room
|
/// Track the creation of a room
|
||||||
/// - Parameter isDM: true if the created room is a direct message, false otherwise
|
/// - Parameter isDM: true if the created room is a direct message, false otherwise
|
||||||
func trackCreatedRoom(isDM: Bool) {
|
func trackCreatedRoom(isDM: Bool) {
|
||||||
|
@ -589,6 +589,7 @@ class ClientProxy: ClientProxyProtocol {
|
|||||||
let syncService = try await client
|
let syncService = try await client
|
||||||
.syncService()
|
.syncService()
|
||||||
.withCrossProcessLock(appIdentifier: "MainApp")
|
.withCrossProcessLock(appIdentifier: "MainApp")
|
||||||
|
.withUtdHook(delegate: ClientDecryptionErrorDelegate(actionsSubject: actionsSubject))
|
||||||
.finish()
|
.finish()
|
||||||
let roomListService = syncService.roomListService()
|
let roomListService = syncService.roomListService()
|
||||||
|
|
||||||
@ -803,6 +804,18 @@ private class ClientDelegateWrapper: ClientDelegate {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class ClientDecryptionErrorDelegate: UnableToDecryptDelegate {
|
||||||
|
private let actionsSubject: PassthroughSubject<ClientProxyAction, Never>
|
||||||
|
|
||||||
|
init(actionsSubject: PassthroughSubject<ClientProxyAction, Never>) {
|
||||||
|
self.actionsSubject = actionsSubject
|
||||||
|
}
|
||||||
|
|
||||||
|
func onUtd(info: UnableToDecryptInfo) {
|
||||||
|
actionsSubject.send(.receivedDecryptionError(info))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private class IgnoredUsersListenerProxy: IgnoredUsersListener {
|
private class IgnoredUsersListenerProxy: IgnoredUsersListener {
|
||||||
private let onUpdateClosure: ([String]) -> Void
|
private let onUpdateClosure: ([String]) -> Void
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@ import MatrixRustSDK
|
|||||||
enum ClientProxyAction {
|
enum ClientProxyAction {
|
||||||
case receivedSyncUpdate
|
case receivedSyncUpdate
|
||||||
case receivedAuthError(isSoftLogout: Bool)
|
case receivedAuthError(isSoftLogout: Bool)
|
||||||
|
case receivedDecryptionError(UnableToDecryptInfo)
|
||||||
|
|
||||||
var isSyncUpdate: Bool {
|
var isSyncUpdate: Bool {
|
||||||
if case .receivedSyncUpdate = self {
|
if case .receivedSyncUpdate = self {
|
||||||
|
@ -223,9 +223,9 @@ class LoggingTests: XCTestCase {
|
|||||||
formatted: FormattedBody(format: .html, body: "<b>\(emoteString)</b>"))
|
formatted: FormattedBody(format: .html, body: "<b>\(emoteString)</b>"))
|
||||||
|
|
||||||
let pointer = Unmanaged.passRetained(NSURL(fileURLWithPath: "/tmp/file")).toOpaque()
|
let pointer = Unmanaged.passRetained(NSURL(fileURLWithPath: "/tmp/file")).toOpaque()
|
||||||
let rustImageMessage = ImageMessageContent(body: "ImageString", source: MediaSource(unsafeFromRawPointer: pointer), info: nil)
|
let rustImageMessage = ImageMessageContent(body: "ImageString", formatted: nil, filename: nil, source: MediaSource(unsafeFromRawPointer: pointer), info: nil)
|
||||||
let rustVideoMessage = VideoMessageContent(body: "VideoString", source: MediaSource(unsafeFromRawPointer: pointer), info: nil)
|
let rustVideoMessage = VideoMessageContent(body: "VideoString", formatted: nil, filename: nil, source: MediaSource(unsafeFromRawPointer: pointer), info: nil)
|
||||||
let rustFileMessage = FileMessageContent(body: "FileString", filename: "FileName", source: MediaSource(unsafeFromRawPointer: pointer), info: nil)
|
let rustFileMessage = FileMessageContent(body: "FileString", formatted: nil, filename: "FileName", source: MediaSource(unsafeFromRawPointer: pointer), info: nil)
|
||||||
|
|
||||||
// When logging that value
|
// When logging that value
|
||||||
MXLog.info(rustTextMessage)
|
MXLog.info(rustTextMessage)
|
||||||
|
@ -48,7 +48,7 @@ packages:
|
|||||||
# Element/Matrix dependencies
|
# Element/Matrix dependencies
|
||||||
MatrixRustSDK:
|
MatrixRustSDK:
|
||||||
url: https://github.com/matrix-org/matrix-rust-components-swift
|
url: https://github.com/matrix-org/matrix-rust-components-swift
|
||||||
exactVersion: 1.1.49
|
exactVersion: 1.1.50
|
||||||
# path: ../matrix-rust-sdk
|
# path: ../matrix-rust-sdk
|
||||||
Compound:
|
Compound:
|
||||||
url: https://github.com/element-hq/compound-ios
|
url: https://github.com/element-hq/compound-ios
|
||||||
@ -56,7 +56,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.13.0
|
minorVersion: 0.14.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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user