From 219bb89c3aabd9fb0d50ad9548e8dff6afb27a5e Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Tue, 7 Dec 2021 13:21:06 +0100 Subject: [PATCH] Analytics: Import the latest plan --- .../app/features/analytics/plan/CallEnded.kt | 56 ++++++++++++ .../app/features/analytics/plan/CallError.kt | 51 +++++++++++ .../features/analytics/plan/CallStarted.kt | 51 +++++++++++ .../app/features/analytics/plan/Click.kt | 50 ++++++++++ .../features/analytics/plan/CreatedRoom.kt | 41 +++++++++ .../app/features/analytics/plan/Error.kt | 3 +- .../app/features/analytics/plan/JoinedRoom.kt | 54 +++++++++++ .../analytics/plan/PerformanceTimer.kt | 91 +++++++++++++++++++ .../app/features/analytics/plan/Screen.kt | 8 +- 9 files changed, 402 insertions(+), 3 deletions(-) create mode 100644 vector/src/main/java/im/vector/app/features/analytics/plan/CallEnded.kt create mode 100644 vector/src/main/java/im/vector/app/features/analytics/plan/CallError.kt create mode 100644 vector/src/main/java/im/vector/app/features/analytics/plan/CallStarted.kt create mode 100644 vector/src/main/java/im/vector/app/features/analytics/plan/Click.kt create mode 100644 vector/src/main/java/im/vector/app/features/analytics/plan/CreatedRoom.kt create mode 100644 vector/src/main/java/im/vector/app/features/analytics/plan/JoinedRoom.kt create mode 100644 vector/src/main/java/im/vector/app/features/analytics/plan/PerformanceTimer.kt diff --git a/vector/src/main/java/im/vector/app/features/analytics/plan/CallEnded.kt b/vector/src/main/java/im/vector/app/features/analytics/plan/CallEnded.kt new file mode 100644 index 0000000000..cd813325f1 --- /dev/null +++ b/vector/src/main/java/im/vector/app/features/analytics/plan/CallEnded.kt @@ -0,0 +1,56 @@ +/* + * 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 call has ended. + */ +data class CallEnded( + /** + * The duration of the call in milliseconds. + */ + val durationMs: Int, + /** + * Whether its a video call or not. + */ + val isVideo: Boolean, + /** + * Number of participants in the call. + */ + val numParticipants: Int, + /** + * Whether this user placed it. + */ + val placed: Boolean, +) : VectorAnalyticsEvent { + + override fun getName() = "CallEnded" + + override fun getProperties(): Map? { + return mutableMapOf().apply { + put("durationMs", durationMs) + put("isVideo", isVideo) + put("numParticipants", numParticipants) + put("placed", placed) + }.takeIf { it.isNotEmpty() } + } +} diff --git a/vector/src/main/java/im/vector/app/features/analytics/plan/CallError.kt b/vector/src/main/java/im/vector/app/features/analytics/plan/CallError.kt new file mode 100644 index 0000000000..18e77f9f1c --- /dev/null +++ b/vector/src/main/java/im/vector/app/features/analytics/plan/CallError.kt @@ -0,0 +1,51 @@ +/* + * 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 an error occurred in a call. + */ +data class CallError( + /** + * Whether its a video call or not. + */ + val isVideo: Boolean, + /** + * Number of participants in the call. + */ + val numParticipants: Int, + /** + * Whether this user placed it. + */ + val placed: Boolean, +) : VectorAnalyticsEvent { + + override fun getName() = "CallError" + + override fun getProperties(): Map? { + return mutableMapOf().apply { + put("isVideo", isVideo) + put("numParticipants", numParticipants) + put("placed", placed) + }.takeIf { it.isNotEmpty() } + } +} diff --git a/vector/src/main/java/im/vector/app/features/analytics/plan/CallStarted.kt b/vector/src/main/java/im/vector/app/features/analytics/plan/CallStarted.kt new file mode 100644 index 0000000000..81f4b6c194 --- /dev/null +++ b/vector/src/main/java/im/vector/app/features/analytics/plan/CallStarted.kt @@ -0,0 +1,51 @@ +/* + * 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 call is started. + */ +data class CallStarted( + /** + * Whether its a video call or not. + */ + val isVideo: Boolean, + /** + * Number of participants in the call. + */ + val numParticipants: Int, + /** + * Whether this user placed it. + */ + val placed: Boolean, +) : VectorAnalyticsEvent { + + override fun getName() = "CallStarted" + + override fun getProperties(): Map? { + return mutableMapOf().apply { + put("isVideo", isVideo) + put("numParticipants", numParticipants) + put("placed", placed) + }.takeIf { it.isNotEmpty() } + } +} diff --git a/vector/src/main/java/im/vector/app/features/analytics/plan/Click.kt b/vector/src/main/java/im/vector/app/features/analytics/plan/Click.kt new file mode 100644 index 0000000000..fbc36a1195 --- /dev/null +++ b/vector/src/main/java/im/vector/app/features/analytics/plan/Click.kt @@ -0,0 +1,50 @@ +/* + * 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 clicks/taps on a UI element. + */ +data class Click( + /** + * The index of the element, if its in a list of elements. + */ + val index: Int? = null, + /** + * The unique name of this element. + */ + val name: Name, +) : VectorAnalyticsEvent { + + enum class Name { + SendMessageButton, + } + + override fun getName() = "Click" + + override fun getProperties(): Map? { + return mutableMapOf().apply { + index?.let { put("index", it) } + put("name", name.name) + }.takeIf { it.isNotEmpty() } + } +} diff --git a/vector/src/main/java/im/vector/app/features/analytics/plan/CreatedRoom.kt b/vector/src/main/java/im/vector/app/features/analytics/plan/CreatedRoom.kt new file mode 100644 index 0000000000..9562a6e735 --- /dev/null +++ b/vector/src/main/java/im/vector/app/features/analytics/plan/CreatedRoom.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 creates a room. + */ +data class CreatedRoom( + /** + * Whether the room is a DM. + */ + val isDM: Boolean, +) : VectorAnalyticsEvent { + + override fun getName() = "CreatedRoom" + + override fun getProperties(): Map? { + return mutableMapOf().apply { + put("isDM", isDM) + }.takeIf { it.isNotEmpty() } + } +} 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 d5374f321a..988ad309b9 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 @@ -18,7 +18,8 @@ package im.vector.app.features.analytics.plan import im.vector.app.features.analytics.itf.VectorAnalyticsEvent -// GENERATED FILE, DO NOT EDIT +// GENERATED FILE, DO NOT EDIT. FOR MORE INFORMATION VISIT +// https://github.com/matrix-org/matrix-analytics-events/ /** * Triggered when an error occurred diff --git a/vector/src/main/java/im/vector/app/features/analytics/plan/JoinedRoom.kt b/vector/src/main/java/im/vector/app/features/analytics/plan/JoinedRoom.kt new file mode 100644 index 0000000000..fc5f29bff1 --- /dev/null +++ b/vector/src/main/java/im/vector/app/features/analytics/plan/JoinedRoom.kt @@ -0,0 +1,54 @@ +/* + * 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 joins a room. + */ +data class JoinedRoom( + /** + * Whether the room is a DM. + */ + val isDM: Boolean, + /** + * The size of the room. + */ + val roomSize: RoomSize, +) : VectorAnalyticsEvent { + + enum class RoomSize { + ElevenToOneHundred, + MoreThanAThousand, + OneHundredAndOneToAThousand, + ThreeToTen, + Two, + } + + override fun getName() = "JoinedRoom" + + override fun getProperties(): Map? { + return mutableMapOf().apply { + put("isDM", isDM) + put("roomSize", roomSize.name) + }.takeIf { it.isNotEmpty() } + } +} diff --git a/vector/src/main/java/im/vector/app/features/analytics/plan/PerformanceTimer.kt b/vector/src/main/java/im/vector/app/features/analytics/plan/PerformanceTimer.kt new file mode 100644 index 0000000000..89ea784722 --- /dev/null +++ b/vector/src/main/java/im/vector/app/features/analytics/plan/PerformanceTimer.kt @@ -0,0 +1,91 @@ +/* + * 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 after timing an operation in the app. + */ +data class PerformanceTimer( + /** + * Client defined, can be used for debugging. + */ + val context: String? = null, + /** + * Client defined, an optional value to indicate how many items were handled during the operation. + */ + val itemCount: Int? = null, + /** + * The timer that is being reported. + */ + val name: Name, + /** + * The time reported by the timer in milliseconds. + */ + val timeMs: Int, +) : VectorAnalyticsEvent { + + enum class Name { + /** + * The time spent parsing the response from an initial /sync request. + */ + InitialSyncParsing, + /** + * The time spent waiting for a response to an initial /sync request. + */ + InitialSyncRequest, + /** + * The time taken to display an event in the timeline that was opened from a notification. + */ + NotificationsOpenEvent, + /** + * The duration of a regular /sync request when resuming the app. + */ + StartupIncrementalSync, + /** + * The duration of an initial /sync request during startup (if the store has been wiped). + */ + StartupInitialSync, + /** + * How long the app launch screen is displayed for. + */ + StartupLaunchScreen, + /** + * The time to preload data in the MXStore on iOS. + */ + StartupStorePreload, + /** + * The time to load all data from the store (including StartupStorePreload time). + */ + StartupStoreReady, + } + + override fun getName() = "PerformanceTimer" + + override fun getProperties(): Map? { + return mutableMapOf().apply { + context?.let { put("context", it) } + itemCount?.let { put("itemCount", it) } + put("name", name.name) + put("timeMs", timeMs) + }.takeIf { it.isNotEmpty() } + } +} diff --git a/vector/src/main/java/im/vector/app/features/analytics/plan/Screen.kt b/vector/src/main/java/im/vector/app/features/analytics/plan/Screen.kt index 3be490fedb..1f18ceee00 100644 --- a/vector/src/main/java/im/vector/app/features/analytics/plan/Screen.kt +++ b/vector/src/main/java/im/vector/app/features/analytics/plan/Screen.kt @@ -18,13 +18,17 @@ package im.vector.app.features.analytics.plan import im.vector.app.features.analytics.itf.VectorAnalyticsScreen -// GENERATED FILE, DO NOT EDIT +// GENERATED FILE, DO NOT EDIT. FOR MORE INFORMATION VISIT +// https://github.com/matrix-org/matrix-analytics-events/ /** * Triggered when the user changed screen */ data class Screen( - val durationMs: Double? = null, + /** + * How long the screen was displayed for in milliseconds. + */ + val durationMs: Int? = null, val screenName: ScreenName, ) : VectorAnalyticsScreen {