Refine card number parsing logic in GetCardInfoScript and improve node filtering in ScreenXmlParser.
This commit is contained in:
parent
43415e2599
commit
8cdd2b6ce9
@ -140,9 +140,10 @@ void GetCardInfoScript::doStart() {
|
||||
QString fullNumber = xmlScreenParser.parseFullCardNumber();
|
||||
const double cardBalance = xmlScreenParser.parseCardDetailBalance();
|
||||
const QString holder = xmlScreenParser.parseCardDetailHolder();
|
||||
const QString lastNumbers = cards[i].lastNumbers.isEmpty()
|
||||
? (fullNumber.length() >= 4 ? fullNumber.right(4).remove(' ') : "")
|
||||
: cards[i].lastNumbers;
|
||||
const QString fullNumberClean = QString(fullNumber).remove(' ');
|
||||
const QString lastNumbers = (fullNumberClean.length() >= 4)
|
||||
? fullNumberClean.right(4)
|
||||
: (cards[i].lastNumbers.isEmpty() ? QString() : cards[i].lastNumbers);
|
||||
|
||||
qDebug() << "[Dushanbe::GetCardInfo] Card" << i << ":" << fullNumber
|
||||
<< "balance:" << cardBalance << "holder:" << holder;
|
||||
|
||||
@ -252,7 +252,9 @@ QList<ScreenXmlParser::CardInfo> ScreenXmlParser::parseCards() {
|
||||
|
||||
for (const Node &node : m_nodes) {
|
||||
if (node.className != "android.widget.ImageView") continue;
|
||||
if (!node.clickable) continue;
|
||||
if (!node.contentDesc.contains("****")) continue;
|
||||
if (node.contentDesc.contains(QString::fromUtf8("Кредитная карта"))) continue;
|
||||
|
||||
QStringList lines;
|
||||
for (const QString &line : node.contentDesc.split('\n')) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user