Fix voice message playback and end sound order

This commit is contained in:
ayumi-signal 2023-09-06 11:06:30 -07:00 committed by GitHub
parent 08e2716e6e
commit 52fa2ddb03
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 9 deletions

View file

@ -12,6 +12,7 @@ import {
} from '../ducks/audioPlayer'; } from '../ducks/audioPlayer';
import { globalMessageAudio } from '../../services/globalMessageAudio'; import { globalMessageAudio } from '../../services/globalMessageAudio';
import { strictAssert } from '../../util/assert'; import { strictAssert } from '../../util/assert';
import { drop } from '../../util/drop';
import * as log from '../../logging/log'; import * as log from '../../logging/log';
import { Sound, SoundType } from '../../util/Sound'; import { Sound, SoundType } from '../../util/Sound';
import { getConversations } from '../selectors/conversations'; import { getConversations } from '../selectors/conversations';
@ -20,10 +21,10 @@ import { markViewed } from '../ducks/conversations';
import * as Errors from '../../types/errors'; import * as Errors from '../../types/errors';
import { usePrevious } from '../../hooks/usePrevious'; import { usePrevious } from '../../hooks/usePrevious';
const stateChangeConfirmUpSound = new Sound({ const stateChangeConfirmDownSound = new Sound({
soundType: SoundType.VoiceNoteStart, soundType: SoundType.VoiceNoteStart,
}); });
const stateChangeConfirmDownSound = new Sound({ const stateChangeConfirmUpSound = new Sound({
soundType: SoundType.VoiceNoteEnd, soundType: SoundType.VoiceNoteEnd,
}); });
@ -128,10 +129,12 @@ export function SmartVoiceNotesPlaybackProvider(
}); });
if (playNextConsecutiveSound) { if (playNextConsecutiveSound) {
// eslint-disable-next-line more/no-then drop(
void stateChangeConfirmUpSound.play().then(() => { (async () => {
globalMessageAudio.play(); await stateChangeConfirmDownSound.play();
}); globalMessageAudio.play();
})()
);
} else { } else {
globalMessageAudio.play(); globalMessageAudio.play();
} }
@ -220,7 +223,7 @@ function loadAudio({
}, },
onEnded() { onEnded() {
if (playFinishConsecutiveSound) { if (playFinishConsecutiveSound) {
void stateChangeConfirmDownSound.play(); drop(stateChangeConfirmUpSound.play());
} }
messageAudioEnded(); messageAudioEnded();
}, },

View file

@ -124,11 +124,11 @@ export class Sound {
} }
if (soundStyle === SoundType.VoiceNoteEnd) { if (soundStyle === SoundType.VoiceNoteEnd) {
return 'sounds/state-change_confirm-down.ogg'; return 'sounds/state-change_confirm-up.ogg';
} }
if (soundStyle === SoundType.VoiceNoteStart) { if (soundStyle === SoundType.VoiceNoteStart) {
return 'sounds/state-change_confirm-up.ogg'; return 'sounds/state-change_confirm-down.ogg';
} }
if (soundStyle === SoundType.Whoosh) { if (soundStyle === SoundType.Whoosh) {