Audio Player: Fix sudden playing after disconnect

This commit is contained in:
Alexander Zinchuk 2021-05-12 22:22:16 +03:00
parent 11cb73be5e
commit af40465e14

View File

@ -23,7 +23,7 @@ import {
replaceThreadParam, replaceThreadParam,
} from '../../reducers'; } from '../../reducers';
import { import {
selectUser, selectChat, selectCurrentMessageList, selectDraft, selectUser, selectChat, selectCurrentMessageList, selectDraft, selectChatMessage,
} from '../../selectors'; } from '../../selectors';
import { isChatPrivate } from '../../helpers'; import { isChatPrivate } from '../../helpers';
@ -254,6 +254,11 @@ async function loadAndReplaceMessages(savedUsers?: ApiUser[]) {
} }
setGlobal(global); setGlobal(global);
const { chatId: audioChatId, messageId: audioMessageId } = global.audioPlayer;
if (audioChatId && audioMessageId && !selectChatMessage(global, audioChatId, audioMessageId)) {
getDispatch().closeAudioPlayer();
}
} }
async function loadAndUpdateUsers() { async function loadAndUpdateUsers() {