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.
73 lines
2.2 KiB
C++
73 lines
2.2 KiB
C++
#pragma once
|
||
|
||
#include <QObject>
|
||
#include <QDomElement>
|
||
#include "android/xml/Node.h"
|
||
#include "db/AccountInfo.h"
|
||
|
||
namespace Black {
|
||
|
||
class ScreenXmlParser final : public QObject {
|
||
Q_OBJECT
|
||
|
||
public:
|
||
explicit ScreenXmlParser(QObject *parent = nullptr);
|
||
|
||
~ScreenXmlParser() override;
|
||
|
||
void parseAndSaveXml(const QString &xml);
|
||
|
||
const QList<Node> &findAllNodes() const;
|
||
|
||
Node findTextNode(const QString &text);
|
||
|
||
Node findNodeByContentDesc(const QString &contentDesc);
|
||
|
||
Node findNodeByContentDesc(const QString &contentDesc, bool contains);
|
||
|
||
Node findButtonNode(const QString &text, bool contains);
|
||
|
||
Node findFirstEditText();
|
||
|
||
// Определяет экран ввода PIN-кода по content-desc "¿Olvidaste tu PIN?"
|
||
bool isPinCodeScreen();
|
||
|
||
// Находит EditText с password=true для ввода PIN
|
||
Node findPinCodeEditText();
|
||
|
||
bool isHomeScreen();
|
||
|
||
// Определяет боковое меню по content-desc "Tu Información" + "Cerrar sesión"
|
||
bool isSideMenu();
|
||
|
||
// Находит кнопку "¡Hola!" (аватар с именем) на домашнем экране
|
||
Node findHolaButton();
|
||
|
||
// Парсит имя пользователя из content-desc "¡Hola!\nимя\nинициалы"
|
||
QString parseUserNameFromHomeScreen();
|
||
|
||
// Парсит баланс с домашнего экрана (content-desc "$0,00" после "Saldo disponible")
|
||
double parseBalanceFromHomeScreen();
|
||
|
||
// Определяет страницу профиля "Tu información"
|
||
bool isProfilePage();
|
||
|
||
// Парсит данные профиля по hint полей
|
||
QString parseProfileNombre(); // hint="Nombre"
|
||
QString parseProfileApellido(); // hint="Apellido"
|
||
QString parseProfileEmail(); // hint="E-mail"
|
||
QString parseProfilePhone(); // hint="Teléfono celular"
|
||
|
||
// Определяет экран CVU (окно поверх домашнего экрана)
|
||
bool isCVUScreen();
|
||
|
||
// Парсит номер CVU (22-значный номер после content-desc="CVU")
|
||
QString parseCVUNumber();
|
||
|
||
private:
|
||
QList<Node> m_nodes;
|
||
QDomElement m_xml;
|
||
};
|
||
|
||
} // namespace Black
|