mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-17 06:37:24 +02:00
Add ToS and Privacy Policy links to premium subscription.
This commit is contained in:
parent
654eaa27fd
commit
896d39bc6a
3 changed files with 31 additions and 9 deletions
|
@ -1700,6 +1700,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
"lng_premium_summary_bottom_subtitle" = "About Telegram Premium";
|
||||
"lng_premium_summary_bottom_about" = "While the free version of Telegram already gives its users more than any other messaging application, **Telegram Premium** pushes its capabilities even further.\n\n**Telegram Premium** is a paid option, because most Premium Features require additional expenses from Telegram to third parties such as data center providers and server manufacturers. Contributions from **Telegram Premium** users allow us to cover such costs and also help Telegram stay free for everyone.";
|
||||
"lng_premium_summary_button" = "Subscribe for {cost} per month";
|
||||
"lng_premium_summary_terms" = "Our Terms of Service";
|
||||
"lng_premium_summary_policy" = "Privacy Policy";
|
||||
"lng_premium_summary_agree" = "By purchasing a Premium subscription, you agree to {terms} and {policy}.";
|
||||
|
||||
"lng_premium_success" = "You've successfully subscribed to Telegram Premium!";
|
||||
|
||||
|
|
|
@ -456,3 +456,4 @@ settingsPremiumAboutTextStyle: TextStyle(defaultTextStyle) {
|
|||
lineHeight: 18px;
|
||||
}
|
||||
settingsPremiumStatusPadding: margins(22px, 8px, 22px, 2px);
|
||||
settingsPremiumPolicyPadding: margins(22px, 8px, 22px, 8px);
|
||||
|
|
|
@ -206,13 +206,6 @@ using Order = std::vector<QString>;
|
|||
outer);
|
||||
}, label->lifetime());
|
||||
|
||||
parent->widthValue(
|
||||
) | rpl::start_with_next([=](int width) {
|
||||
const auto padding = st::settingsPremiumButtonPadding;
|
||||
result->resizeToWidth(width - padding.left() - padding.right());
|
||||
result->moveToLeft(padding.left(), padding.top(), width);
|
||||
}, result->lifetime());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -892,6 +885,24 @@ QPointer<Ui::RpWidget> Premium::createPinnedToBottom(
|
|||
not_null<Ui::RpWidget*> parent) {
|
||||
const auto content = Ui::CreateChild<Ui::RpWidget>(parent.get());
|
||||
|
||||
constexpr auto TosLink = [](const QString &text) {
|
||||
return Ui::Text::Link(text, "https://telegram.org/tos");
|
||||
};
|
||||
constexpr auto PolicyLink = [](const QString &text) {
|
||||
return Ui::Text::Link(text, "https://telegram.org/privacy");
|
||||
};
|
||||
const auto terms = Ui::CreateChild<Ui::DividerLabel>(
|
||||
content,
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
content,
|
||||
tr::lng_premium_summary_agree(
|
||||
lt_terms,
|
||||
tr::lng_premium_summary_terms() | rpl::map(TosLink),
|
||||
lt_policy,
|
||||
tr::lng_premium_summary_policy() | rpl::map(PolicyLink),
|
||||
Ui::Text::WithEntities),
|
||||
st::boxDividerLabel),
|
||||
st::settingsPremiumPolicyPadding);
|
||||
const auto button = CreateSubscribeButton(_controller, content, [=] {
|
||||
SendScreenAccept(_controller);
|
||||
StartPremiumPayment(_controller, _ref);
|
||||
|
@ -907,7 +918,10 @@ QPointer<Ui::RpWidget> Premium::createPinnedToBottom(
|
|||
RectPart::Top);
|
||||
content->widthValue(
|
||||
) | rpl::start_with_next([=](int width) {
|
||||
const auto padding = st::settingsPremiumButtonPadding;
|
||||
status->resizeToWidth(width);
|
||||
terms->resizeToWidth(width);
|
||||
button->resizeToWidth(width - padding.left() - padding.right());
|
||||
}, status->lifetime());
|
||||
|
||||
const auto session = &_controller->session();
|
||||
|
@ -916,12 +930,14 @@ QPointer<Ui::RpWidget> Premium::createPinnedToBottom(
|
|||
return session->premiumPossible();
|
||||
});
|
||||
rpl::combine(
|
||||
terms->heightValue(),
|
||||
button->heightValue(),
|
||||
status->heightValue(),
|
||||
std::move(text),
|
||||
Data::AmPremiumValue(session),
|
||||
std::move(premiumPossible)
|
||||
) | rpl::start_with_next([=](
|
||||
int termsHeight,
|
||||
int buttonHeight,
|
||||
int statusHeight,
|
||||
const TextWithEntities &text,
|
||||
|
@ -931,13 +947,15 @@ QPointer<Ui::RpWidget> Premium::createPinnedToBottom(
|
|||
const auto finalHeight = !premiumPossible
|
||||
? 0
|
||||
: !premium
|
||||
? (padding.top() + buttonHeight + padding.bottom())
|
||||
? (termsHeight + padding.top() + buttonHeight + padding.bottom())
|
||||
: text.text.isEmpty()
|
||||
? 0
|
||||
: statusHeight;
|
||||
content->resize(content->width(), finalHeight);
|
||||
button->moveToLeft(padding.left(), padding.top());
|
||||
terms->moveToLeft(0, 0);
|
||||
button->moveToLeft(padding.left(), termsHeight + padding.top());
|
||||
status->moveToLeft(0, 0);
|
||||
terms->setVisible(!premium && premiumPossible);
|
||||
button->setVisible(!premium && premiumPossible);
|
||||
status->setVisible(premium && !text.text.isEmpty());
|
||||
if (!premium || text.text.isEmpty()) {
|
||||
|
|
Loading…
Add table
Reference in a new issue