Added function to show different scene depending on supported features of the device

This commit is contained in:
RebornedBrain 2024-01-24 21:52:24 +03:00
parent 1e6fe92b44
commit 63eeb86bc7

View file

@ -1,4 +1,5 @@
#include "nfc_app_i.h"
#include "helpers/protocol_support/nfc_protocol_support.h"
#include <dolphin/dolphin.h>
@ -466,6 +467,15 @@ static bool nfc_is_hal_ready() {
}
}
static void nfc_show_initial_scene_for_device(NfcApp* nfc) {
NfcProtocol prot = nfc_device_get_protocol(nfc->nfc_device);
uint32_t scene = nfc_protocol_support_has_feature(
prot, NfcProtocolFeatureEmulateFull | NfcProtocolFeatureEmulateUid) ?
NfcSceneEmulate :
NfcSceneSavedMenu;
scene_manager_next_scene(nfc->scene_manager, scene);
}
int32_t nfc_app(void* p) {
if(!nfc_is_hal_ready()) return 0;
@ -485,7 +495,7 @@ int32_t nfc_app(void* p) {
furi_string_set(nfc->file_path, args);
if(nfc_load_file(nfc, nfc->file_path, false)) {
scene_manager_next_scene(nfc->scene_manager, NfcSceneEmulate);
nfc_show_initial_scene_for_device(nfc);
} else {
view_dispatcher_stop(nfc->view_dispatcher);
}