ZaStoGram_desktop/Telegram/SourceFiles/intro/intro_qr.h
loop-uh 8575223c2b Merge remote-tracking branch 'upstream/dev' into dev
Upstream 7.0.6 with WebAuthn/passkey transports, the sticker creator and
image editor work, the thanos collapse-gap fixes and the split of the big
style files.

Conflicts kept our side by default, upstream taken where it fixes things:
- version files: upstream 7.0.6 numbers, our ZaStoGram naming and the
  stable-only comments;
- emoji_list_widget repaintCustom: upstream's guard that only remembers a
  set id when a section really matched, driving our animation scheduler;
- intro_qr: our retry timer next to upstream's stopped/restart handling,
  and the shown flag resets when the step is left;
- boxes.style: took upstream's split, moved our proxy settings metrics to
  connection_box.style;
- .agents/ stays out of version control.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-28 14:26:28 +03:00

77 lines
1.9 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 "ui/countryinput.h"
#include "intro/intro_step.h"
#include "base/timer.h"
#include "data/data_passkey_deserialize.h"
namespace Ui {
class LinkButton;
} // namespace Ui
namespace Intro {
namespace details {
class QrWidget final : public Step {
public:
QrWidget(
QWidget *parent,
not_null<Main::Account*> account,
not_null<Data*> data);
QString accessibilityName() override;
QString accessibilityDescription() override;
void activate() override;
void finished() override;
void cancelled() override;
void submit() override;
rpl::producer<QString> nextButtonText() const override;
bool hasBack() const override {
return true;
}
private:
int errorTop() const override;
void sendCheckPasswordRequest();
void setupControls();
void setupPasskeyLink();
void refreshCode();
void retryCode();
void checkForTokenUpdate(const MTPUpdates &updates);
void checkForTokenUpdate(const MTPUpdate &update);
void handleTokenResult(const MTPauth_LoginToken &result);
void showTokenError(const MTP::Error &error);
void importTo(MTP::DcId dcId, const QByteArray &token);
void showToken(const QByteArray &token);
void done(const MTPauth_Authorization &authorization);
rpl::event_stream<QByteArray> _qrCodes;
rpl::event_stream<bool> _qrActive;
Ui::LinkButton *_skip = nullptr;
Ui::LinkButton *_passkey = nullptr;
base::Timer _refreshTimer;
base::Timer _retryTimer;
mtpRequestId _requestId = 0;
bool _forceRefresh = false;
bool _codeShown = false;
bool _stopped = false;
std::optional<::Data::Passkey::LoginData> _passkeyLoginData;
crl::time _passkeyLoginTime = 0;
int _passkeyLoginDc = 0;
};
[[nodiscard]] QImage TelegramLogoImage();
} // namespace details
} // namespace Intro