mirror of
https://github.com/element-hq/element-x-ios.git
synced 2025-03-10 21:39:12 +00:00
Add analytics tracking for room creation (#1100)
This commit is contained in:
parent
1f65b7b9f9
commit
ee643f7a69
@ -156,6 +156,7 @@ class CreateRoomViewModel: CreateRoomViewModelType, CreateRoomViewModelProtocol
|
||||
userIDs: state.selectedUsers.map(\.userID),
|
||||
avatarURL: avatarURL) {
|
||||
case .success(let roomId):
|
||||
ServiceLocator.shared.analytics.trackCreatedRoom(isDM: false)
|
||||
actionsSubject.send(.openRoom(withIdentifier: roomId))
|
||||
case .failure(let failure):
|
||||
displayError(failure)
|
||||
|
@ -32,6 +32,7 @@ struct CreateRoomScreen: View {
|
||||
securitySection
|
||||
}
|
||||
.elementFormStyle()
|
||||
.track(screen: .createRoom)
|
||||
.scrollDismissesKeyboard(.immediately)
|
||||
.navigationTitle(L10n.screenCreateRoomTitle)
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
|
@ -133,6 +133,7 @@ class StartChatScreenViewModel: StartChatScreenViewModelType, StartChatScreenVie
|
||||
showLoadingIndicator()
|
||||
switch await clientProxy.createDirectRoom(with: user.userID, expectedRoomName: user.displayName) {
|
||||
case .success(let roomId):
|
||||
ServiceLocator.shared.analytics.trackCreatedRoom(isDM: true)
|
||||
actionsSubject.send(.openRoom(withIdentifier: roomId))
|
||||
case .failure(let failure):
|
||||
displayError(failure)
|
||||
|
@ -29,6 +29,7 @@ struct StartChatScreen: View {
|
||||
}
|
||||
}
|
||||
.elementFormStyle()
|
||||
.track(screen: .startChat)
|
||||
.scrollDismissesKeyboard(.immediately)
|
||||
.navigationTitle(L10n.actionStartChat)
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
|
@ -125,4 +125,10 @@ extension Analytics {
|
||||
let event = AnalyticsEvent.MobileScreen(durationMs: milliseconds, screenName: screen.screenName)
|
||||
client.screen(event)
|
||||
}
|
||||
|
||||
/// Track the creation of a room
|
||||
/// - Parameter isDM: true if the created room is a direct message, false otherwise
|
||||
func trackCreatedRoom(isDM: Bool) {
|
||||
capture(event: AnalyticsEvent.CreatedRoom(isDM: isDM))
|
||||
}
|
||||
}
|
||||
|
1
changelog.d/pr-1100.feature
Normal file
1
changelog.d/pr-1100.feature
Normal file
@ -0,0 +1 @@
|
||||
Add analytics tracking for room creation
|
Loading…
x
Reference in New Issue
Block a user