mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 21:32:34 +00:00
Revert unnecessary analytics refactor in voice message presenter
This commit is contained in:
+13
-12
@@ -153,7 +153,7 @@ class DefaultVoiceMessageComposerPresenter(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun sendVoiceMessage(inReplyToEventId: EventId?, composerEvent: Composer) {
|
fun sendVoiceMessage(inReplyToEventId: EventId?) {
|
||||||
val finishedState = recorderState as? VoiceRecorderState.Finished
|
val finishedState = recorderState as? VoiceRecorderState.Finished
|
||||||
if (finishedState == null) {
|
if (finishedState == null) {
|
||||||
val exception = VoiceMessageException.FileException("No file to send")
|
val exception = VoiceMessageException.FileException("No file to send")
|
||||||
@@ -166,7 +166,7 @@ class DefaultVoiceMessageComposerPresenter(
|
|||||||
}
|
}
|
||||||
isSending = true
|
isSending = true
|
||||||
player.pause()
|
player.pause()
|
||||||
analyticsService.capture(composerEvent)
|
analyticsService.captureComposerEvent()
|
||||||
sessionCoroutineScope.launch {
|
sessionCoroutineScope.launch {
|
||||||
val result = sendMessage(
|
val result = sendMessage(
|
||||||
file = finishedState.file,
|
file = finishedState.file,
|
||||||
@@ -187,12 +187,11 @@ class DefaultVoiceMessageComposerPresenter(
|
|||||||
is VoiceMessageComposerEvent.RecorderEvent -> handleVoiceMessageRecorderEvent(event.recorderEvent)
|
is VoiceMessageComposerEvent.RecorderEvent -> handleVoiceMessageRecorderEvent(event.recorderEvent)
|
||||||
is VoiceMessageComposerEvent.PlayerEvent -> handleVoiceMessagePlayerEvent(event.playerEvent)
|
is VoiceMessageComposerEvent.PlayerEvent -> handleVoiceMessagePlayerEvent(event.playerEvent)
|
||||||
is VoiceMessageComposerEvent.SendVoiceMessage -> {
|
is VoiceMessageComposerEvent.SendVoiceMessage -> {
|
||||||
// Capture mode eagerly before any coroutine dispatch, since CloseSpecialMode
|
// Capture reply info eagerly before any coroutine dispatch, since CloseSpecialMode
|
||||||
// may reset it before the coroutine runs.
|
// may reset composerMode before the coroutine runs.
|
||||||
val inReplyToEventId = (messageComposerContext.composerMode as? MessageComposerMode.Reply)?.eventId
|
val inReplyToEventId = (messageComposerContext.composerMode as? MessageComposerMode.Reply)?.eventId
|
||||||
val composerEvent = buildComposerEvent()
|
|
||||||
localCoroutineScope.launch {
|
localCoroutineScope.launch {
|
||||||
sendVoiceMessage(inReplyToEventId, composerEvent)
|
sendVoiceMessage(inReplyToEventId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
VoiceMessageComposerEvent.DeleteVoiceMessage -> {
|
VoiceMessageComposerEvent.DeleteVoiceMessage -> {
|
||||||
@@ -308,12 +307,14 @@ class DefaultVoiceMessageComposerPresenter(
|
|||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun buildComposerEvent() =
|
private fun AnalyticsService.captureComposerEvent() =
|
||||||
Composer(
|
capture(
|
||||||
inThread = messageComposerContext.composerMode.inThread,
|
Composer(
|
||||||
isEditing = messageComposerContext.composerMode.isEditing,
|
inThread = messageComposerContext.composerMode.inThread,
|
||||||
isReply = messageComposerContext.composerMode.isReply,
|
isEditing = messageComposerContext.composerMode.isEditing,
|
||||||
messageType = Composer.MessageType.VoiceMessage,
|
isReply = messageComposerContext.composerMode.isReply,
|
||||||
|
messageType = Composer.MessageType.VoiceMessage,
|
||||||
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user