From 61e7fcfd5d05f1b193825eb3f3b41eec10cc33e6 Mon Sep 17 00:00:00 2001 From: Florian Duros Date: Tue, 3 Sep 2024 13:22:03 +0200 Subject: [PATCH 1/2] Add events for pinned messages --- .../features/analytics/plan/Interaction.kt | 36 +++++++++ .../features/analytics/plan/PinUnpinAction.kt | 76 +++++++++++++++++++ .../analytics/plan/PinnnedMessageCount.kt | 41 ++++++++++ schemas/Interaction.json | 7 ++ schemas/PinUnpinAction.json | 29 +++++++ schemas/PinnnedMessageCount.json | 16 ++++ types/swift/Interaction.swift | 12 +++ types/swift/PinUnpinAction.swift | 60 +++++++++++++++ types/swift/PinnnedMessageCount.swift | 40 ++++++++++ 9 files changed, 317 insertions(+) create mode 100644 kotlin/lib/src/main/java/im/vector/app/features/analytics/plan/PinUnpinAction.kt create mode 100644 kotlin/lib/src/main/java/im/vector/app/features/analytics/plan/PinnnedMessageCount.kt create mode 100644 schemas/PinUnpinAction.json create mode 100644 schemas/PinnnedMessageCount.json create mode 100644 types/swift/PinUnpinAction.swift create mode 100644 types/swift/PinnnedMessageCount.swift diff --git a/kotlin/lib/src/main/java/im/vector/app/features/analytics/plan/Interaction.kt b/kotlin/lib/src/main/java/im/vector/app/features/analytics/plan/Interaction.kt index 9e40449..9311534 100644 --- a/kotlin/lib/src/main/java/im/vector/app/features/analytics/plan/Interaction.kt +++ b/kotlin/lib/src/main/java/im/vector/app/features/analytics/plan/Interaction.kt @@ -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. */ diff --git a/kotlin/lib/src/main/java/im/vector/app/features/analytics/plan/PinUnpinAction.kt b/kotlin/lib/src/main/java/im/vector/app/features/analytics/plan/PinUnpinAction.kt new file mode 100644 index 0000000..4ba6043 --- /dev/null +++ b/kotlin/lib/src/main/java/im/vector/app/features/analytics/plan/PinUnpinAction.kt @@ -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? { + return mutableMapOf().apply { + put("from", from.rawValue) + put("kind", kind.rawValue) + }.takeIf { it.isNotEmpty() } + } +} diff --git a/kotlin/lib/src/main/java/im/vector/app/features/analytics/plan/PinnnedMessageCount.kt b/kotlin/lib/src/main/java/im/vector/app/features/analytics/plan/PinnnedMessageCount.kt new file mode 100644 index 0000000..fe31871 --- /dev/null +++ b/kotlin/lib/src/main/java/im/vector/app/features/analytics/plan/PinnnedMessageCount.kt @@ -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? { + return mutableMapOf().apply { + put("count", count) + }.takeIf { it.isNotEmpty() } + } +} diff --git a/schemas/Interaction.json b/schemas/Interaction.json index 70130dc..9615574 100644 --- a/schemas/Interaction.json +++ b/schemas/Interaction.json @@ -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."}, diff --git a/schemas/PinUnpinAction.json b/schemas/PinUnpinAction.json new file mode 100644 index 0000000..5af646e --- /dev/null +++ b/schemas/PinUnpinAction.json @@ -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 +} + \ No newline at end of file diff --git a/schemas/PinnnedMessageCount.json b/schemas/PinnnedMessageCount.json new file mode 100644 index 0000000..aa4aa7b --- /dev/null +++ b/schemas/PinnnedMessageCount.json @@ -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 +} + \ No newline at end of file diff --git a/types/swift/Interaction.swift b/types/swift/Interaction.swift index 3d87977..48a9cc4 100644 --- a/types/swift/Interaction.swift +++ b/types/swift/Interaction.swift @@ -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. diff --git a/types/swift/PinUnpinAction.swift b/types/swift/PinUnpinAction.swift new file mode 100644 index 0000000..6e2860a --- /dev/null +++ b/types/swift/PinUnpinAction.swift @@ -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 + ] + } + } +} diff --git a/types/swift/PinnnedMessageCount.swift b/types/swift/PinnnedMessageCount.swift new file mode 100644 index 0000000..7184ad8 --- /dev/null +++ b/types/swift/PinnnedMessageCount.swift @@ -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 + ] + } + } +} From 843f67b035683cbe483764e38b1319dae1e87295 Mon Sep 17 00:00:00 2001 From: Florian Duros Date: Wed, 4 Sep 2024 14:24:36 +0200 Subject: [PATCH 2/2] Review fixes --- .../features/analytics/plan/PinUnpinAction.kt | 2 +- .../analytics/plan/PinnnedMessageCount.kt | 41 ------------------- schemas/PinUnpinAction.json | 2 +- schemas/PinnnedMessageCount.json | 16 -------- types/swift/PinUnpinAction.swift | 2 +- types/swift/PinnnedMessageCount.swift | 40 ------------------ 6 files changed, 3 insertions(+), 100 deletions(-) delete mode 100644 kotlin/lib/src/main/java/im/vector/app/features/analytics/plan/PinnnedMessageCount.kt delete mode 100644 schemas/PinnnedMessageCount.json delete mode 100644 types/swift/PinnnedMessageCount.swift diff --git a/kotlin/lib/src/main/java/im/vector/app/features/analytics/plan/PinUnpinAction.kt b/kotlin/lib/src/main/java/im/vector/app/features/analytics/plan/PinUnpinAction.kt index 4ba6043..e4694f9 100644 --- a/kotlin/lib/src/main/java/im/vector/app/features/analytics/plan/PinUnpinAction.kt +++ b/kotlin/lib/src/main/java/im/vector/app/features/analytics/plan/PinUnpinAction.kt @@ -22,7 +22,7 @@ import im.vector.app.features.analytics.itf.VectorAnalyticsEvent // https://github.com/matrix-org/matrix-analytics-events/ /** - * Triggered when the user pin or unpin a message. + * Triggered when the users pin or unpins a message. */ data class PinUnpinAction( /** diff --git a/kotlin/lib/src/main/java/im/vector/app/features/analytics/plan/PinnnedMessageCount.kt b/kotlin/lib/src/main/java/im/vector/app/features/analytics/plan/PinnnedMessageCount.kt deleted file mode 100644 index fe31871..0000000 --- a/kotlin/lib/src/main/java/im/vector/app/features/analytics/plan/PinnnedMessageCount.kt +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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? { - return mutableMapOf().apply { - put("count", count) - }.takeIf { it.isNotEmpty() } - } -} diff --git a/schemas/PinUnpinAction.json b/schemas/PinUnpinAction.json index 5af646e..0098420 100644 --- a/schemas/PinUnpinAction.json +++ b/schemas/PinUnpinAction.json @@ -1,6 +1,6 @@ { "type": "object", - "description": "Triggered when the user pin or unpin a message.", + "description": "Triggered when the users pin or unpins a message.", "properties": { "eventName": { "enum": ["PinUnpinAction"] diff --git a/schemas/PinnnedMessageCount.json b/schemas/PinnnedMessageCount.json deleted file mode 100644 index aa4aa7b..0000000 --- a/schemas/PinnnedMessageCount.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "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 -} - \ No newline at end of file diff --git a/types/swift/PinUnpinAction.swift b/types/swift/PinUnpinAction.swift index 6e2860a..b8b61a7 100644 --- a/types/swift/PinUnpinAction.swift +++ b/types/swift/PinUnpinAction.swift @@ -19,7 +19,7 @@ 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. +/// Triggered when the users pin or unpins a message. extension AnalyticsEvent { public struct PinUnpinAction: AnalyticsEventProtocol { public let eventName = "PinUnpinAction" diff --git a/types/swift/PinnnedMessageCount.swift b/types/swift/PinnnedMessageCount.swift deleted file mode 100644 index 7184ad8..0000000 --- a/types/swift/PinnnedMessageCount.swift +++ /dev/null @@ -1,40 +0,0 @@ -// -// 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 - ] - } - } -}