Merge pull request #4608 from vector-im/feature/adm/converting-vm-on-send
Fixed voice messages on Android 28 and below
This commit is contained in:
commit
17245dc7ae
|
@ -718,7 +718,7 @@ class MessageComposerViewModel @AssistedInject constructor(
|
||||||
if (isCancelled) {
|
if (isCancelled) {
|
||||||
voiceMessageHelper.deleteRecording()
|
voiceMessageHelper.deleteRecording()
|
||||||
} else {
|
} else {
|
||||||
voiceMessageHelper.stopRecording()?.let { audioType ->
|
voiceMessageHelper.stopRecording(convertForSending = true)?.let { audioType ->
|
||||||
if (audioType.duration > 1000) {
|
if (audioType.duration > 1000) {
|
||||||
room.sendMedia(audioType.toContentAttachmentData(isVoiceMessage = true), false, emptySet())
|
room.sendMedia(audioType.toContentAttachmentData(isVoiceMessage = true), false, emptySet())
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -76,13 +76,17 @@ class VoiceMessageHelper @Inject constructor(
|
||||||
startRecordingAmplitudes()
|
startRecordingAmplitudes()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun stopRecording(): MultiPickerAudioType? {
|
fun stopRecording(convertForSending: Boolean): MultiPickerAudioType? {
|
||||||
tryOrNull("Cannot stop media recording amplitude") {
|
tryOrNull("Cannot stop media recording amplitude") {
|
||||||
stopRecordingAmplitudes()
|
stopRecordingAmplitudes()
|
||||||
}
|
}
|
||||||
val voiceMessageFile = tryOrNull("Cannot stop media recorder!") {
|
val voiceMessageFile = tryOrNull("Cannot stop media recorder!") {
|
||||||
voiceRecorder.stopRecord()
|
voiceRecorder.stopRecord()
|
||||||
|
if (convertForSending) {
|
||||||
voiceRecorder.getVoiceMessageFile()
|
voiceRecorder.getVoiceMessageFile()
|
||||||
|
} else {
|
||||||
|
voiceRecorder.getCurrentRecord()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -234,7 +238,7 @@ class VoiceMessageHelper @Inject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
fun stopAllVoiceActions(deleteRecord: Boolean = true): MultiPickerAudioType? {
|
fun stopAllVoiceActions(deleteRecord: Boolean = true): MultiPickerAudioType? {
|
||||||
val audioType = stopRecording()
|
val audioType = stopRecording(convertForSending = false)
|
||||||
stopPlayback()
|
stopPlayback()
|
||||||
if (deleteRecord) {
|
if (deleteRecord) {
|
||||||
deleteRecording()
|
deleteRecording()
|
||||||
|
|
Loading…
Reference in New Issue