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

Show premium page on limit increase decision.

This commit is contained in:
John Preston
2022-05-20 17:12:56 +04:00
parent dc444ec22b
commit 5cd065ef6b
10 changed files with 42 additions and 24 deletions

View File

@@ -9,6 +9,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "lang/lang_keys.h"
#include "settings/settings_common.h"
#include "settings/settings_premium.h"
#include "core/application.h"
#include "ui/abstract_button.h"
#include "ui/effects/gradient.h"
#include "ui/text/text_utilities.h"
@@ -17,6 +19,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/wrap/padding_wrap.h"
#include "ui/wrap/vertical_layout.h"
#include "window/window_session_controller.h"
#include "window/window_controller.h"
#include "main/main_session.h"
#include "styles/style_boxes.h"
#include "styles/style_chat_helpers.h"
#include "styles/style_layers.h"
@@ -251,4 +255,20 @@ Type PremiumId() {
return Premium::Id();
}
void ShowPremium(not_null<Main::Session*> session) {
const auto active = Core::App().activeWindow();
const auto controller = (active && active->isPrimary())
? active->sessionController()
: nullptr;
if (controller && session == &controller->session()) {
controller->showSettings(Settings::PremiumId());
} else {
for (const auto &controller : session->windows()) {
if (controller->window().isPrimary()) {
controller->showSettings(Settings::PremiumId());
}
}
}
}
} // namespace Settings