diff --git a/Telegram/SourceFiles/payments/payments_form.cpp b/Telegram/SourceFiles/payments/payments_form.cpp index 8cdd0b9a2c..c6ddd84a9f 100644 --- a/Telegram/SourceFiles/payments/payments_form.cpp +++ b/Telegram/SourceFiles/payments/payments_form.cpp @@ -27,6 +27,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "smartglocal/smartglocal_token.h" #include "storage/storage_account.h" #include "ui/image/image.h" +#include "ui/text/format_values.h" #include "ui/text/text_entity.h" #include "apiwrap.h" #include "core/core_cloud_password.h" @@ -385,7 +386,7 @@ void Form::requestForm() { const auto amount = tlPrices.empty() ? 0 : tlPrices.front().data().vamount().v; - if (currency != "XTR" || !amount) { + if (currency != ::Ui::kCreditsCurrency || !amount) { using Type = Error::Type; _updates.fire(Error{ Type::Form, u"Bad Stars Form."_q }); return; diff --git a/Telegram/SourceFiles/payments/payments_non_panel_process.cpp b/Telegram/SourceFiles/payments/payments_non_panel_process.cpp index 3669576d9a..47232ac8ac 100644 --- a/Telegram/SourceFiles/payments/payments_non_panel_process.cpp +++ b/Telegram/SourceFiles/payments/payments_non_panel_process.cpp @@ -11,6 +11,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "payments/payments_form.h" #include "history/history_item.h" #include "ui/layers/generic_box.h" +#include "ui/text/format_values.h" #include "window/window_session_controller.h" #include "boxes/send_credits_box.h" @@ -20,7 +21,7 @@ namespace { bool IsCreditsInvoice(not_null item) { const auto media = item->media(); const auto invoice = media ? media->invoice() : nullptr; - return invoice && (invoice->currency == "XTR"); + return invoice && (invoice->currency == Ui::kCreditsCurrency); } } // namespace diff --git a/Telegram/SourceFiles/ui/text/format_values.h b/Telegram/SourceFiles/ui/text/format_values.h index b73775118a..e4294eed15 100644 --- a/Telegram/SourceFiles/ui/text/format_values.h +++ b/Telegram/SourceFiles/ui/text/format_values.h @@ -13,6 +13,8 @@ inline constexpr auto FileStatusSizeReady = 0xFFFFFFF0LL; inline constexpr auto FileStatusSizeLoaded = 0xFFFFFFF1LL; inline constexpr auto FileStatusSizeFailed = 0xFFFFFFF2LL; +inline const QString kCreditsCurrency = u"XTR"_q; + [[nodiscard]] QString FormatSizeText(qint64 size); [[nodiscard]] QString FormatDownloadText(qint64 ready, qint64 total); [[nodiscard]] QString FormatProgressText(qint64 ready, qint64 total);