[FL-2674] Show error popup when NFC chip is not init/disconnected (#1722)
* Show error popup when NFC chip is not init/disconnected * Move to dialogs for the error message * Fix a memory leak and wrap the hal check * F7: update api_symbols.csv, add furi_hal_nfc_is_init Co-authored-by: SG <who.just.the.doctor@gmail.com> Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
@@ -231,7 +231,30 @@ void nfc_show_loading_popup(void* context, bool show) {
|
||||
}
|
||||
}
|
||||
|
||||
static bool nfc_is_hal_ready() {
|
||||
if(!furi_hal_nfc_is_init()) {
|
||||
// No connection to the chip, show an error screen
|
||||
DialogsApp* dialogs = furi_record_open(RECORD_DIALOGS);
|
||||
DialogMessage* message = dialog_message_alloc();
|
||||
dialog_message_set_text(
|
||||
message,
|
||||
"Error!\nNFC chip failed to start\n\n\nSend a photo of this to:\nsupport@flipperzero.one",
|
||||
0,
|
||||
0,
|
||||
AlignLeft,
|
||||
AlignTop);
|
||||
dialog_message_show(dialogs, message);
|
||||
dialog_message_free(message);
|
||||
furi_record_close(RECORD_DIALOGS);
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
int32_t nfc_app(void* p) {
|
||||
if(!nfc_is_hal_ready()) return 0;
|
||||
|
||||
Nfc* nfc = nfc_alloc();
|
||||
char* args = p;
|
||||
|
||||
|
@@ -33,6 +33,8 @@
|
||||
#include <nfc/scenes/nfc_scene.h>
|
||||
#include <nfc/helpers/nfc_custom_event.h>
|
||||
|
||||
#include <dialogs/dialogs.h>
|
||||
|
||||
#include "rpc/rpc_app.h"
|
||||
|
||||
#define NFC_TEXT_STORE_SIZE 128
|
||||
|
Reference in New Issue
Block a user