Merge branch 'nfcfast' into dev

This commit is contained in:
MX
2024-06-14 18:30:41 +03:00
4 changed files with 19 additions and 10 deletions

View File

@@ -155,7 +155,7 @@ static void nfc_protocol_support_scene_read_on_enter(NfcApp* instance) {
instance->poller = nfc_poller_alloc(instance->nfc, protocol);
view_dispatcher_switch_to_view(instance->view_dispatcher, NfcViewPopup);
nfc_supported_cards_load_cache(instance->nfc_supported_cards);
//nfc_supported_cards_load_cache(instance->nfc_supported_cards);
// Start poller with the appropriate callback
nfc_protocol_support[protocol]->scene_read.on_enter(instance);
@@ -719,7 +719,7 @@ static bool nfc_protocol_support_scene_rpc_on_event(NfcApp* instance, SceneManag
if(event.event == NfcCustomEventRpcLoadFile) {
bool success = false;
if(instance->rpc_state == NfcRpcStateIdle) {
if(nfc_load_file(instance, instance->file_path, false, false)) {
if(nfc_load_file(instance, instance->file_path, false)) {
nfc_protocol_support_scene_rpc_setup_ui_and_emulate(instance);
success = true;
}

View File

@@ -340,14 +340,12 @@ bool nfc_save(NfcApp* instance) {
return nfc_save_internal(instance, NFC_APP_EXTENSION);
}
bool nfc_load_file(NfcApp* instance, FuriString* path, bool show_dialog, bool load_plugins) {
bool nfc_load_file(NfcApp* instance, FuriString* path, bool show_dialog) {
furi_assert(instance);
furi_assert(path);
bool result = false;
if(load_plugins) {
nfc_supported_cards_load_cache(instance->nfc_supported_cards);
}
//nfc_supported_cards_load_cache(instance->nfc_supported_cards);
FuriString* load_path = furi_string_alloc();
if(nfc_has_shadow_file_internal(instance, path)) { //-V1051
@@ -416,7 +414,7 @@ bool nfc_load_from_file_select(NfcApp* instance) {
if(!dialog_file_browser_show(
instance->dialogs, instance->file_path, instance->file_path, &browser_options))
break;
success = nfc_load_file(instance, instance->file_path, true, true);
success = nfc_load_file(instance, instance->file_path, true);
} while(!success);
return success;
@@ -488,6 +486,12 @@ static void nfc_show_initial_scene_for_device(NfcApp* nfc) {
prot, NfcProtocolFeatureEmulateFull | NfcProtocolFeatureEmulateUid) ?
NfcSceneEmulate :
NfcSceneSavedMenu;
// Load plugins (parsers) in case if we are in the saved menu
if(scene == NfcSceneSavedMenu) {
nfc_show_loading_popup(nfc, true);
nfc_supported_cards_load_cache(nfc->nfc_supported_cards);
nfc_show_loading_popup(nfc, false);
}
scene_manager_next_scene(nfc->scene_manager, scene);
}
@@ -509,7 +513,7 @@ int32_t nfc_app(void* p) {
nfc->view_dispatcher, nfc->gui, ViewDispatcherTypeFullscreen);
furi_string_set(nfc->file_path, args);
if(nfc_load_file(nfc, nfc->file_path, false, false)) {
if(nfc_load_file(nfc, nfc->file_path, false)) {
nfc_show_initial_scene_for_device(nfc);
} else {
view_dispatcher_stop(nfc->view_dispatcher);
@@ -518,6 +522,11 @@ int32_t nfc_app(void* p) {
} else {
view_dispatcher_attach_to_gui(
nfc->view_dispatcher, nfc->gui, ViewDispatcherTypeFullscreen);
// Load plugins (parsers) one time in case if we running app normally
nfc_show_loading_popup(nfc, true);
nfc_supported_cards_load_cache(nfc->nfc_supported_cards);
nfc_show_loading_popup(nfc, false);
// Switch to the initial scene
scene_manager_next_scene(nfc->scene_manager, NfcSceneStart);
}

View File

@@ -188,7 +188,7 @@ bool nfc_delete(NfcApp* instance);
bool nfc_load_from_file_select(NfcApp* instance);
bool nfc_load_file(NfcApp* instance, FuriString* path, bool show_dialog, bool load_plugins);
bool nfc_load_file(NfcApp* instance, FuriString* path, bool show_dialog);
bool nfc_save_file(NfcApp* instance, FuriString* path);

View File

@@ -25,7 +25,7 @@ bool nfc_scene_restore_original_on_event(void* context, SceneManagerEvent event)
if(event.type == SceneManagerEventTypeCustom) {
if(event.event == NfcCustomEventViewExit) {
if(nfc_load_file(nfc, nfc->file_path, false, false)) {
if(nfc_load_file(nfc, nfc->file_path, false)) {
consumed = scene_manager_search_and_switch_to_previous_scene(
nfc->scene_manager, NfcSceneSavedMenu);
} else {