summary refs log tree commit diff
path: root/src/DeviceVerificationFlow.cpp
blob: 69d6ab9ccf3c41e8cabbf8eb9897de0c4cdb6761 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include "DeviceVerificationFlow.h"

#include <QTimer>

static constexpr int TIMEOUT = 2 * 60 * 1000; // 2 minutes

DeviceVerificationFlow::DeviceVerificationFlow(QObject *)
{
        timeout = new QTimer(this);
        timeout->setSingleShot(true);
        connect(timeout, &QTimer::timeout, this, [this]() {
                emit timedout();
                this->deleteLater();
        });
        timeout->start(TIMEOUT);
}

//! accepts a verification and starts the verification flow
void
DeviceVerificationFlow::acceptVerificationRequest()
{
        emit verificationRequestAccepted(rand() % 2 ? Emoji : Decimal);
}
//! cancels a verification flow
void
DeviceVerificationFlow::cancelVerification()
{
        this->deleteLater();
}
//! Completes the verification flow
void
DeviceVerificationFlow::acceptDevice()
{
        emit deviceVerified();
        this->deleteLater();
}