ZaStoGram_desktop/Telegram/SourceFiles/wallet/wallet_rates.h
loop-uh 0fd5d76a67 Merge upstream v7.3.1
Слияние с tdesktop от 64ca5475f2 до тега v7.3.1 (7.2.10 beta, 7.3, 7.3.1).

- Версия 7.3.1 (7003001), BetaChannel 0, комментарий ZaStoGram сохранён.
- Обновлятор: оригинал убрал пакеты v1 (RSA), а наш Packer и Forgejo
  выпускают именно их. v1 оставлен как UnpackUpdateV1 рядом с v2 и
  использует новые проверенные распаковку и извлечение файлов.
- mtproto: исправления импорта авторизации из оригинала перенесены в нашу
  структуру RequestRegistry; пути include новых файлов кошелька
  приведены к нашей раскладке mtproto/.
- prepare.py: стадии оригинала (ucrt64, ffmpeg 8, openssl 3.5, libheif,
  Rust, wallet-engine) с нашими skip-debug и patches_extra.
- lib_ui, lib_lottie: форки слиты с версиями из v7.3.1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 21:43:47 +03:00

45 lines
1.1 KiB
C++

/*
This file is part of Telegram Desktop,
the official desktop application for the Telegram messaging service.
For license and copyright information please follow this link:
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#pragma once
#include "base/timer.h"
#include "gram/api/gram_api_rates.h"
#include "mtproto/instance/sender.h"
#include "wallet/wallet_fiat.h"
namespace Wallet {
class Rates final {
public:
explicit Rates(not_null<Main::Session*> session);
[[nodiscard]] FiatRate current();
[[nodiscard]] rpl::producer<FiatRate> value();
[[nodiscard]] std::vector<QString> currencies();
void setCurrency(const QString &code);
private:
void ensureStarted();
void request();
void applyRates(const MTPpayments_CurrencyRates &result);
void recompute();
void scheduleRefresh(bool afterFailure);
const not_null<Main::Session*> _session;
MTP::Sender _api;
mtpRequestId _requestId = 0;
base::Timer _timer;
std::optional<Gram::CurrencyRates> _rates;
rpl::variable<FiatRate> _value;
bool _started = false;
rpl::lifetime _lifetime;
};
} // namespace Wallet