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;
if (row.newWindow && controller->canShowSeparateWindow(peer)) {
const auto active = controller->activeChatCurrent();
if (const auto history = active.history()) {
if (history->peer == peer) {
const auto fromActive = active.history()
? (active.history()->peer == peer)
: false;
const auto toSeparate = [=] {
Core::App().ensureSeparateWindowForPeer(
peer,
showAtMsgId);
};
if (fromActive) {
controller->window().preventOrInvoke([=] {
controller->content()->ui_showPeerHistory(
0,
Window::SectionShow::Way::ClearStack,
0);
}
toSeparate();
});
} else {
toSeparate();
}
Core::App().ensureSeparateWindowForPeer(peer, showAtMsgId);
} else {
controller->content()->choosePeer(peer->id, showAtMsgId);
}

View file

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