Analytics: track interaction Interaction.Name.MobileRoomComposerFormattingEnabled
This commit is contained in:
parent
174d45f4dd
commit
a5f3b9909c
2 changed files with 11 additions and 0 deletions
|
|
@ -36,6 +36,7 @@ import androidx.compose.runtime.setValue
|
||||||
import androidx.media3.common.MimeTypes
|
import androidx.media3.common.MimeTypes
|
||||||
import androidx.media3.common.util.UnstableApi
|
import androidx.media3.common.util.UnstableApi
|
||||||
import im.vector.app.features.analytics.plan.Composer
|
import im.vector.app.features.analytics.plan.Composer
|
||||||
|
import im.vector.app.features.analytics.plan.Interaction
|
||||||
import io.element.android.features.messages.impl.attachments.Attachment
|
import io.element.android.features.messages.impl.attachments.Attachment
|
||||||
import io.element.android.features.messages.impl.attachments.preview.error.sendAttachmentError
|
import io.element.android.features.messages.impl.attachments.preview.error.sendAttachmentError
|
||||||
import io.element.android.features.messages.impl.mentions.MentionSuggestionsProcessor
|
import io.element.android.features.messages.impl.mentions.MentionSuggestionsProcessor
|
||||||
|
|
@ -68,6 +69,7 @@ import io.element.android.libraries.textcomposer.model.Suggestion
|
||||||
import io.element.android.libraries.textcomposer.model.TextEditorState
|
import io.element.android.libraries.textcomposer.model.TextEditorState
|
||||||
import io.element.android.libraries.textcomposer.model.rememberMarkdownTextEditorState
|
import io.element.android.libraries.textcomposer.model.rememberMarkdownTextEditorState
|
||||||
import io.element.android.services.analytics.api.AnalyticsService
|
import io.element.android.services.analytics.api.AnalyticsService
|
||||||
|
import io.element.android.services.analyticsproviders.api.trackers.captureInteraction
|
||||||
import kotlinx.collections.immutable.persistentListOf
|
import kotlinx.collections.immutable.persistentListOf
|
||||||
import kotlinx.collections.immutable.toPersistentList
|
import kotlinx.collections.immutable.toPersistentList
|
||||||
import kotlinx.coroutines.CancellationException
|
import kotlinx.coroutines.CancellationException
|
||||||
|
|
@ -388,6 +390,9 @@ class MessageComposerPresenter @Inject constructor(
|
||||||
is MessageComposerEvents.ToggleTextFormatting -> {
|
is MessageComposerEvents.ToggleTextFormatting -> {
|
||||||
showAttachmentSourcePicker = false
|
showAttachmentSourcePicker = false
|
||||||
showTextFormatting = event.enabled
|
showTextFormatting = event.enabled
|
||||||
|
if (showTextFormatting) {
|
||||||
|
analyticsService.captureInteraction(Interaction.Name.MobileRoomComposerFormattingEnabled)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
is MessageComposerEvents.Error -> {
|
is MessageComposerEvents.Error -> {
|
||||||
analyticsService.trackError(event.error)
|
analyticsService.trackError(event.error)
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@ import app.cash.turbine.ReceiveTurbine
|
||||||
import app.cash.turbine.test
|
import app.cash.turbine.test
|
||||||
import com.google.common.truth.Truth.assertThat
|
import com.google.common.truth.Truth.assertThat
|
||||||
import im.vector.app.features.analytics.plan.Composer
|
import im.vector.app.features.analytics.plan.Composer
|
||||||
|
import im.vector.app.features.analytics.plan.Interaction
|
||||||
import io.element.android.features.messages.impl.messagecomposer.AttachmentsState
|
import io.element.android.features.messages.impl.messagecomposer.AttachmentsState
|
||||||
import io.element.android.features.messages.impl.messagecomposer.DefaultMessageComposerContext
|
import io.element.android.features.messages.impl.messagecomposer.DefaultMessageComposerContext
|
||||||
import io.element.android.features.messages.impl.messagecomposer.MessageComposerEvents
|
import io.element.android.features.messages.impl.messagecomposer.MessageComposerEvents
|
||||||
|
|
@ -768,10 +769,15 @@ class MessageComposerPresenterTest {
|
||||||
val showTextFormatting = awaitItem()
|
val showTextFormatting = awaitItem()
|
||||||
assertThat(showTextFormatting.showAttachmentSourcePicker).isFalse()
|
assertThat(showTextFormatting.showAttachmentSourcePicker).isFalse()
|
||||||
assertThat(showTextFormatting.showTextFormatting).isTrue()
|
assertThat(showTextFormatting.showTextFormatting).isTrue()
|
||||||
|
assertThat(analyticsService.capturedEvents).containsExactly(
|
||||||
|
Interaction(index = null, interactionType = null, name = Interaction.Name.MobileRoomComposerFormattingEnabled)
|
||||||
|
)
|
||||||
|
analyticsService.capturedEvents.clear()
|
||||||
showTextFormatting.eventSink(MessageComposerEvents.ToggleTextFormatting(false))
|
showTextFormatting.eventSink(MessageComposerEvents.ToggleTextFormatting(false))
|
||||||
skipItems(1)
|
skipItems(1)
|
||||||
val finished = awaitItem()
|
val finished = awaitItem()
|
||||||
assertThat(finished.showTextFormatting).isFalse()
|
assertThat(finished.showTextFormatting).isFalse()
|
||||||
|
assertThat(analyticsService.capturedEvents).isEmpty()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue