2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 06:35:14 +00:00

Passport phone/email verification added.

This commit is contained in:
John Preston
2018-04-09 21:56:07 +04:00
parent 35dcbe0aa0
commit 4e2a109a46
16 changed files with 711 additions and 70 deletions

View File

@@ -213,7 +213,7 @@ ChangePhoneBox::EnterCode::EnterCode(QWidget*, const QString &phone, const QStri
, _hash(hash)
, _codeLength(codeLength)
, _callTimeout(callTimeout)
, _call(this, [this] { sendCall(); }, [this] { updateCall(); }) {
, _call([this] { sendCall(); }, [this] { updateCall(); }) {
}
void ChangePhoneBox::EnterCode::prepare() {

View File

@@ -76,15 +76,14 @@ void SentCodeField::fix() {
}
}
SentCodeCall::SentCodeCall(QObject *parent, base::lambda_once<void()> callCallback, base::lambda<void()> updateCallback)
: _timer(parent)
, _call(std::move(callCallback))
SentCodeCall::SentCodeCall(base::lambda_once<void()> callCallback, base::lambda<void()> updateCallback)
: _call(std::move(callCallback))
, _update(std::move(updateCallback)) {
_timer->connect(_timer, &QTimer::timeout, [this] {
_timer.setCallback([=] {
if (_status.state == State::Waiting) {
if (--_status.timeout <= 0) {
_status.state = State::Calling;
_timer->stop();
_timer.cancel();
if (_call) {
_call();
}
@@ -99,7 +98,7 @@ SentCodeCall::SentCodeCall(QObject *parent, base::lambda_once<void()> callCallba
void SentCodeCall::setStatus(const Status &status) {
_status = status;
if (_status.state == State::Waiting) {
_timer->start(1000);
_timer.callEach(1000);
}
}
@@ -130,7 +129,7 @@ void ConfirmPhoneBox::start(const QString &phone, const QString &hash) {
ConfirmPhoneBox::ConfirmPhoneBox(QWidget*, const QString &phone, const QString &hash)
: _phone(phone)
, _hash(hash)
, _call(this, [this] { sendCall(); }, [this] { update(); }) {
, _call([this] { sendCall(); }, [this] { update(); }) {
}
void ConfirmPhoneBox::sendCall() {

View File

@@ -8,6 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#pragma once
#include "boxes/abstract_box.h"
#include "base/timer.h"
#include "ui/widgets/input_fields.h"
namespace Ui {
@@ -43,7 +44,9 @@ private:
class SentCodeCall {
public:
SentCodeCall(QObject *parent, base::lambda_once<void()> callCallback, base::lambda<void()> updateCallback);
SentCodeCall(
base::lambda_once<void()> callCallback,
base::lambda<void()> updateCallback);
enum class State {
Waiting,
@@ -75,7 +78,7 @@ public:
private:
Status _status;
object_ptr<QTimer> _timer;
base::Timer _timer;
base::lambda_once<void()> _call;
base::lambda<void()> _update;