mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-06 20:38:41 +00:00
Added methods for tracking call durations.
This commit is contained in:
@@ -123,6 +123,7 @@ class AuthenticationCoordinator: Coordinator {
|
||||
}
|
||||
|
||||
private func login(username: String, password: String, completion: @escaping (Result<Void, AuthenticationCoordinatorError>) -> Void) {
|
||||
Benchmark.startTrackingForIdentifier("Login", message: "Started new login")
|
||||
|
||||
delegate?.authenticationCoordinatorDidStartLoading(self)
|
||||
|
||||
@@ -148,6 +149,7 @@ class AuthenticationCoordinator: Coordinator {
|
||||
}
|
||||
|
||||
private func restorePreviousLogin(_ usernameTokenTuple: (username: String, token: String), completion: @escaping (Result<Void, AuthenticationCoordinatorError>) -> Void) {
|
||||
Benchmark.startTrackingForIdentifier("Login", message: "Started restoring previous login")
|
||||
|
||||
delegate?.authenticationCoordinatorDidStartLoading(self)
|
||||
|
||||
@@ -172,6 +174,7 @@ class AuthenticationCoordinator: Coordinator {
|
||||
}
|
||||
|
||||
private func setupUserSessionForClient(_ client: Client) {
|
||||
Benchmark.endTrackingForIdentifier("Login", message: "Finished login")
|
||||
|
||||
do {
|
||||
let restoreToken = try client.restoreToken()
|
||||
|
||||
@@ -54,6 +54,8 @@ class UserSession: ClientDelegate {
|
||||
self.mediaProvider = MediaProvider(client: client, imageCache: ImageCache.default)
|
||||
|
||||
client.setDelegate(delegate: WeakUserSessionWrapper(userSession: self))
|
||||
|
||||
Benchmark.startTrackingForIdentifier("ClientSync", message: "Started sync.")
|
||||
client.startSync()
|
||||
|
||||
updateRooms()
|
||||
@@ -89,6 +91,7 @@ class UserSession: ClientDelegate {
|
||||
// MARK: ClientDelegate
|
||||
|
||||
func didReceiveSyncUpdate() {
|
||||
Benchmark.logElapsedDurationForIdentifier("ClientSync", message: "Received sync update")
|
||||
updateRooms()
|
||||
}
|
||||
|
||||
@@ -101,7 +104,11 @@ class UserSession: ClientDelegate {
|
||||
return
|
||||
}
|
||||
|
||||
Benchmark.startTrackingForIdentifier("ClientRooms", message: "Fetching available rooms")
|
||||
let sdkRooms = self.client.rooms()
|
||||
Benchmark.endTrackingForIdentifier("ClientRooms", message: "Retrieved \(sdkRooms.count) rooms")
|
||||
|
||||
Benchmark.startTrackingForIdentifier("ProcessingRooms", message: "Started processing \(sdkRooms.count) rooms")
|
||||
let diff = sdkRooms.map({ $0.id()}).difference(from: currentRooms.map({ $0.id }))
|
||||
|
||||
for change in diff {
|
||||
@@ -117,6 +124,8 @@ class UserSession: ClientDelegate {
|
||||
}
|
||||
}
|
||||
|
||||
Benchmark.endTrackingForIdentifier("ProcessingRooms", message: "Finished processing \(sdkRooms.count) rooms")
|
||||
|
||||
DispatchQueue.main.async {
|
||||
self.rooms = currentRooms
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user