mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 14:17:12 +02:00
Nice top-up / star sent toasts.
This commit is contained in:
parent
63f0feaf04
commit
fac20e436d
3 changed files with 11 additions and 16 deletions
|
@ -2455,8 +2455,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
"lng_credits_small_balance_subscribe" = "Buy **Stars** and subscribe to **{channel}** and other channels.";
|
||||
"lng_credits_small_balance_fallback" = "Buy **Stars** to unlock content and services on Telegram.";
|
||||
"lng_credits_purchase_blocked" = "Sorry, you can't purchase this item with Telegram Stars.";
|
||||
"lng_credits_enough" = "You have enough stars at the moment ({balance}). {link}";
|
||||
"lng_credits_enough_link" = "Topup anyway";
|
||||
"lng_credits_enough" = "You have enough stars at the moment. {link}";
|
||||
"lng_credits_enough_link" = "Buy anyway";
|
||||
|
||||
"lng_credits_gift_title" = "Gift Telegram Stars";
|
||||
|
||||
|
@ -3482,7 +3482,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
"lng_paid_react_send" = "Send {price}";
|
||||
"lng_paid_react_agree" = "By sending stars, you agree to the {link}.";
|
||||
"lng_paid_react_agree_link" = "Terms of Service";
|
||||
"lng_paid_react_toast_title" = "Star Sent!";
|
||||
"lng_paid_react_toast#one" = "Star Sent!";
|
||||
"lng_paid_react_toast#other" = "Stars Sent!";
|
||||
"lng_paid_react_toast_text#one" = "You reacted with **{count} Star**.";
|
||||
"lng_paid_react_toast_text#other" = "You reacted with **{count} Stars**.";
|
||||
"lng_paid_react_undo" = "Undo";
|
||||
|
|
|
@ -16,7 +16,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "base/qthelp_url.h"
|
||||
#include "lang/lang_cloud_manager.h"
|
||||
#include "lang/lang_keys.h"
|
||||
#include "core/ui_integration.h" // MarkedTextContext.
|
||||
#include "core/update_checker.h"
|
||||
#include "core/application.h"
|
||||
#include "core/click_handler_types.h"
|
||||
|
@ -34,6 +33,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "passport/passport_form_controller.h"
|
||||
#include "ui/text/text_utilities.h"
|
||||
#include "ui/toast/toast.h"
|
||||
#include "data/components/credits.h"
|
||||
#include "data/data_birthday.h"
|
||||
#include "data/data_channel.h"
|
||||
#include "data/data_document.h"
|
||||
|
@ -1192,13 +1192,6 @@ bool ResolveTopUp(
|
|||
const auto done = [=](::Settings::SmallBalanceResult result) {
|
||||
if (result == ::Settings::SmallBalanceResult::Already) {
|
||||
if (const auto strong = weak.get()) {
|
||||
auto balance = TextWithEntities{ u"hello"_q };
|
||||
const auto context = [=](not_null<QWidget*> toast) {
|
||||
return Core::MarkedTextContext{
|
||||
.session = &strong->session(),
|
||||
.customEmojiRepaint = [=] { toast->update(); },
|
||||
};
|
||||
};
|
||||
const auto filter = [=](const auto &...) {
|
||||
strong->showSettings(::Settings::CreditsId());
|
||||
return false;
|
||||
|
@ -1206,15 +1199,13 @@ bool ResolveTopUp(
|
|||
strong->showToast(Ui::Toast::Config{
|
||||
.text = tr::lng_credits_enough(
|
||||
tr::now,
|
||||
lt_balance,
|
||||
balance,
|
||||
lt_link,
|
||||
Ui::Text::Link(
|
||||
Ui::Text::Bold(
|
||||
tr::lng_credits_enough_link(tr::now))),
|
||||
Ui::Text::RichLangValue),
|
||||
.textContext = context,
|
||||
.filter = filter,
|
||||
.duration = 4 * crl::time(1000),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -1223,7 +1214,7 @@ bool ResolveTopUp(
|
|||
controller->uiShow(),
|
||||
amount,
|
||||
::Settings::SmallBalanceDeepLink{ .purpose = purpose },
|
||||
[](auto) {});
|
||||
done);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -203,7 +203,10 @@ void PaidReactionToast::showFor(
|
|||
_count = count;
|
||||
_timeFinish = finish;
|
||||
auto text = rpl::combine(
|
||||
tr::lng_paid_react_toast_title(Ui::Text::Bold),
|
||||
tr::lng_paid_react_toast(
|
||||
lt_count,
|
||||
_count.value() | tr::to_count(),
|
||||
Ui::Text::Bold),
|
||||
tr::lng_paid_react_toast_text(
|
||||
lt_count_decimal,
|
||||
_count.value() | tr::to_count(),
|
||||
|
|
Loading…
Add table
Reference in a new issue