- Integrate banner dismissal in retry loops for XML parsing in payment and profile scripts. - Add detection logic for permission deny buttons and update banner handling in `ScreenXmlParser`. - Ensure reliable operation during input field detection, transactions fetching, and confirmation screens.
79 lines
2.0 KiB
C++
79 lines
2.0 KiB
C++
#pragma once
|
||
|
||
#include <QObject>
|
||
#include "ScreenXmlParser.h"
|
||
#include "db/TransactionInfo.h"
|
||
|
||
namespace Dushanbe {
|
||
|
||
class CommonScript : public QObject {
|
||
Q_OBJECT
|
||
|
||
public:
|
||
explicit CommonScript(QObject *parent = nullptr);
|
||
|
||
~CommonScript() override;
|
||
|
||
protected:
|
||
virtual void doStart() = 0;
|
||
|
||
bool inputPinCode(const QString &deviceId, const QString &pinCode);
|
||
|
||
bool runAppAndGoToHomeScreen(
|
||
const QString &deviceId,
|
||
const QString &packageName,
|
||
const QString &pinCode,
|
||
int width,
|
||
int height
|
||
);
|
||
|
||
Node swipeToButton(
|
||
const QString &deviceId,
|
||
const QString &text,
|
||
int &counter, int width, int height
|
||
);
|
||
|
||
void postAccountsData(const QList<QPair<MaterialInfo, Node>> &accounts);
|
||
|
||
void postNewTransactionData(const MaterialInfo &account, const TransactionInfo &transaction);
|
||
|
||
void updateTransactionData(
|
||
const MaterialInfo &account,
|
||
int transactionId,
|
||
TransactionStatus status,
|
||
const QString &oldDesc,
|
||
const QString &newDesc
|
||
);
|
||
|
||
void createBankProfileIfNeeded(const QString &deviceId, const QString &appCode, double parsedBalance = -1.0);
|
||
|
||
// Если виден баннер Google Play "Доступно обновление" — закрывает его и перепарсивает XML.
|
||
// Безопасно вызывать на любом экране; возвращает true если баннер был закрыт.
|
||
bool closeGooglePlayBannerIfVisible(
|
||
const QString &deviceId, int width, int height
|
||
);
|
||
|
||
bool m_running = true;
|
||
ScreenXmlParser xmlScreenParser;
|
||
int m_counter = 0;
|
||
|
||
QByteArray m_resultScreenshot;
|
||
|
||
signals:
|
||
void finished();
|
||
|
||
void finishedWithResult(const QString &result);
|
||
|
||
void screenshotReady(const QByteArray &screenshot);
|
||
|
||
public slots:
|
||
virtual void start() final;
|
||
|
||
virtual void stop() final;
|
||
|
||
private:
|
||
Q_DISABLE_COPY(CommonScript);
|
||
};
|
||
|
||
} // namespace Dushanbe
|