Split VoiceMessageType from AudioMessageType (#1664)

Currently, for compatibility reasons, we implement MSC3245v1 which puts the voice data inside an audio message type. Though at times it seems impractical to deal with a single message type which effectively represents 2 different kinds of messages.

This PR creates a new message type called `VoiceMessageType` which is used whenever we receive an event with `"msgtype": "m.audio"` which also has the `"org.matrix.msc3245.voice": {}` field. This makes it easier to process voice messages as different entities throughout the rest of the codebase.
This commit is contained in:
Marco Romano 2023-10-27 16:02:16 +02:00 committed by GitHub
parent f1b98e8746
commit d05dd11485
7 changed files with 76 additions and 55 deletions

View file

@ -50,6 +50,7 @@ import io.element.android.libraries.matrix.api.timeline.item.event.UnableToDecry
import io.element.android.libraries.matrix.api.timeline.item.event.UnknownContent
import io.element.android.libraries.matrix.api.timeline.item.event.UnknownMessageType
import io.element.android.libraries.matrix.api.timeline.item.event.VideoMessageType
import io.element.android.libraries.matrix.api.timeline.item.event.VoiceMessageType
import io.element.android.libraries.ui.strings.CommonStrings
import io.element.android.services.toolbox.api.strings.StringProvider
import javax.inject.Inject
@ -128,11 +129,10 @@ class DefaultRoomLastMessageFormatter @Inject constructor(
sp.getString(CommonStrings.common_file)
}
is AudioMessageType -> {
if (messageType.isVoiceMessage) {
sp.getString(CommonStrings.common_voice_message)
} else {
sp.getString(CommonStrings.common_audio)
}
sp.getString(CommonStrings.common_audio)
}
is VoiceMessageType -> {
sp.getString(CommonStrings.common_voice_message)
}
is OtherMessageType -> {
messageType.body