load plugins only when needed, show loading anim

This commit is contained in:
MX 2024-06-14 16:49:09 +03:00
parent f0a56af7fa
commit f6e9dcbc01
No known key found for this signature in database
GPG key ID: 7CCC66B7DBDD1C83
2 changed files with 13 additions and 2 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); instance->poller = nfc_poller_alloc(instance->nfc, protocol);
view_dispatcher_switch_to_view(instance->view_dispatcher, NfcViewPopup); 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 // Start poller with the appropriate callback
nfc_protocol_support[protocol]->scene_read.on_enter(instance); nfc_protocol_support[protocol]->scene_read.on_enter(instance);

View file

@ -345,7 +345,7 @@ bool nfc_load_file(NfcApp* instance, FuriString* path, bool show_dialog) {
furi_assert(path); furi_assert(path);
bool result = false; bool result = false;
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
@ -486,6 +486,12 @@ static void nfc_show_initial_scene_for_device(NfcApp* nfc) {
prot, NfcProtocolFeatureEmulateFull | NfcProtocolFeatureEmulateUid) ? prot, NfcProtocolFeatureEmulateFull | NfcProtocolFeatureEmulateUid) ?
NfcSceneEmulate : NfcSceneEmulate :
NfcSceneSavedMenu; 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); scene_manager_next_scene(nfc->scene_manager, scene);
} }
@ -516,6 +522,11 @@ int32_t nfc_app(void* p) {
} else { } else {
view_dispatcher_attach_to_gui( view_dispatcher_attach_to_gui(
nfc->view_dispatcher, nfc->gui, ViewDispatcherTypeFullscreen); 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); scene_manager_next_scene(nfc->scene_manager, NfcSceneStart);
} }