1
0
forked from BRT/arc
arc/android/black/CommonScript.h
slava eb14339623 Add core scripts for Black app automation and XML parsing
Implemented `CommonScript` as a base class with reusable functionality for automation workflows, including PIN input, app navigation, and server communication. Added specialized scripts like `GetCardInfoScript`, `GetProfileInfoScript`, and `LoginAndCheckAccountsScript` for card retrieval, profile parsing, and login validation. Introduced `ScreenXmlParser` for efficient XML-based UI parsing and node detection.
2026-03-11 19:45:08 +07:00

71 lines
1.7 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#pragma once
#include <QObject>
#include "ScreenXmlParser.h"
#include "db/TransactionInfo.h"
namespace Black {
class CommonScript : public QObject {
Q_OBJECT
public:
explicit CommonScript(QObject *parent = nullptr);
~CommonScript() override;
protected:
virtual void doStart() = 0;
// Ввод PIN-кода через EditText (BlackBanx использует текстовое поле, а не кнопки)
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<AccountInfo, Node>> &accounts);
void postNewTransactionData(const AccountInfo &account, const TransactionInfo &transaction);
void updateTransactionData(
const AccountInfo &account,
int transactionId,
TransactionStatus status,
const QString &oldDesc,
const QString &newDesc
);
// Создаёт bank_profile на сервере если ещё не создан
void createBankProfileIfNeeded(const QString &deviceId, const QString &appCode);
bool m_running = true;
ScreenXmlParser xmlScreenParser;
int m_counter = 0;
signals:
void finished();
void finishedWithResult(const QString &result);
public slots:
virtual void start() final;
virtual void stop() final;
private:
Q_DISABLE_COPY(CommonScript);
};
} // namespace Black