tdesktop/Telegram/SourceFiles/intro/intro_qr.h

66 lines
1.5 KiB
C
Raw Normal View History

2019-11-22 09:40:52 +00:00
/*
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"
2019-11-26 11:10:44 +00:00
#include "intro/intro_step.h"
2019-11-22 09:40:52 +00:00
#include "mtproto/sender.h"
#include "base/timer.h"
namespace Ui {
class PhonePartInput;
class CountryCodeInput;
class RoundButton;
class FlatLabel;
} // namespace Ui
namespace Intro {
2019-11-26 11:10:44 +00:00
namespace details {
2019-11-22 09:40:52 +00:00
2019-11-27 08:33:18 +00:00
class QrWidget final : public Step {
2019-11-22 09:40:52 +00:00
public:
QrWidget(
QWidget *parent,
not_null<Main::Account*> account,
2019-11-26 11:10:44 +00:00
not_null<Data*> data);
2019-11-22 09:40:52 +00:00
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:
2019-11-26 14:27:09 +00:00
int errorTop() const override;
2019-12-13 15:00:21 +00:00
void sendCheckPasswordRequest();
2019-11-26 11:10:44 +00:00
void setupControls();
2019-11-22 09:40:52 +00:00
void refreshCode();
void checkForTokenUpdate(const MTPUpdates &updates);
void checkForTokenUpdate(const MTPUpdate &update);
void handleTokenResult(const MTPauth_LoginToken &result);
void showTokenError(const RPCError &error);
void importTo(MTP::DcId dcId, const QByteArray &token);
void showToken(const QByteArray &token);
void done(const MTPauth_Authorization &authorization);
2019-11-27 08:02:56 +00:00
MTP::Sender _api;
2019-11-26 11:10:44 +00:00
rpl::event_stream<QByteArray> _qrCodes;
2019-11-22 09:40:52 +00:00
base::Timer _refreshTimer;
mtpRequestId _requestId = 0;
bool _forceRefresh = false;
};
2019-11-26 11:10:44 +00:00
} // namespace details
2019-11-22 09:40:52 +00:00
} // namespace Intro