mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-26 03:20:50 +02:00
Adapt to latest analytics repo
This commit is contained in:
@@ -175,7 +175,9 @@ extension Analytics {
|
||||
///
|
||||
/// Only non-nil properties will be updated when calling this method.
|
||||
func updateUserProperties(ftueUseCase: UserSessionProperties.UseCase? = nil) {
|
||||
let userProperties = AnalyticsEvent.UserProperties(ftueUseCaseSelection: ftueUseCase?.analyticsName, numSpaces: nil)
|
||||
let userProperties = AnalyticsEvent.UserProperties(ftueUseCaseSelection: ftueUseCase?.analyticsName,
|
||||
numFavouriteRooms: nil,
|
||||
numSpaces: nil)
|
||||
client.updateUserProperties(userProperties)
|
||||
}
|
||||
|
||||
@@ -184,7 +186,7 @@ extension Analytics {
|
||||
/// - screen: The screen that was shown.
|
||||
/// - milliseconds: An optional value representing how long the screen was shown for in milliseconds.
|
||||
func trackScreen(_ screen: AnalyticsScreen, duration milliseconds: Int?) {
|
||||
let event = AnalyticsEvent.Screen(durationMs: milliseconds, screenName: screen.screenName)
|
||||
let event = AnalyticsEvent.MobileScreen(durationMs: milliseconds, screenName: screen.screenName)
|
||||
client.screen(event)
|
||||
}
|
||||
|
||||
@@ -276,13 +278,13 @@ extension Analytics: MXAnalyticsDelegate {
|
||||
capture(event: event)
|
||||
}
|
||||
|
||||
func trackJoinedRoom(asDM isDM: Bool, memberCount: UInt) {
|
||||
func trackJoinedRoom(asDM isDM: Bool, isSpace: Bool, memberCount: UInt) {
|
||||
guard let roomSize = AnalyticsEvent.JoinedRoom.RoomSize(memberCount: memberCount) else {
|
||||
MXLog.warning("[Analytics] Attempt to capture joined room with invalid member count: \(memberCount)")
|
||||
return
|
||||
}
|
||||
|
||||
let event = AnalyticsEvent.JoinedRoom(isDM: isDM, roomSize: roomSize)
|
||||
let event = AnalyticsEvent.JoinedRoom(isDM: isDM, isSpace: isSpace, roomSize: roomSize, trigger: nil)
|
||||
capture(event: event)
|
||||
}
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ import AnalyticsEvents
|
||||
case inviteFriends
|
||||
|
||||
/// The screen name reported to the AnalyticsEvent.
|
||||
var screenName: AnalyticsEvent.Screen.ScreenName {
|
||||
var screenName: AnalyticsEvent.MobileScreen.ScreenName {
|
||||
switch self {
|
||||
case .welcome:
|
||||
return .Welcome
|
||||
@@ -64,23 +64,23 @@ import AnalyticsEvents
|
||||
case .forgotPassword:
|
||||
return .ForgotPassword
|
||||
case .sidebar:
|
||||
return .MobileSidebar
|
||||
return .Sidebar
|
||||
case .home:
|
||||
return .Home
|
||||
case .favourites:
|
||||
return .MobileFavourites
|
||||
return .Favourites
|
||||
case .people:
|
||||
return .MobilePeople
|
||||
return .People
|
||||
case .rooms:
|
||||
return .MobileRooms
|
||||
return .Rooms
|
||||
case .searchRooms:
|
||||
return .MobileSearchRooms
|
||||
return .SearchRooms
|
||||
case .searchMessages:
|
||||
return .MobileSearchMessages
|
||||
return .SearchMessages
|
||||
case .searchPeople:
|
||||
return .MobileSearchPeople
|
||||
return .SearchPeople
|
||||
case .searchFiles:
|
||||
return .MobileSearchFiles
|
||||
return .SearchFiles
|
||||
case .room:
|
||||
return .Room
|
||||
case .roomDetails:
|
||||
@@ -100,7 +100,7 @@ import AnalyticsEvents
|
||||
case .roomDirectory:
|
||||
return .RoomDirectory
|
||||
case .switchDirectory:
|
||||
return .MobileSwitchDirectory
|
||||
return .SwitchDirectory
|
||||
case .startChat:
|
||||
return .StartChat
|
||||
case .createRoom:
|
||||
@@ -120,7 +120,7 @@ import AnalyticsEvents
|
||||
case .myGroups:
|
||||
return .MyGroups
|
||||
case .inviteFriends:
|
||||
return .MobileInviteFriends
|
||||
return .InviteFriends
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
//
|
||||
// Copyright 2021 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import AnalyticsEvents
|
||||
|
||||
extension AnalyticsEvent.UserProperties {
|
||||
|
||||
// Initializer for Element. Strips all Web properties.
|
||||
public init(ftueUseCaseSelection: FtueUseCaseSelection?, numFavouriteRooms: Int?, numSpaces: Int?) {
|
||||
self.init(WebMetaSpaceFavouritesEnabled: nil,
|
||||
WebMetaSpaceHomeAllRooms: nil,
|
||||
WebMetaSpaceHomeEnabled: nil,
|
||||
WebMetaSpaceOrphansEnabled: nil,
|
||||
WebMetaSpacePeopleEnabled: nil,
|
||||
ftueUseCaseSelection: ftueUseCaseSelection,
|
||||
numFavouriteRooms: numFavouriteRooms,
|
||||
numSpaces: numSpaces)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -80,6 +80,7 @@ class PostHogAnalyticsClient: AnalyticsClientProtocol {
|
||||
|
||||
// Merge the updated user properties with the existing ones
|
||||
self.pendingUserProperties = AnalyticsEvent.UserProperties(ftueUseCaseSelection: userProperties.ftueUseCaseSelection ?? pendingUserProperties.ftueUseCaseSelection,
|
||||
numFavouriteRooms: userProperties.numFavouriteRooms ?? pendingUserProperties.numFavouriteRooms,
|
||||
numSpaces: userProperties.numSpaces ?? pendingUserProperties.numSpaces)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user