Merge pull request #8577 from element-hq/sync-analytics-plan
Sync analytics plan
This commit is contained in:
commit
25d1945cdc
|
@ -25,5 +25,6 @@ fun MessageComposerViewState.toAnalyticsComposer(): Composer =
|
|||
inThread = isInThreadTimeline(),
|
||||
isEditing = sendMode is SendMode.Edit,
|
||||
isReply = sendMode is SendMode.Reply,
|
||||
startsThread = startsThread
|
||||
messageType = Composer.MessageType.Text,
|
||||
startsThread = startsThread,
|
||||
)
|
||||
|
|
|
@ -39,12 +39,43 @@ data class Composer(
|
|||
* sent event.
|
||||
*/
|
||||
val isReply: Boolean,
|
||||
/**
|
||||
* The type of the message.
|
||||
*/
|
||||
val messageType: MessageType,
|
||||
/**
|
||||
* Whether this message begins a new thread or not.
|
||||
*/
|
||||
val startsThread: Boolean? = null,
|
||||
) : VectorAnalyticsEvent {
|
||||
|
||||
enum class MessageType {
|
||||
/**
|
||||
* A pin drop location message.
|
||||
*/
|
||||
LocationPin,
|
||||
|
||||
/**
|
||||
* A user current location message.
|
||||
*/
|
||||
LocationUser,
|
||||
|
||||
/**
|
||||
* A poll message.
|
||||
*/
|
||||
Poll,
|
||||
|
||||
/**
|
||||
* A text message.
|
||||
*/
|
||||
Text,
|
||||
|
||||
/**
|
||||
* A voice message.
|
||||
*/
|
||||
VoiceMessage,
|
||||
}
|
||||
|
||||
override fun getName() = "Composer"
|
||||
|
||||
override fun getProperties(): Map<String, Any>? {
|
||||
|
@ -52,6 +83,7 @@ data class Composer(
|
|||
put("inThread", inThread)
|
||||
put("isEditing", isEditing)
|
||||
put("isReply", isReply)
|
||||
put("messageType", messageType.name)
|
||||
startsThread?.let { put("startsThread", it) }
|
||||
}.takeIf { it.isNotEmpty() }
|
||||
}
|
||||
|
|
|
@ -38,6 +38,11 @@ data class MobileScreen(
|
|||
*/
|
||||
Breadcrumbs,
|
||||
|
||||
/**
|
||||
* The screen shown to create a poll.
|
||||
*/
|
||||
CreatePollView,
|
||||
|
||||
/**
|
||||
* The screen shown to create a new (non-direct) room.
|
||||
*/
|
||||
|
@ -58,6 +63,11 @@ data class MobileScreen(
|
|||
*/
|
||||
Dialpad,
|
||||
|
||||
/**
|
||||
* The screen shown to edit a poll.
|
||||
*/
|
||||
EditPollView,
|
||||
|
||||
/**
|
||||
* The Favourites tab on mobile that lists your favourite people/rooms.
|
||||
*/
|
||||
|
@ -88,6 +98,16 @@ data class MobileScreen(
|
|||
*/
|
||||
Invites,
|
||||
|
||||
/**
|
||||
* The screen shown to share location.
|
||||
*/
|
||||
LocationSend,
|
||||
|
||||
/**
|
||||
* The screen shown to view a shared location.
|
||||
*/
|
||||
LocationView,
|
||||
|
||||
/**
|
||||
* The screen that displays the login flow (when the user already has an
|
||||
* account).
|
||||
|
|
|
@ -0,0 +1,63 @@
|
|||
/*
|
||||
* 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 poll is created or edited.
|
||||
*/
|
||||
data class PollCreation(
|
||||
/**
|
||||
* Whether this poll has been created or edited.
|
||||
*/
|
||||
val action: Action,
|
||||
/**
|
||||
* Whether this poll is undisclosed.
|
||||
*/
|
||||
val isUndisclosed: Boolean,
|
||||
/**
|
||||
* Number of answers in the poll.
|
||||
*/
|
||||
val numberOfAnswers: Int,
|
||||
) : VectorAnalyticsEvent {
|
||||
|
||||
enum class Action {
|
||||
/**
|
||||
* Newly created poll.
|
||||
*/
|
||||
Create,
|
||||
|
||||
/**
|
||||
* Edit of an existing poll.
|
||||
*/
|
||||
Edit,
|
||||
}
|
||||
|
||||
override fun getName() = "PollCreation"
|
||||
|
||||
override fun getProperties(): Map<String, Any>? {
|
||||
return mutableMapOf<String, Any>().apply {
|
||||
put("action", action.name)
|
||||
put("isUndisclosed", isUndisclosed)
|
||||
put("numberOfAnswers", numberOfAnswers)
|
||||
}.takeIf { it.isNotEmpty() }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* 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 poll has been ended.
|
||||
*/
|
||||
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
|
||||
* name.
|
||||
*/
|
||||
val doNotUse: Boolean? = null,
|
||||
) : VectorAnalyticsEvent {
|
||||
|
||||
override fun getName() = "PollEnd"
|
||||
|
||||
override fun getProperties(): Map<String, Any>? {
|
||||
return mutableMapOf<String, Any>().apply {
|
||||
doNotUse?.let { put("doNotUse", it) }
|
||||
}.takeIf { it.isNotEmpty() }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* 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 poll vote has been cast.
|
||||
*/
|
||||
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
|
||||
* name.
|
||||
*/
|
||||
val doNotUse: Boolean? = null,
|
||||
) : VectorAnalyticsEvent {
|
||||
|
||||
override fun getName() = "PollVote"
|
||||
|
||||
override fun getProperties(): Map<String, Any>? {
|
||||
return mutableMapOf<String, Any>().apply {
|
||||
doNotUse?.let { put("doNotUse", it) }
|
||||
}.takeIf { it.isNotEmpty() }
|
||||
}
|
||||
}
|
|
@ -150,7 +150,7 @@ class MessageComposerViewModel @AssistedInject constructor(
|
|||
}
|
||||
|
||||
private fun handleOnTextChanged(action: MessageComposerAction.OnTextChanged) {
|
||||
val needsSendButtonVisibilityUpdate = currentComposerText.isBlank() != action.text.isBlank()
|
||||
val needsSendButtonVisibilityUpdate = currentComposerText.isBlank() != action.text.isBlank()
|
||||
currentComposerText = SpannableString(action.text)
|
||||
if (needsSendButtonVisibilityUpdate) {
|
||||
updateIsSendButtonVisibility(true)
|
||||
|
@ -239,9 +239,8 @@ class MessageComposerViewModel @AssistedInject constructor(
|
|||
|
||||
private fun handleSendMessage(room: Room, action: MessageComposerAction.SendMessage) {
|
||||
withState { state ->
|
||||
analyticsTracker.capture(state.toAnalyticsComposer()).also {
|
||||
setState { copy(startsThread = false) }
|
||||
}
|
||||
analyticsTracker.capture(state.toAnalyticsComposer())
|
||||
setState { copy(startsThread = false) }
|
||||
when (state.sendMode) {
|
||||
is SendMode.Regular -> {
|
||||
when (val parsedCommand = commandParser.parseSlashCommand(
|
||||
|
|
Loading…
Reference in New Issue