From fda38e90e56aeea81fef8f5fcb7cb30a2f218851 Mon Sep 17 00:00:00 2001 From: Valere Date: Tue, 26 Mar 2024 18:28:05 +0100 Subject: [PATCH 1/2] Update analytic events --- .../app/features/analytics/plan/Error.kt | 103 ++++++++++++- .../features/analytics/plan/Interaction.kt | 41 ++++++ .../features/analytics/plan/MobileScreen.kt | 6 + .../plan/NotificationTroubleshoot.kt | 41 ++++++ .../features/analytics/plan/PollCreation.kt | 4 +- .../app/features/analytics/plan/PollEnd.kt | 2 +- .../app/features/analytics/plan/PollVote.kt | 2 +- .../features/analytics/plan/RoomModeration.kt | 137 ++++++++++++++++++ .../analytics/plan/SuperProperties.kt | 61 ++++++++ .../app/features/analytics/plan/ViewRoom.kt | 6 + 10 files changed, 398 insertions(+), 5 deletions(-) create mode 100644 vector/src/main/java/im/vector/app/features/analytics/plan/NotificationTroubleshoot.kt create mode 100644 vector/src/main/java/im/vector/app/features/analytics/plan/RoomModeration.kt create mode 100644 vector/src/main/java/im/vector/app/features/analytics/plan/SuperProperties.kt diff --git a/vector/src/main/java/im/vector/app/features/analytics/plan/Error.kt b/vector/src/main/java/im/vector/app/features/analytics/plan/Error.kt index 386c090848..fbc598c8eb 100644 --- a/vector/src/main/java/im/vector/app/features/analytics/plan/Error.kt +++ b/vector/src/main/java/im/vector/app/features/analytics/plan/Error.kt @@ -30,11 +30,44 @@ data class Error( */ val context: String? = null, /** - * Which crypto module is the client currently using. + * DEPRECATED: Which crypto module is the client currently using. */ val cryptoModule: CryptoModule? = null, + /** + * Which crypto backend is the client currently using. + */ + val cryptoSDK: CryptoSDK? = null, val domain: Domain, + /** + * An heuristic based on event origin_server_ts and the current device + * creation time (origin_server_ts - device_ts). This would be used to + * get the source of the event scroll-back/live/initialSync. + */ + val eventLocalAgeMillis: Int? = null, + /** + * true if userDomain != senderDomain. + */ + val isFederated: Boolean? = null, + /** + * true if the current user is using matrix.org + */ + val isMatrixDotOrg: Boolean? = null, val name: Name, + /** + * UTDs can be permanent or temporary. If temporary, this field will + * contain the time it took to decrypt the message in milliseconds. If + * permanent should be -1 + */ + val timeToDecryptMillis: Int? = null, + /** + * true if the current user trusts their own identity (verified session) + * at time of decryption. + */ + val userTrustsOwnIdentity: Boolean? = null, + /** + * true if that unable to decrypt error was visible to the user + */ + val wasVisibleToUser: Boolean? = null, ) : VectorAnalyticsEvent { enum class Domain { @@ -44,18 +77,79 @@ data class Error( } enum class Name { + + /** + * E2EE domain error. Decryption failed for a message sent before the + * device logged in, and key backup is not enabled. + */ + HistoricalMessage, + + /** + * E2EE domain error. The room key is known but is ratcheted (index > + * 0). + */ OlmIndexError, + + /** + * E2EE domain error. Generic unknown inbound group session error. + */ OlmKeysNotSentError, + + /** + * E2EE domain error. Any other decryption error (missing field, format + * errors...). + */ OlmUnspecifiedError, + + /** + * TO_DEVICE domain error. The to-device message failed to decrypt. + */ ToDeviceFailedToDecrypt, + + /** + * E2EE domain error. Decryption failed due to unknown error. + */ UnknownError, + + /** + * VOIP domain error. ICE negotiation failed. + */ VoipIceFailed, + + /** + * VOIP domain error. ICE negotiation timed out. + */ VoipIceTimeout, + + /** + * VOIP domain error. The call invite timed out. + */ VoipInviteTimeout, + + /** + * VOIP domain error. The user hung up the call. + */ VoipUserHangup, + + /** + * VOIP domain error. The user's media failed to start. + */ VoipUserMediaFailed, } + enum class CryptoSDK { + + /** + * Legacy crypto backend specific to each platform. + */ + Legacy, + + /** + * Cross-platform crypto backend written in Rust. + */ + Rust, + } + enum class CryptoModule { /** @@ -75,8 +169,15 @@ data class Error( return mutableMapOf().apply { context?.let { put("context", it) } cryptoModule?.let { put("cryptoModule", it.name) } + cryptoSDK?.let { put("cryptoSDK", it.name) } put("domain", domain.name) + eventLocalAgeMillis?.let { put("eventLocalAgeMillis", it) } + isFederated?.let { put("isFederated", it) } + isMatrixDotOrg?.let { put("isMatrixDotOrg", it) } put("name", name.name) + timeToDecryptMillis?.let { put("timeToDecryptMillis", it) } + userTrustsOwnIdentity?.let { put("userTrustsOwnIdentity", it) } + wasVisibleToUser?.let { put("wasVisibleToUser", it) } }.takeIf { it.isNotEmpty() } } } diff --git a/vector/src/main/java/im/vector/app/features/analytics/plan/Interaction.kt b/vector/src/main/java/im/vector/app/features/analytics/plan/Interaction.kt index 1df1b35439..4aa84353e5 100644 --- a/vector/src/main/java/im/vector/app/features/analytics/plan/Interaction.kt +++ b/vector/src/main/java/im/vector/app/features/analytics/plan/Interaction.kt @@ -85,11 +85,28 @@ data class Interaction( */ MobileRoomAddHome, + /** + * User switched the favourite toggle on Room Details screen. + */ + MobileRoomFavouriteToggle, + /** * User tapped on Leave Room button on Room Details screen. */ MobileRoomLeave, + /** + * User adjusted their favourite rooms using the context menu on a room + * in the room list. + */ + MobileRoomListRoomContextMenuFavouriteToggle, + + /** + * User adjusted their unread rooms using the context menu on a room in + * the room list. + */ + MobileRoomListRoomContextMenuUnreadToggle, + /** * User tapped on Threads button on Room screen. */ @@ -306,6 +323,18 @@ data class Interaction( */ WebRoomListRoomTileContextMenuLeaveItem, + /** + * User marked a message as read using the context menu on a room tile + * in the room list in Element Web/Desktop. + */ + WebRoomListRoomTileContextMenuMarkRead, + + /** + * User marked a room as unread using the context menu on a room tile in + * the room list in Element Web/Desktop. + */ + WebRoomListRoomTileContextMenuMarkUnread, + /** * User accessed room settings using the context menu on a room tile in * the room list in Element Web/Desktop. @@ -408,6 +437,18 @@ data class Interaction( */ WebThreadViewBackButton, + /** + * User clicked on the Threads Activity Centre button of Element + * Web/Desktop. + */ + WebThreadsActivityCentreButton, + + /** + * User clicked on a room in the Threads Activity Centre of Element + * Web/Desktop. + */ + WebThreadsActivityCentreRoomItem, + /** * User selected a thread in the Threads panel in Element Web/Desktop. */ diff --git a/vector/src/main/java/im/vector/app/features/analytics/plan/MobileScreen.kt b/vector/src/main/java/im/vector/app/features/analytics/plan/MobileScreen.kt index 59b53aaa89..d08b0d1921 100644 --- a/vector/src/main/java/im/vector/app/features/analytics/plan/MobileScreen.kt +++ b/vector/src/main/java/im/vector/app/features/analytics/plan/MobileScreen.kt @@ -119,6 +119,12 @@ data class MobileScreen( */ MyGroups, + /** + * The screen containing tests to help user to fix issues around + * notifications. + */ + NotificationTroubleshoot, + /** * The People tab on mobile that lists all the DM rooms you have joined. */ diff --git a/vector/src/main/java/im/vector/app/features/analytics/plan/NotificationTroubleshoot.kt b/vector/src/main/java/im/vector/app/features/analytics/plan/NotificationTroubleshoot.kt new file mode 100644 index 0000000000..9a4e6bd84b --- /dev/null +++ b/vector/src/main/java/im/vector/app/features/analytics/plan/NotificationTroubleshoot.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/ + +/** + * Triggered when the user runs the troubleshoot notification test suite. + */ +data class NotificationTroubleshoot( + /** + * Whether one or more tests are in error. + */ + val hasError: Boolean, +) : VectorAnalyticsEvent { + + override fun getName() = "NotificationTroubleshoot" + + override fun getProperties(): Map? { + return mutableMapOf().apply { + put("hasError", hasError) + }.takeIf { it.isNotEmpty() } + } +} diff --git a/vector/src/main/java/im/vector/app/features/analytics/plan/PollCreation.kt b/vector/src/main/java/im/vector/app/features/analytics/plan/PollCreation.kt index c9ee1afd47..ebb7a3efd0 100644 --- a/vector/src/main/java/im/vector/app/features/analytics/plan/PollCreation.kt +++ b/vector/src/main/java/im/vector/app/features/analytics/plan/PollCreation.kt @@ -41,12 +41,12 @@ data class PollCreation( enum class Action { /** - * Newly created poll. + * Newly created poll */ Create, /** - * Edit of an existing poll. + * Edit of an existing poll */ Edit, } diff --git a/vector/src/main/java/im/vector/app/features/analytics/plan/PollEnd.kt b/vector/src/main/java/im/vector/app/features/analytics/plan/PollEnd.kt index f55e39522d..8750d70a5f 100644 --- a/vector/src/main/java/im/vector/app/features/analytics/plan/PollEnd.kt +++ b/vector/src/main/java/im/vector/app/features/analytics/plan/PollEnd.kt @@ -27,7 +27,7 @@ import im.vector.app.features.analytics.itf.VectorAnalyticsEvent data class PollEnd( /** * Do not use this. Remove this property when the kotlin type generator - * can properly generate types without proprties other than the event + * can properly generate types without properties other than the event * name. */ val doNotUse: Boolean? = null, diff --git a/vector/src/main/java/im/vector/app/features/analytics/plan/PollVote.kt b/vector/src/main/java/im/vector/app/features/analytics/plan/PollVote.kt index 722f52bdec..9918063ef9 100644 --- a/vector/src/main/java/im/vector/app/features/analytics/plan/PollVote.kt +++ b/vector/src/main/java/im/vector/app/features/analytics/plan/PollVote.kt @@ -27,7 +27,7 @@ import im.vector.app.features.analytics.itf.VectorAnalyticsEvent data class PollVote( /** * Do not use this. Remove this property when the kotlin type generator - * can properly generate types without proprties other than the event + * can properly generate types without properties other than the event * name. */ val doNotUse: Boolean? = null, diff --git a/vector/src/main/java/im/vector/app/features/analytics/plan/RoomModeration.kt b/vector/src/main/java/im/vector/app/features/analytics/plan/RoomModeration.kt new file mode 100644 index 0000000000..7dd03caa76 --- /dev/null +++ b/vector/src/main/java/im/vector/app/features/analytics/plan/RoomModeration.kt @@ -0,0 +1,137 @@ +/* + * 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 a moderation action is performed within a room. + */ +data class RoomModeration( + /** + * The action that was performed. + */ + val action: Action, + /** + * When the action sets a particular power level, this is the suggested + * role for that the power level. + */ + val role: Role? = null, +) : VectorAnalyticsEvent { + + enum class Action { + /** + * Banned a room member. + */ + BanMember, + + /** + * Changed a room member's power level. + */ + ChangeMemberRole, + + /** + * Changed the power level required to ban room members. + */ + ChangePermissionsBanMembers, + + /** + * Changed the power level required to invite users to the room. + */ + ChangePermissionsInviteUsers, + + /** + * Changed the power level required to kick room members. + */ + ChangePermissionsKickMembers, + + /** + * Changed the power level required to redact messages in the room. + */ + ChangePermissionsRedactMessages, + + /** + * Changed the power level required to set the room's avatar. + */ + ChangePermissionsRoomAvatar, + + /** + * Changed the power level required to set the room's name. + */ + ChangePermissionsRoomName, + + /** + * Changed the power level required to set the room's topic. + */ + ChangePermissionsRoomTopic, + + /** + * Changed the power level required to send messages in the room. + */ + ChangePermissionsSendMessages, + + /** + * Kicked a room member. + */ + KickMember, + + /** + * Reset all of the room permissions back to their default values. + */ + ResetPermissions, + + /** + * Unbanned a room member. + */ + UnbanMember, + } + + enum class Role { + + /** + * A power level of 100. + */ + Administrator, + + /** + * A power level of 50. + */ + Moderator, + + /** + * Any other power level. + */ + Other, + + /** + * A power level of 0. + */ + User, + } + + override fun getName() = "RoomModeration" + + override fun getProperties(): Map? { + return mutableMapOf().apply { + put("action", action.name) + role?.let { put("role", it.name) } + }.takeIf { it.isNotEmpty() } + } +} diff --git a/vector/src/main/java/im/vector/app/features/analytics/plan/SuperProperties.kt b/vector/src/main/java/im/vector/app/features/analytics/plan/SuperProperties.kt new file mode 100644 index 0000000000..cd5d9dfdc7 --- /dev/null +++ b/vector/src/main/java/im/vector/app/features/analytics/plan/SuperProperties.kt @@ -0,0 +1,61 @@ +/* + * 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 + +// GENERATED FILE, DO NOT EDIT. FOR MORE INFORMATION VISIT +// https://github.com/matrix-org/matrix-analytics-events/ + +/** + * Super Properties are properties associated with events that are sent with + * every capture call, be it a $pageview, an autocaptured button click, or + * anything else. + */ +data class SuperProperties( + /** + * Used by web to identify the platform (Web Platform/Electron Platform) + */ + val appPlatform: String? = null, + /** + * Which crypto backend is the client currently using. + */ + val cryptoSDK: CryptoSDK? = null, + /** + * Version of the crypto backend. + */ + val cryptoSDKVersion: String? = null, +) { + + enum class CryptoSDK { + /** + * Legacy crypto backend specific to each platform. + */ + Legacy, + + /** + * Cross-platform crypto backend written in Rust. + */ + Rust, + } + + fun getProperties(): Map? { + return mutableMapOf().apply { + appPlatform?.let { put("appPlatform", it) } + cryptoSDK?.let { put("cryptoSDK", it.name) } + cryptoSDKVersion?.let { put("cryptoSDKVersion", it) } + }.takeIf { it.isNotEmpty() } + } +} diff --git a/vector/src/main/java/im/vector/app/features/analytics/plan/ViewRoom.kt b/vector/src/main/java/im/vector/app/features/analytics/plan/ViewRoom.kt index 366979025a..93c166dc88 100644 --- a/vector/src/main/java/im/vector/app/features/analytics/plan/ViewRoom.kt +++ b/vector/src/main/java/im/vector/app/features/analytics/plan/ViewRoom.kt @@ -252,6 +252,12 @@ data class ViewRoom( */ WebSpacePanelNotificationBadge, + /** + * Room accessed via interacting with the Threads Activity Centre in + * Element Web/Desktop. + */ + WebThreadsActivityCentre, + /** * Room accessed via Element Web/Desktop's Unified Search modal. */ From f559dcdd85882d03b859955dc4017db2c222fd63 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Wed, 27 Mar 2024 08:08:58 +0100 Subject: [PATCH 2/2] Add missing periods. --- .../java/im/vector/app/features/analytics/plan/Error.kt | 6 +++--- .../im/vector/app/features/analytics/plan/PollCreation.kt | 4 ++-- .../vector/app/features/analytics/plan/SuperProperties.kt | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/vector/src/main/java/im/vector/app/features/analytics/plan/Error.kt b/vector/src/main/java/im/vector/app/features/analytics/plan/Error.kt index fbc598c8eb..98553b9258 100644 --- a/vector/src/main/java/im/vector/app/features/analytics/plan/Error.kt +++ b/vector/src/main/java/im/vector/app/features/analytics/plan/Error.kt @@ -49,14 +49,14 @@ data class Error( */ val isFederated: Boolean? = null, /** - * true if the current user is using matrix.org + * true if the current user is using matrix.org. */ val isMatrixDotOrg: Boolean? = null, val name: Name, /** * UTDs can be permanent or temporary. If temporary, this field will * contain the time it took to decrypt the message in milliseconds. If - * permanent should be -1 + * permanent should be -1. */ val timeToDecryptMillis: Int? = null, /** @@ -65,7 +65,7 @@ data class Error( */ val userTrustsOwnIdentity: Boolean? = null, /** - * true if that unable to decrypt error was visible to the user + * true if that unable to decrypt error was visible to the user. */ val wasVisibleToUser: Boolean? = null, ) : VectorAnalyticsEvent { diff --git a/vector/src/main/java/im/vector/app/features/analytics/plan/PollCreation.kt b/vector/src/main/java/im/vector/app/features/analytics/plan/PollCreation.kt index ebb7a3efd0..c9ee1afd47 100644 --- a/vector/src/main/java/im/vector/app/features/analytics/plan/PollCreation.kt +++ b/vector/src/main/java/im/vector/app/features/analytics/plan/PollCreation.kt @@ -41,12 +41,12 @@ data class PollCreation( enum class Action { /** - * Newly created poll + * Newly created poll. */ Create, /** - * Edit of an existing poll + * Edit of an existing poll. */ Edit, } diff --git a/vector/src/main/java/im/vector/app/features/analytics/plan/SuperProperties.kt b/vector/src/main/java/im/vector/app/features/analytics/plan/SuperProperties.kt index cd5d9dfdc7..b62ae85a41 100644 --- a/vector/src/main/java/im/vector/app/features/analytics/plan/SuperProperties.kt +++ b/vector/src/main/java/im/vector/app/features/analytics/plan/SuperProperties.kt @@ -26,7 +26,7 @@ package im.vector.app.features.analytics.plan */ data class SuperProperties( /** - * Used by web to identify the platform (Web Platform/Electron Platform) + * Used by web to identify the platform (Web Platform/Electron Platform). */ val appPlatform: String? = null, /**