Add trigger to join and view room metrics events #5769

- Added trigger for JoinedRoom event
- Tracking ViewRoom event for rooms and events
This commit is contained in:
Gil Eluard
2022-03-15 10:31:24 +01:00
parent 59a6f2d356
commit 0df41c3b90
34 changed files with 355 additions and 5 deletions
@@ -111,8 +111,10 @@ final class SpaceSettingsModalCoordinator: Coordinator {
private func pushOptionScreen(ofType optionType: SpaceSettingsOptionType) {
switch optionType {
case .rooms:
Analytics.shared.viewRoomTrigger = .spaceSettings
exploreRooms(ofSpaceWithId: self.parameters.spaceId)
case .members:
Analytics.shared.viewRoomTrigger = .spaceSettings
showMembers(ofSpaceWithId: self.parameters.spaceId)
case .visibility:
showAccess(ofSpaceWithId: self.parameters.spaceId)
@@ -114,6 +114,10 @@ class SpaceSettingsService: SpaceSettingsServiceProtocol {
userDefinedAddress = newValue
}
func trackSpace() {
Analytics.shared.exploringSpace = session.spaceService.getSpace(withId: spaceId)
}
// MARK: - Private
private func readRoomState() {
@@ -53,4 +53,8 @@ class MockSpaceSettingsService: SpaceSettingsServiceProtocol {
func simulateUpdate(addressValidationStatus: SpaceCreationSettingsAddressValidationStatus) {
self.addressValidationSubject.value = addressValidationStatus
}
func trackSpace() {
}
}
@@ -34,6 +34,7 @@ protocol SpaceSettingsServiceProtocol: Avatarable {
func update(roomName: String, topic: String, address: String, avatar: UIImage?, completion: ((_ result: SpaceSettingsServiceCompletionResult) -> Void)?)
func addressDidChange(_ newValue: String)
func trackSpace()
}
// MARK: Avatarable
@@ -120,4 +120,5 @@ enum SpaceSettingsViewAction {
case pickImage(_ sourceRect: CGRect)
case optionSelected(_ optionType: SpaceSettingsOptionType)
case addressChanged(_ newValue: String)
case trackSpace
}
@@ -123,6 +123,8 @@ class SpaceSettingsViewModel: SpaceSettingsViewModelType, SpaceSettingsViewModel
}
case .addressChanged(let newValue):
service.addressDidChange(newValue)
case .trackSpace:
service.trackSpace()
}
}
@@ -68,6 +68,9 @@ struct SpaceSettings: View {
}),
secondaryButton: .cancel())
})
.onAppear {
viewModel.send(viewAction: .trackSpace)
}
}
// MARK: - Private