mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-24 02:22:44 +02:00
App Layout: Add usage measures
This commit is contained in:
@@ -229,10 +229,11 @@ extension Analytics {
|
||||
/// Updates any user properties to help with creating cohorts.
|
||||
///
|
||||
/// Only non-nil properties will be updated when calling this method.
|
||||
func updateUserProperties(ftueUseCase: UserSessionProperties.UseCase? = nil, numFavouriteRooms: Int? = nil, numSpaces: Int? = nil) {
|
||||
func updateUserProperties(ftueUseCase: UserSessionProperties.UseCase? = nil, numFavouriteRooms: Int? = nil, numSpaces: Int? = nil, allChatsActiveFilter: UserSessionProperties.AllChatsActiveFilter? = nil) {
|
||||
let userProperties = AnalyticsEvent.UserProperties(ftueUseCaseSelection: ftueUseCase?.analyticsName,
|
||||
numFavouriteRooms: numFavouriteRooms,
|
||||
numSpaces: numSpaces)
|
||||
numSpaces: numSpaces,
|
||||
allChatsActiveFilter: allChatsActiveFilter?.analyticsName)
|
||||
client.updateUserProperties(userProperties)
|
||||
}
|
||||
|
||||
|
||||
@@ -58,7 +58,10 @@ import AnalyticsEvents
|
||||
case spaceMembers
|
||||
case spaceExploreRooms
|
||||
case dialpad
|
||||
|
||||
case spaceBottomSheet
|
||||
case invites
|
||||
case createSpace
|
||||
|
||||
/// The screen name reported to the AnalyticsEvent.
|
||||
var screenName: AnalyticsEvent.MobileScreen.ScreenName {
|
||||
switch self {
|
||||
@@ -142,6 +145,12 @@ import AnalyticsEvents
|
||||
return .SpaceExploreRooms
|
||||
case .dialpad:
|
||||
return .Dialpad
|
||||
case .spaceBottomSheet:
|
||||
return .SpaceBottomSheet
|
||||
case .invites:
|
||||
return .Invites
|
||||
case .createSpace:
|
||||
return .CreateSpace
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,17 @@ import AnalyticsEvents
|
||||
case threadListFilterItem
|
||||
case spacePanelSelectedSpace
|
||||
case spacePanelSwitchSpace
|
||||
|
||||
case spacePanelSwitchSubSpace
|
||||
case allChatsRecentsEnabled
|
||||
case allChatsRecentsDisabled
|
||||
case allChatsFiltersEnabled
|
||||
case allChatsFiltersDisabled
|
||||
case allChatsFilterAll
|
||||
case allChatsFilterFavourites
|
||||
case allChatsFilterUnreads
|
||||
case allChatsFilterPeople
|
||||
case spaceCreationValidated
|
||||
|
||||
/// The element name reported to the AnalyticsEvent.
|
||||
var name: AnalyticsEvent.Interaction.Name {
|
||||
switch self {
|
||||
@@ -40,6 +50,26 @@ import AnalyticsEvents
|
||||
return .SpacePanelSelectedSpace
|
||||
case .spacePanelSwitchSpace:
|
||||
return .SpacePanelSwitchSpace
|
||||
case .spacePanelSwitchSubSpace:
|
||||
return .SpacePanelSwitchSubSpace
|
||||
case .allChatsRecentsEnabled:
|
||||
return .MobileAllChatsRecentsEnabled
|
||||
case .allChatsRecentsDisabled:
|
||||
return .MobileAllChatsRecentsDisabled
|
||||
case .allChatsFiltersEnabled:
|
||||
return .MobileAllChatsFiltersEnabled
|
||||
case .allChatsFiltersDisabled:
|
||||
return .MobileAllChatsFiltersDisabled
|
||||
case .allChatsFilterAll:
|
||||
return .MobileAllChatsFilterAll
|
||||
case .allChatsFilterFavourites:
|
||||
return .MobileAllChatsFilterFavourites
|
||||
case .allChatsFilterUnreads:
|
||||
return .MobileAllChatsFilterUnreads
|
||||
case .allChatsFilterPeople:
|
||||
return .MobileAllChatsFilterPeople
|
||||
case .spaceCreationValidated:
|
||||
return .MobileSpaceCreationValidated
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,6 +44,7 @@ import AnalyticsEvents
|
||||
case linkShare
|
||||
case exploreRooms
|
||||
case spaceMembers
|
||||
case spaceBottomSheet
|
||||
|
||||
var trigger: AnalyticsEvent.ViewRoom.Trigger? {
|
||||
switch self {
|
||||
@@ -99,6 +100,8 @@ import AnalyticsEvents
|
||||
return .MobileExploreRooms
|
||||
case .spaceMembers:
|
||||
return .MobileSpaceMembers
|
||||
case .spaceBottomSheet:
|
||||
return .MobileSpaceBottomSheet
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
//
|
||||
// Copyright 2022 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 UserSessionProperties.AllChatsActiveFilter {
|
||||
var analyticsName: AnalyticsEvent.UserProperties.AllChatsActiveFilter {
|
||||
switch self {
|
||||
case .all:
|
||||
return .All
|
||||
case .unreads:
|
||||
return .Unreads
|
||||
case .favourites:
|
||||
return .Favourites
|
||||
case .people:
|
||||
return .People
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -20,12 +20,13 @@ import AnalyticsEvents
|
||||
extension AnalyticsEvent.UserProperties {
|
||||
|
||||
// Initializer for Element. Strips all Web properties.
|
||||
public init(ftueUseCaseSelection: FtueUseCaseSelection?, numFavouriteRooms: Int?, numSpaces: Int?) {
|
||||
public init(ftueUseCaseSelection: FtueUseCaseSelection?, numFavouriteRooms: Int?, numSpaces: Int?, allChatsActiveFilter: AllChatsActiveFilter?) {
|
||||
self.init(WebMetaSpaceFavouritesEnabled: nil,
|
||||
WebMetaSpaceHomeAllRooms: nil,
|
||||
WebMetaSpaceHomeEnabled: nil,
|
||||
WebMetaSpaceOrphansEnabled: nil,
|
||||
WebMetaSpacePeopleEnabled: nil,
|
||||
allChatsActiveFilter: allChatsActiveFilter,
|
||||
ftueUseCaseSelection: ftueUseCaseSelection,
|
||||
numFavouriteRooms: numFavouriteRooms,
|
||||
numSpaces: numSpaces)
|
||||
|
||||
@@ -81,7 +81,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)
|
||||
numSpaces: userProperties.numSpaces ?? pendingUserProperties.numSpaces, allChatsActiveFilter: userProperties.allChatsActiveFilter ?? pendingUserProperties.allChatsActiveFilter)
|
||||
}
|
||||
|
||||
// MARK: - Private
|
||||
|
||||
Reference in New Issue
Block a user