Move keyVerification messages to showOverlayBanner

This commit is contained in:
Jonathan Bennett 2025-05-30 11:14:14 -05:00
parent 749c3ca53c
commit 218f5bdbf3

View File

@ -59,7 +59,7 @@ bool KeyVerificationModule::handleReceivedProtobuf(const meshtastic_MeshPacket &
r->hash1.size == 0) { r->hash1.size == 0) {
memcpy(hash2, r->hash2.bytes, 32); memcpy(hash2, r->hash2.bytes, 32);
if (screen) if (screen)
screen->startAlert("Enter Security Number"); // TODO: replace with actual prompt in BaseUI screen->showOverlayBanner("Enter Security Number", 15000);
meshtastic_ClientNotification *cn = clientNotificationPool.allocZeroed(); meshtastic_ClientNotification *cn = clientNotificationPool.allocZeroed();
cn->level = meshtastic_LogRecord_Level_WARNING; cn->level = meshtastic_LogRecord_Level_WARNING;
@ -81,8 +81,7 @@ bool KeyVerificationModule::handleReceivedProtobuf(const meshtastic_MeshPacket &
generateVerificationCode(message + 15); generateVerificationCode(message + 15);
LOG_INFO("Hash1 matches!"); LOG_INFO("Hash1 matches!");
if (screen) { if (screen) {
screen->endAlert(); screen->showOverlayBanner(message, 15000);
screen->startAlert(message);
} }
meshtastic_ClientNotification *cn = clientNotificationPool.allocZeroed(); meshtastic_ClientNotification *cn = clientNotificationPool.allocZeroed();
cn->level = meshtastic_LogRecord_Level_WARNING; cn->level = meshtastic_LogRecord_Level_WARNING;
@ -180,7 +179,7 @@ meshtastic_MeshPacket *KeyVerificationModule::allocReply()
responsePacket->pki_encrypted = true; responsePacket->pki_encrypted = true;
if (screen) { if (screen) {
snprintf(message, 25, "Security Number \n%03u %03u", currentSecurityNumber / 1000, currentSecurityNumber % 1000); snprintf(message, 25, "Security Number \n%03u %03u", currentSecurityNumber / 1000, currentSecurityNumber % 1000);
screen->startAlert(message); screen->showOverlayBanner(message, 15000);
LOG_WARN("%s", message); LOG_WARN("%s", message);
} }
meshtastic_ClientNotification *cn = clientNotificationPool.allocZeroed(); meshtastic_ClientNotification *cn = clientNotificationPool.allocZeroed();
@ -250,8 +249,7 @@ void KeyVerificationModule::processSecurityNumber(uint32_t incomingNumber)
sprintf(message, "Verification: \n"); sprintf(message, "Verification: \n");
generateVerificationCode(message + 15); // send the toPhone packet generateVerificationCode(message + 15); // send the toPhone packet
if (screen) { if (screen) {
screen->endAlert(); screen->showOverlayBanner(message, 15000);
screen->startAlert(message);
} }
meshtastic_ClientNotification *cn = clientNotificationPool.allocZeroed(); meshtastic_ClientNotification *cn = clientNotificationPool.allocZeroed();
cn->level = meshtastic_LogRecord_Level_WARNING; cn->level = meshtastic_LogRecord_Level_WARNING;
@ -287,8 +285,6 @@ void KeyVerificationModule::resetToIdle()
currentSecurityNumber = 0; currentSecurityNumber = 0;
currentRemoteNode = 0; currentRemoteNode = 0;
currentState = KEY_VERIFICATION_IDLE; currentState = KEY_VERIFICATION_IDLE;
if (screen)
screen->endAlert();
} }
void KeyVerificationModule::generateVerificationCode(char *readableCode) void KeyVerificationModule::generateVerificationCode(char *readableCode)