Revert unnecessary analytics refactor in voice message presenter
This commit is contained in:
parent
a6ce20662f
commit
b6df9fe4d7
1 changed files with 13 additions and 12 deletions
|
|
@ -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,
|
||||||
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue