mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-23 05:24:46 -07:00
merge all nfc app changes
by WillyJL
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
#include "nfc_app_i.h"
|
||||
#include "api/nfc_app_api_interface.h"
|
||||
#include "helpers/protocol_support/nfc_protocol_support.h"
|
||||
|
||||
#include <dolphin/dolphin.h>
|
||||
#include <loader/firmware_api/firmware_api.h>
|
||||
|
||||
bool nfc_custom_event_callback(void* context, uint32_t event) {
|
||||
furi_assert(context);
|
||||
@@ -49,12 +51,16 @@ NfcApp* nfc_app_alloc(void) {
|
||||
|
||||
instance->nfc = nfc_alloc();
|
||||
|
||||
instance->api_resolver = composite_api_resolver_alloc();
|
||||
composite_api_resolver_add(instance->api_resolver, firmware_api_interface);
|
||||
composite_api_resolver_add(instance->api_resolver, nfc_application_api_interface);
|
||||
|
||||
instance->detected_protocols = nfc_detected_protocols_alloc();
|
||||
instance->felica_auth = felica_auth_alloc();
|
||||
instance->mf_ul_auth = mf_ultralight_auth_alloc();
|
||||
instance->slix_unlock = slix_unlock_alloc();
|
||||
instance->mfc_key_cache = mf_classic_key_cache_alloc();
|
||||
instance->nfc_supported_cards = nfc_supported_cards_alloc();
|
||||
instance->nfc_supported_cards = nfc_supported_cards_alloc(instance->api_resolver);
|
||||
|
||||
// Nfc device
|
||||
instance->nfc_device = nfc_device_alloc();
|
||||
@@ -148,6 +154,9 @@ void nfc_app_free(NfcApp* instance) {
|
||||
slix_unlock_free(instance->slix_unlock);
|
||||
mf_classic_key_cache_free(instance->mfc_key_cache);
|
||||
nfc_supported_cards_free(instance->nfc_supported_cards);
|
||||
if(instance->protocol_support) {
|
||||
nfc_protocol_support_free(instance);
|
||||
}
|
||||
|
||||
// Nfc device
|
||||
nfc_device_free(instance->nfc_device);
|
||||
@@ -415,6 +424,11 @@ bool nfc_load_from_file_select(NfcApp* instance) {
|
||||
if(!dialog_file_browser_show(
|
||||
instance->dialogs, instance->file_path, instance->file_path, &browser_options))
|
||||
break;
|
||||
|
||||
nfc_show_loading_popup(instance, true);
|
||||
nfc_supported_cards_load_cache(instance->nfc_supported_cards);
|
||||
nfc_show_loading_popup(instance, false);
|
||||
|
||||
success = nfc_load_file(instance, instance->file_path, true);
|
||||
} while(!success);
|
||||
|
||||
@@ -464,7 +478,7 @@ static bool nfc_is_hal_ready(void) {
|
||||
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) ?
|
||||
prot, nfc, NfcProtocolFeatureEmulateFull | NfcProtocolFeatureEmulateUid) ?
|
||||
NfcSceneEmulate :
|
||||
NfcSceneSavedMenu;
|
||||
// Load plugins (parsers) in case if we are in the saved menu
|
||||
@@ -523,11 +537,6 @@ 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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user