2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Initial support of separate windows for accounts.

This commit is contained in:
John Preston
2023-01-17 19:47:58 +04:00
parent 86ed2745e3
commit 7023b013ce
32 changed files with 323 additions and 143 deletions

View File

@@ -123,22 +123,18 @@ using UpdatedFileReferences = Data::UpdatedFileReferences;
[[nodiscard]] std::shared_ptr<Window::Show> ShowForPeer(
not_null<PeerData*> peer) {
const auto separate = Core::App().separateWindowForPeer(peer);
const auto window = separate ? separate : Core::App().primaryWindow();
return std::make_shared<Window::Show>(window);
return std::make_shared<Window::Show>(Core::App().windowFor(peer));
}
void ShowChannelsLimitBox(not_null<PeerData*> peer) {
const auto primary = Core::App().primaryWindow();
if (!primary) {
return;
if (const auto window = Core::App().windowFor(peer)) {
window->invokeForSessionController(
&peer->session().account(),
peer,
[&](not_null<Window::SessionController*> controller) {
controller->show(Box(ChannelsLimitBox, &peer->session()));
});
}
primary->invokeForSessionController(
&peer->session().account(),
peer,
[&](not_null<Window::SessionController*> controller) {
controller->show(Box(ChannelsLimitBox, &peer->session()));
});
}
} // namespace