Слияние с 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>
119 lines
3.4 KiB
C++
119 lines
3.4 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/flat_set.h"
|
|
#include "base/weak_ptr.h"
|
|
#include "data/data_msg_id.h"
|
|
#include "mtproto/instance/sender.h"
|
|
#include "wallet/wallet_ton_connect.h"
|
|
#include "wallet/wallet_ton_connect_claims.h"
|
|
|
|
class HistoryItem;
|
|
|
|
namespace Main {
|
|
class Session;
|
|
class SessionShow;
|
|
} // namespace Main
|
|
|
|
namespace Window {
|
|
class SessionController;
|
|
} // namespace Window
|
|
|
|
namespace Wallet {
|
|
|
|
class TonConnectRequests final : public base::has_weak_ptr {
|
|
public:
|
|
TonConnectRequests(
|
|
not_null<Main::Session*> session,
|
|
not_null<TonConnect*> store);
|
|
~TonConnectRequests();
|
|
|
|
void open(
|
|
not_null<Window::SessionController*> controller,
|
|
FullMsgId itemId);
|
|
void openPending(
|
|
not_null<Window::SessionController*> controller,
|
|
const QString &dappClientId);
|
|
void stop();
|
|
|
|
private:
|
|
class Flow;
|
|
enum class TonConnectRecovery : uchar {
|
|
None,
|
|
Offer,
|
|
Answer,
|
|
};
|
|
struct Entry {
|
|
TonConnectSessionId sessionId = 0;
|
|
MsgId msgId = 0;
|
|
QString topic;
|
|
TimeId expires = 0;
|
|
uint64 order = 0;
|
|
bool chosen = false;
|
|
TonConnectRecovery recovery = TonConnectRecovery::None;
|
|
};
|
|
|
|
[[nodiscard]] static std::optional<Entry> PendingEntry(
|
|
not_null<HistoryItem*> item);
|
|
[[nodiscard]] static bool OpensByItself(const Entry &entry);
|
|
[[nodiscard]] Window::SessionController *autoWindow() const;
|
|
[[nodiscard]] bool enqueue(Entry entry);
|
|
void arrived(not_null<HistoryItem*> item);
|
|
void edited(not_null<HistoryItem*> item);
|
|
void showNext();
|
|
void opened(
|
|
Entry entry,
|
|
not_null<Window::SessionController*> controller);
|
|
void start(
|
|
Entry entry,
|
|
base::weak_ptr<Window::SessionController> controller,
|
|
std::shared_ptr<Main::SessionShow> show);
|
|
void startSilent(Entry entry);
|
|
[[nodiscard]] bool silentOwns(MsgId msgId) const;
|
|
void pendingLoaded(
|
|
base::weak_ptr<Window::SessionController> controller,
|
|
const MTPwallet_TonConnectPending &result);
|
|
void sessionClosed(TonConnectSessionId id);
|
|
void closedLoaded(const MTPwallet_TonConnectPending &result);
|
|
void flowDone(not_null<Flow*> flow, bool claimed);
|
|
[[nodiscard]] TonConnectClaimStore &claims();
|
|
[[nodiscard]] TonConnectClaimRecord *claimRecord(
|
|
TonConnectSessionId sessionId,
|
|
MsgId msgId);
|
|
[[nodiscard]] bool updateClaims(Fn<void(TonConnectClaimStore&)> change);
|
|
[[nodiscard]] bool updateClaim(
|
|
TonConnectSessionId sessionId,
|
|
MsgId msgId,
|
|
Fn<void(TonConnectClaimRecord&)> change);
|
|
void forgetClaim(TonConnectSessionId sessionId, MsgId msgId);
|
|
void loadClaims();
|
|
void recoverClaims();
|
|
[[nodiscard]] bool recoverClaim(const TonConnectClaimRecord &record);
|
|
void submitStored(const TonConnectClaimRecord &record, QByteArray body);
|
|
void updateRecoveryPolling(bool wanted);
|
|
|
|
const not_null<Main::Session*> _session;
|
|
const not_null<TonConnect*> _store;
|
|
MTP::Sender _api;
|
|
std::unique_ptr<Flow> _active;
|
|
std::vector<std::unique_ptr<Flow>> _silent;
|
|
std::vector<Entry> _waiting;
|
|
base::flat_set<MsgId> _claimedIds;
|
|
std::optional<TonConnectClaimStore> _claims;
|
|
base::flat_set<MsgId> _recoveryHeld;
|
|
rpl::lifetime _recoveryLifetime;
|
|
bool _recoveryPolling = false;
|
|
mtpRequestId _pendingRequestId = 0;
|
|
uint64 _order = 0;
|
|
bool _stopped = false;
|
|
rpl::lifetime _lifetime;
|
|
|
|
};
|
|
|
|
} // namespace Wallet
|