mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2024-12-29 16:25:47 +03:00
make NFC emulation loading from favourites faster
This commit is contained in:
parent
c40a63ecec
commit
2cbd058dc2
@ -719,7 +719,7 @@ static bool nfc_protocol_support_scene_rpc_on_event(NfcApp* instance, SceneManag
|
|||||||
if(event.event == NfcCustomEventRpcLoadFile) {
|
if(event.event == NfcCustomEventRpcLoadFile) {
|
||||||
bool success = false;
|
bool success = false;
|
||||||
if(instance->rpc_state == NfcRpcStateIdle) {
|
if(instance->rpc_state == NfcRpcStateIdle) {
|
||||||
if(nfc_load_file(instance, instance->file_path, false)) {
|
if(nfc_load_file(instance, instance->file_path, false, false)) {
|
||||||
nfc_protocol_support_scene_rpc_setup_ui_and_emulate(instance);
|
nfc_protocol_support_scene_rpc_setup_ui_and_emulate(instance);
|
||||||
success = true;
|
success = true;
|
||||||
}
|
}
|
||||||
|
@ -340,12 +340,14 @@ bool nfc_save(NfcApp* instance) {
|
|||||||
return nfc_save_internal(instance, NFC_APP_EXTENSION);
|
return nfc_save_internal(instance, NFC_APP_EXTENSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool nfc_load_file(NfcApp* instance, FuriString* path, bool show_dialog) {
|
bool nfc_load_file(NfcApp* instance, FuriString* path, bool show_dialog, bool load_plugins) {
|
||||||
furi_assert(instance);
|
furi_assert(instance);
|
||||||
furi_assert(path);
|
furi_assert(path);
|
||||||
bool result = false;
|
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();
|
FuriString* load_path = furi_string_alloc();
|
||||||
if(nfc_has_shadow_file_internal(instance, path)) { //-V1051
|
if(nfc_has_shadow_file_internal(instance, path)) { //-V1051
|
||||||
@ -414,7 +416,7 @@ bool nfc_load_from_file_select(NfcApp* instance) {
|
|||||||
if(!dialog_file_browser_show(
|
if(!dialog_file_browser_show(
|
||||||
instance->dialogs, instance->file_path, instance->file_path, &browser_options))
|
instance->dialogs, instance->file_path, instance->file_path, &browser_options))
|
||||||
break;
|
break;
|
||||||
success = nfc_load_file(instance, instance->file_path, true);
|
success = nfc_load_file(instance, instance->file_path, true, true);
|
||||||
} while(!success);
|
} while(!success);
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
@ -507,7 +509,7 @@ int32_t nfc_app(void* p) {
|
|||||||
nfc->view_dispatcher, nfc->gui, ViewDispatcherTypeFullscreen);
|
nfc->view_dispatcher, nfc->gui, ViewDispatcherTypeFullscreen);
|
||||||
|
|
||||||
furi_string_set(nfc->file_path, args);
|
furi_string_set(nfc->file_path, args);
|
||||||
if(nfc_load_file(nfc, nfc->file_path, false)) {
|
if(nfc_load_file(nfc, nfc->file_path, false, false)) {
|
||||||
nfc_show_initial_scene_for_device(nfc);
|
nfc_show_initial_scene_for_device(nfc);
|
||||||
} else {
|
} else {
|
||||||
view_dispatcher_stop(nfc->view_dispatcher);
|
view_dispatcher_stop(nfc->view_dispatcher);
|
||||||
|
@ -188,7 +188,7 @@ bool nfc_delete(NfcApp* instance);
|
|||||||
|
|
||||||
bool nfc_load_from_file_select(NfcApp* instance);
|
bool nfc_load_from_file_select(NfcApp* instance);
|
||||||
|
|
||||||
bool nfc_load_file(NfcApp* instance, FuriString* path, bool show_dialog);
|
bool nfc_load_file(NfcApp* instance, FuriString* path, bool show_dialog, bool load_plugins);
|
||||||
|
|
||||||
bool nfc_save_file(NfcApp* instance, FuriString* path);
|
bool nfc_save_file(NfcApp* instance, FuriString* path);
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ bool nfc_scene_restore_original_on_event(void* context, SceneManagerEvent event)
|
|||||||
|
|
||||||
if(event.type == SceneManagerEventTypeCustom) {
|
if(event.type == SceneManagerEventTypeCustom) {
|
||||||
if(event.event == NfcCustomEventViewExit) {
|
if(event.event == NfcCustomEventViewExit) {
|
||||||
if(nfc_load_file(nfc, nfc->file_path, false)) {
|
if(nfc_load_file(nfc, nfc->file_path, false, false)) {
|
||||||
consumed = scene_manager_search_and_switch_to_previous_scene(
|
consumed = scene_manager_search_and_switch_to_previous_scene(
|
||||||
nfc->scene_manager, NfcSceneSavedMenu);
|
nfc->scene_manager, NfcSceneSavedMenu);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user