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

Don't shows premium section / preview if unavailable.

This commit is contained in:
John Preston
2022-06-08 11:26:53 +04:00
parent 86889cf1ef
commit 524771529a
5 changed files with 29 additions and 1 deletions

View File

@@ -22,9 +22,11 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/effects/path_shift_gradient.h"
#include "ui/effects/premium_graphics.h"
#include "ui/text/text.h"
#include "ui/text/text_utilities.h"
#include "ui/widgets/buttons.h"
#include "ui/widgets/gradient_round_button.h"
#include "ui/wrap/padding_wrap.h"
#include "ui/boxes/confirm_box.h"
#include "settings/settings_premium.h"
#include "lottie/lottie_single_player.h"
#include "history/view/media/history_view_sticker.h"
@@ -743,6 +745,10 @@ void Show(not_null<Window::SessionController*> controller, QImage back) {
void Show(
not_null<Window::SessionController*> controller,
Descriptor &&descriptor) {
if (!controller->session().premiumPossible()) {
controller->show(Box(PremiumUnavailableBox));
return;
}
auto &list = Preloads();
for (auto i = begin(list); i != end(list);) {
const auto already = i->controller.get();
@@ -830,3 +836,12 @@ void ShowPremiumPreviewBox(
.disabled = disabled,
});
}
void PremiumUnavailableBox(not_null<Ui::GenericBox*> box) {
Ui::ConfirmBox(box, {
.text = tr::lng_premium_unavailable(
tr::now,
Ui::Text::RichLangValue),
.inform = true,
});
}