Fixed opening of non-primary windows while recording voice message.

This commit is contained in:
23rd 2022-06-24 03:56:18 +03:00
parent 0fbd7d1a3b
commit 75d8e8ba7d
2 changed files with 19 additions and 6 deletions

View file

@ -265,15 +265,25 @@ Widget::Widget(
: row.message.fullId.msg; : row.message.fullId.msg;
if (row.newWindow && controller->canShowSeparateWindow(peer)) { if (row.newWindow && controller->canShowSeparateWindow(peer)) {
const auto active = controller->activeChatCurrent(); const auto active = controller->activeChatCurrent();
if (const auto history = active.history()) { const auto fromActive = active.history()
if (history->peer == peer) { ? (active.history()->peer == peer)
: false;
const auto toSeparate = [=] {
Core::App().ensureSeparateWindowForPeer(
peer,
showAtMsgId);
};
if (fromActive) {
controller->window().preventOrInvoke([=] {
controller->content()->ui_showPeerHistory( controller->content()->ui_showPeerHistory(
0, 0,
Window::SectionShow::Way::ClearStack, Window::SectionShow::Way::ClearStack,
0); 0);
} toSeparate();
});
} else {
toSeparate();
} }
Core::App().ensureSeparateWindowForPeer(peer, showAtMsgId);
} else { } else {
controller->content()->choosePeer(peer->id, showAtMsgId); controller->content()->choosePeer(peer->id, showAtMsgId);
} }

View file

@ -1416,7 +1416,6 @@ void VoiceRecordBar::hideFast() {
hide(); hide();
_lock->hide(); _lock->hide();
_level->hide(); _level->hide();
stopRecording(StopType::Cancel);
} }
void VoiceRecordBar::stopRecording(StopType type) { void VoiceRecordBar::stopRecording(StopType type) {
@ -1543,7 +1542,10 @@ void VoiceRecordBar::hideAnimated() {
return; return;
} }
_lockShowing = false; _lockShowing = false;
visibilityAnimate(false, [=] { hideFast(); }); visibilityAnimate(false, [=] {
hideFast();
stopRecording(StopType::Cancel);
});
} }
void VoiceRecordBar::finishAnimating() { void VoiceRecordBar::finishAnimating() {
@ -1677,6 +1679,7 @@ void VoiceRecordBar::showDiscardBox(
auto sure = [=, callback = std::move(callback)](Fn<void()> &&close) { auto sure = [=, callback = std::move(callback)](Fn<void()> &&close) {
if (animated == anim::type::instant) { if (animated == anim::type::instant) {
hideFast(); hideFast();
stopRecording(StopType::Cancel);
} else { } else {
hideAnimated(); hideAnimated();
} }