Fixed showing of rate call box in appropriate window.

This commit is contained in:
23rd 2024-03-19 18:58:20 +03:00 committed by John Preston
parent a0e0fd5b98
commit 893c09c848
1 changed files with 17 additions and 4 deletions

View File

@ -22,6 +22,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "mtproto/mtproto_config.h"
#include "core/application.h"
#include "core/core_settings.h"
#include "window/window_controller.h"
#include "media/audio/media_audio_track.h"
#include "base/platform/base_platform_info.h"
#include "calls/calls_panel.h"
@ -706,11 +707,15 @@ bool Call::handleUpdate(const MTPPhoneCall &call) {
}
}
if (data.is_need_rating() && _id && _accessHash) {
const auto window = Core::App().windowFor(_user);
const auto session = &_user->session();
const auto callId = _id;
const auto callAccessHash = _accessHash;
const auto box = Ui::show(Box<Ui::RateCallBox>(
Core::App().settings().sendSubmitWay()));
auto owned = Box<Ui::RateCallBox>(
Core::App().settings().sendSubmitWay());
const auto box = window
? window->show(std::move(owned))
: Ui::show(std::move(owned));
const auto sender = box->lifetime().make_state<MTP::Sender>(
&session->mtp());
box->sends(
@ -1377,7 +1382,11 @@ void Call::handleRequestError(const QString &error) {
_user->name())
: QString();
if (!inform.isEmpty()) {
Ui::show(Ui::MakeInformBox(inform));
if (const auto window = Core::App().windowFor(_user)) {
window->show(Ui::MakeInformBox(inform));
} else {
Ui::show(Ui::MakeInformBox(inform));
}
}
finish(FinishType::Failed);
}
@ -1391,7 +1400,11 @@ void Call::handleControllerError(const QString &error) {
? tr::lng_call_error_audio_io(tr::now)
: QString();
if (!inform.isEmpty()) {
Ui::show(Ui::MakeInformBox(inform));
if (const auto window = Core::App().windowFor(_user)) {
window->show(Ui::MakeInformBox(inform));
} else {
Ui::show(Ui::MakeInformBox(inform));
}
}
finish(FinishType::Failed);
}