Merge pull request #20004 from prlanzarin/u27/fix/audio-less-toasts

[2.7] fix(audio): minimize redundant audio exit toasts
This commit is contained in:
Anton Georgiev 2024-04-12 15:53:18 -04:00 committed by GitHub
commit 6eaf8cd44d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -475,6 +475,7 @@ class AudioManager {
} }
forceExitAudio() { forceExitAudio() {
this.notifyAudioExit();
this.isConnected = false; this.isConnected = false;
this.isConnecting = false; this.isConnecting = false;
this.isHangingUp = false; this.isHangingUp = false;
@ -604,7 +605,21 @@ class AudioManager {
this.isConnecting = true; this.isConnecting = true;
} }
// Must be called before the call is actually torn down (this.isConnected = true)
notifyAudioExit() {
try {
if (!this.error && (this.isConnected && !this.isEchoTest)) {
this.notify(
this.intl.formatMessage(this.messages.info.LEFT_AUDIO),
false,
'no_audio',
);
}
} catch {}
}
onAudioExit() { onAudioExit() {
this.notifyAudioExit();
this.isConnected = false; this.isConnected = false;
this.isConnecting = false; this.isConnecting = false;
this.isHangingUp = false; this.isHangingUp = false;
@ -616,13 +631,6 @@ class AudioManager {
this.inputStream = null; this.inputStream = null;
} }
if (!this.error && !this.isEchoTest) {
this.notify(
this.intl.formatMessage(this.messages.info.LEFT_AUDIO),
false,
'no_audio'
);
}
if (!this.isEchoTest) { if (!this.isEchoTest) {
this.playHangUpSound(); this.playHangUpSound();
} }