Skip to content

Commit

Permalink
Add events for pinned messages
Browse files Browse the repository at this point in the history
  • Loading branch information
florianduros committed Sep 3, 2024
1 parent ff91b42 commit ed22005
Show file tree
Hide file tree
Showing 9 changed files with 317 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,42 @@ data class Interaction(
*/
MobileThreadListThreadItem("MobileThreadListThreadItem"),

/**
* User clicked on the pinned message banner on Mobile and Element
* Web/Desktop
*/
PinnedMessageBannerClick("PinnedMessageBannerClick"),

/**
* User clicked on the Close list button in the pinned message banner on
* Mobile and Element Web/Desktop
*/
PinnedMessageBannerCloseListButton("PinnedMessageBannerCloseListButton"),

/**
* User clicked on the View all button in the pinned message banner on
* Mobile and Element Web/Desktop
*/
PinnedMessageBannerViewAllButton("PinnedMessageBannerViewAllButton"),

/**
* User clicked on the View in timeline button in the pinned message
* list on Mobile and Element Web/Desktop
*/
PinnedMessageListViewTimeline("PinnedMessageListViewTimeline"),

/**
* User clicked on the Pinned messages menu item from the Room Info on
* Mobile and Element Web/Desktop
*/
PinnedMessageRoomInfoButton("PinnedMessageRoomInfoButton"),

/**
* User clicked on the Pinned messages state event in the timeline on
* Mobile and Element Web/Desktop
*/
PinnedMessageStateEventClick("PinnedMessageStateEventClick"),

/**
* User tapped the already selected space from the space list.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
/*
* Copyright (c) 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.
*/

package im.vector.app.features.analytics.plan

import im.vector.app.features.analytics.itf.VectorAnalyticsEvent

// GENERATED FILE, DO NOT EDIT. FOR MORE INFORMATION VISIT
// https://github.com/matrix-org/matrix-analytics-events/

/**
* Triggered when the user pin or unpin a message.
*/
data class PinUnpinAction(
/**
* From where the action is triggered
*/
val from: From,
/**
* Is pin or unpin
*/
val kind: Kind,
) : VectorAnalyticsEvent {

enum class Kind(val rawValue: String) {
/**
* Pin a message
*/
Pin("Pin"),

/**
* Unpin a message
*/
Unpin("Unpin"),
}

enum class From(val rawValue: String) {

/**
* Action triggered from the menu item in message pinning list
*/
MessagePinningList("MessagePinningList"),

/**
* Action triggered from the timeline
*/
Timeline("Timeline"),

/**
* Action triggered from the Unpin all button in message pinning list
*/
UnpinAll("UnpinAll"),
}

override fun getName() = "PinUnpinAction"

override fun getProperties(): Map<String, Any>? {
return mutableMapOf<String, Any>().apply {
put("from", from.rawValue)
put("kind", kind.rawValue)
}.takeIf { it.isNotEmpty() }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Copyright (c) 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.
*/

package im.vector.app.features.analytics.plan

import im.vector.app.features.analytics.itf.VectorAnalyticsEvent

// GENERATED FILE, DO NOT EDIT. FOR MORE INFORMATION VISIT
// https://github.com/matrix-org/matrix-analytics-events/

/**
* Number of pinned messages in a room
*/
data class PinnnedMessageCount(
/**
* Number of pinned messages in a room
*/
val count: Int,
) : VectorAnalyticsEvent {

override fun getName() = "PinnedMessageCount"

override fun getProperties(): Map<String, Any>? {
return mutableMapOf<String, Any>().apply {
put("count", count)
}.takeIf { it.isNotEmpty() }
}
}
7 changes: 7 additions & 0 deletions schemas/Interaction.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,13 @@
{"const": "WebRoomListUserOnboardingButton", "description": "User clicked on the button to return to the user onboarding list in the room list in Element Web/Desktop." },
{"const": "WebRoomListUserOnboardingIgnoreButton", "description": "User clicked on the button to close the user onboarding button in the room list in Element Web/Desktop." },

{"const": "PinnedMessageBannerClick", "description": "User clicked on the pinned message banner on Mobile and Element Web/Desktop" },
{"const": "PinnedMessageBannerViewAllButton", "description": "User clicked on the View all button in the pinned message banner on Mobile and Element Web/Desktop" },
{"const": "PinnedMessageBannerCloseListButton", "description": "User clicked on the Close list button in the pinned message banner on Mobile and Element Web/Desktop" },
{"const": "PinnedMessageListViewTimeline", "description": "User clicked on the View in timeline button in the pinned message list on Mobile and Element Web/Desktop" },
{"const": "PinnedMessageRoomInfoButton", "description": "User clicked on the Pinned messages menu item from the Room Info on Mobile and Element Web/Desktop" },
{"const": "PinnedMessageStateEventClick", "description": "User clicked on the Pinned messages state event in the timeline on Mobile and Element Web/Desktop" },

{"const": "SpacePanelSelectedSpace", "description": "User tapped the already selected space from the space list."},
{"const": "SpacePanelSwitchSpace", "description": "User tapped an unselected space from the space list -> space switching should occur."},
{"const": "SpacePanelSwitchSubSpace", "description": "User tapped an unselected sub space from the space list -> space switching should occur."},
Expand Down
29 changes: 29 additions & 0 deletions schemas/PinUnpinAction.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"type": "object",
"description": "Triggered when the user pin or unpin a message.",
"properties": {
"eventName": {
"enum": ["PinUnpinAction"]
},
"kind": {
"description": "Is pin or unpin",
"type": "string",
"oneOf": [
{"const": "Pin", "description": "Pin a message"},
{"const": "Unpin", "description": "Unpin a message"}
]
},
"from": {
"description": "From where the action is triggered",
"type": "string",
"oneOf": [
{"const": "Timeline", "description": "Action triggered from the timeline"},
{"const": "MessagePinningList", "description": "Action triggered from the menu item in message pinning list"},
{"const": "UnpinAll", "description": "Action triggered from the Unpin all button in message pinning list"}
]
}
},
"required": ["eventName", "kind", "from"],
"additionalProperties": false
}

16 changes: 16 additions & 0 deletions schemas/PinnnedMessageCount.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"type": "object",
"description": "Number of pinned messages in a room",
"properties": {
"eventName": {
"enum": ["PinnedMessageCount"]
},
"count": {
"description": "Number of pinned messages in a room",
"type": "integer"
}
},
"required": ["eventName", "count"],
"additionalProperties": false
}

12 changes: 12 additions & 0 deletions types/swift/Interaction.swift
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,18 @@ extension AnalyticsEvent {
case MobileThreadListFilterItem = "MobileThreadListFilterItem"
/// User selected a thread on ThreadList screen.
case MobileThreadListThreadItem = "MobileThreadListThreadItem"
/// User clicked on the pinned message banner on Mobile and Element Web/Desktop
case PinnedMessageBannerClick = "PinnedMessageBannerClick"
/// User clicked on the Close list button in the pinned message banner on Mobile and Element Web/Desktop
case PinnedMessageBannerCloseListButton = "PinnedMessageBannerCloseListButton"
/// User clicked on the View all button in the pinned message banner on Mobile and Element Web/Desktop
case PinnedMessageBannerViewAllButton = "PinnedMessageBannerViewAllButton"
/// User clicked on the View in timeline button in the pinned message list on Mobile and Element Web/Desktop
case PinnedMessageListViewTimeline = "PinnedMessageListViewTimeline"
/// User clicked on the Pinned messages menu item from the Room Info on Mobile and Element Web/Desktop
case PinnedMessageRoomInfoButton = "PinnedMessageRoomInfoButton"
/// User clicked on the Pinned messages state event in the timeline on Mobile and Element Web/Desktop
case PinnedMessageStateEventClick = "PinnedMessageStateEventClick"
/// User tapped the already selected space from the space list.
case SpacePanelSelectedSpace = "SpacePanelSelectedSpace"
/// User tapped an unselected space from the space list -> space switching should occur.
Expand Down
60 changes: 60 additions & 0 deletions types/swift/PinUnpinAction.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
//
// 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

// GENERATED FILE, DO NOT EDIT. FOR MORE INFORMATION VISIT
// https://github.com/matrix-org/matrix-analytics-events/

/// Triggered when the user pin or unpin a message.
extension AnalyticsEvent {
public struct PinUnpinAction: AnalyticsEventProtocol {
public let eventName = "PinUnpinAction"

/// From where the action is triggered
public let from: From
/// Is pin or unpin
public let kind: Kind

public init(from: From, kind: Kind) {
self.from = from
self.kind = kind
}

public enum Kind: String {
/// Pin a message
case Pin = "Pin"
/// Unpin a message
case Unpin = "Unpin"
}

public enum From: String {
/// Action triggered from the menu item in message pinning list
case MessagePinningList = "MessagePinningList"
/// Action triggered from the timeline
case Timeline = "Timeline"
/// Action triggered from the Unpin all button in message pinning list
case UnpinAll = "UnpinAll"
}

public var properties: [String: Any] {
return [
"from": from.rawValue,
"kind": kind.rawValue
]
}
}
}
40 changes: 40 additions & 0 deletions types/swift/PinnnedMessageCount.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
//
// 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

// GENERATED FILE, DO NOT EDIT. FOR MORE INFORMATION VISIT
// https://github.com/matrix-org/matrix-analytics-events/

/// Number of pinned messages in a room
extension AnalyticsEvent {
public struct PinnnedMessageCount: AnalyticsEventProtocol {
public let eventName = "PinnedMessageCount"

/// Number of pinned messages in a room
public let count: Int

public init(count: Int) {
self.count = count
}

public var properties: [String: Any] {
return [
"count": count
]
}
}
}

0 comments on commit ed22005

Please sign in to comment.