- 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.
110 lines
3.3 KiB
C++
110 lines
3.3 KiB
C++
#pragma once
|
|
|
|
#include <QObject>
|
|
#include <QDomElement>
|
|
#include "android/xml/Node.h"
|
|
#include "db/MaterialInfo.h"
|
|
#include "db/TransactionInfo.h"
|
|
|
|
namespace Ozon {
|
|
|
|
class ScreenXmlParser final : public QObject {
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit ScreenXmlParser(QObject *parent = nullptr);
|
|
|
|
~ScreenXmlParser() override;
|
|
|
|
Node tryToFindBannerOrDialog(int width, int height);
|
|
|
|
Node tryToFindSecurityBanner();
|
|
|
|
Node tryToFindSelectBottomSheet();
|
|
|
|
Node findTextNode(const QString &text);
|
|
|
|
Node findTextNode(const QString &text, int x1, int y1, int x2, int y2);
|
|
|
|
Node findFirstEditText();
|
|
|
|
Node findEditTextByHint(const QString &hintPrefix);
|
|
|
|
Node findButtonNode(const QString &text, bool contains);
|
|
|
|
QList<Node> findAllButtons();
|
|
|
|
const QList<Node> &findAllNodes() const;
|
|
|
|
Node findNodeByContentDesc(const QString &contentDesc);
|
|
|
|
bool isHomeScreen();
|
|
|
|
Node tryToFindAdBanner();
|
|
|
|
Node tryToFindGooglePlayBanner(int screenWidth, int screenHeight);
|
|
|
|
// Находит кнопку "ЗАПРЕТИТЬ" в системном диалоге запроса разрешения Android
|
|
// (com.google.android.permissioncontroller). Возвращает пустой Node если диалог не виден.
|
|
Node tryToFindSystemPermissionDenyButton();
|
|
|
|
// Returns a Button node whose text is exactly 4 digits (card last numbers)
|
|
Node findCardButtonOnHomeScreen();
|
|
|
|
// Finds a card button whose text ends with the given last 4 digits
|
|
Node findCardButtonByLastNumbers(const QString &lastNumbers);
|
|
|
|
// Returns all cards visible on the home screen as MaterialInfo stubs
|
|
// (lastNumbers, description, amount filled; id=-1, cardNumber empty)
|
|
QList<MaterialInfo> parseCardsOnHomeScreen();
|
|
|
|
bool isProfileScreen();
|
|
|
|
Node findUserNameOnHomeScreen(int screenHeight);
|
|
|
|
QString parseProfileFullName();
|
|
|
|
QString parseProfilePhone();
|
|
|
|
QList<Node> tryToFindPinCode(const QString &pinCode, const QString &title);
|
|
|
|
QList<Node> getLast2DaysTransactions();
|
|
|
|
void parseAndSaveXml(const QString &xml);
|
|
|
|
TransactionInfo parseTransactionInfoHistory(int screenWidth, int screenHeight);
|
|
TransactionInfo parseTransactionInfo(int screenWidth, int screenHeight);
|
|
|
|
QList<TransactionInfo> parseTodayAndYesterdayReportHistory();
|
|
|
|
QList<TransactionInfo> parseTodayAndYesterdayHistory();
|
|
|
|
|
|
QList<QPair<MaterialInfo, Node> > parseAccountsInfo();
|
|
|
|
// Finds a TextView with full card number (format "XXXX XXXX XXXX XXXX")
|
|
QString findFullCardNumber();
|
|
|
|
bool isTransactionListScreen();
|
|
|
|
// Возвращает кнопки транзакций на экране "Операции" (до maxCount штук)
|
|
QList<Node> findTransactionButtons(int maxCount);
|
|
|
|
// Парсит имя и сумму из текста кнопки: "NAME + 150 ₽ CATEGORY"
|
|
TransactionInfo parseTransactionButtonText(const QString &text);
|
|
|
|
// Парсит детали транзакции: дату, имя отправителя, телефон
|
|
TransactionInfo parseTransactionDetail();
|
|
|
|
void test();
|
|
|
|
[[nodiscard]] const QList<Node> &getNodes() const { return m_nodes; }
|
|
|
|
private:
|
|
QList<Node> m_nodes;
|
|
QDomElement m_xml;
|
|
|
|
QList<Node> findPinCodeNodes(const QString &pinCode);
|
|
};
|
|
|
|
} // namespace Ozon
|