mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Don't show subscribe button with blocked premium.
This commit is contained in:
parent
4570da5767
commit
00bea8d1ee
2 changed files with 14 additions and 5 deletions
|
@ -890,7 +890,7 @@ void FileSizeLimitBox(
|
||||||
|
|
||||||
const auto defaultGb = (defaultLimit + 999) / 2000;
|
const auto defaultGb = (defaultLimit + 999) / 2000;
|
||||||
const auto premiumGb = (premiumLimit + 999) / 2000;
|
const auto premiumGb = (premiumLimit + 999) / 2000;
|
||||||
const auto current = fileSizeBytes
|
const auto current = (fileSizeBytes && premiumPossible)
|
||||||
? std::clamp(
|
? std::clamp(
|
||||||
float64(((fileSizeBytes / uint64(1024 * 1024)) + 999) / 1000),
|
float64(((fileSizeBytes / uint64(1024 * 1024)) + 999) / 1000),
|
||||||
defaultGb,
|
defaultGb,
|
||||||
|
|
|
@ -910,18 +910,27 @@ QPointer<Ui::RpWidget> Premium::createPinnedToBottom(
|
||||||
status->resizeToWidth(width);
|
status->resizeToWidth(width);
|
||||||
}, status->lifetime());
|
}, status->lifetime());
|
||||||
|
|
||||||
|
const auto session = &_controller->session();
|
||||||
|
auto premiumPossible = session->account().appConfig().value(
|
||||||
|
) | rpl::map([=] {
|
||||||
|
return session->premiumPossible();
|
||||||
|
});
|
||||||
rpl::combine(
|
rpl::combine(
|
||||||
button->heightValue(),
|
button->heightValue(),
|
||||||
status->heightValue(),
|
status->heightValue(),
|
||||||
std::move(text),
|
std::move(text),
|
||||||
Data::AmPremiumValue(&_controller->session())
|
Data::AmPremiumValue(session),
|
||||||
|
std::move(premiumPossible)
|
||||||
) | rpl::start_with_next([=](
|
) | rpl::start_with_next([=](
|
||||||
int buttonHeight,
|
int buttonHeight,
|
||||||
int statusHeight,
|
int statusHeight,
|
||||||
const TextWithEntities &text,
|
const TextWithEntities &text,
|
||||||
bool premium) {
|
bool premium,
|
||||||
|
bool premiumPossible) {
|
||||||
const auto padding = st::settingsPremiumButtonPadding;
|
const auto padding = st::settingsPremiumButtonPadding;
|
||||||
const auto finalHeight = !premium
|
const auto finalHeight = !premiumPossible
|
||||||
|
? 0
|
||||||
|
: !premium
|
||||||
? (padding.top() + buttonHeight + padding.bottom())
|
? (padding.top() + buttonHeight + padding.bottom())
|
||||||
: text.text.isEmpty()
|
: text.text.isEmpty()
|
||||||
? 0
|
? 0
|
||||||
|
@ -929,7 +938,7 @@ QPointer<Ui::RpWidget> Premium::createPinnedToBottom(
|
||||||
content->resize(content->width(), finalHeight);
|
content->resize(content->width(), finalHeight);
|
||||||
button->moveToLeft(padding.left(), padding.top());
|
button->moveToLeft(padding.left(), padding.top());
|
||||||
status->moveToLeft(0, 0);
|
status->moveToLeft(0, 0);
|
||||||
button->setVisible(!premium);
|
button->setVisible(!premium && premiumPossible);
|
||||||
status->setVisible(premium && !text.text.isEmpty());
|
status->setVisible(premium && !text.text.isEmpty());
|
||||||
if (!premium || text.text.isEmpty()) {
|
if (!premium || text.text.isEmpty()) {
|
||||||
_bottomSkipRounding.reset();
|
_bottomSkipRounding.reset();
|
||||||
|
|
Loading…
Add table
Reference in a new issue