mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-23 05:24:46 -07:00
added sfw mode back to nfc
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#include "../nfc_i.h"
|
||||
#include "../../../settings/desktop_settings/desktop_settings_app.h"
|
||||
|
||||
void nfc_scene_delete_success_popup_callback(void* context) {
|
||||
Nfc* nfc = context;
|
||||
@@ -7,16 +8,24 @@ void nfc_scene_delete_success_popup_callback(void* context) {
|
||||
|
||||
void nfc_scene_delete_success_on_enter(void* context) {
|
||||
Nfc* nfc = context;
|
||||
DesktopSettings* settings = malloc(sizeof(DesktopSettings));
|
||||
DESKTOP_SETTINGS_LOAD(settings);
|
||||
|
||||
// Setup view
|
||||
Popup* popup = nfc->popup;
|
||||
popup_set_icon(popup, 0, 2, &I_DolphinMafia_115x62);
|
||||
if (settings->sfw_mode) {
|
||||
popup_set_icon(popup, 0, 2, &I_DolphinMafia_115x62_sfw);
|
||||
}
|
||||
else {
|
||||
popup_set_icon(popup, 0, 2, &I_DolphinMafia_115x62);
|
||||
}
|
||||
popup_set_header(popup, "Deleted", 83, 19, AlignLeft, AlignBottom);
|
||||
popup_set_timeout(popup, 1500);
|
||||
popup_set_context(popup, nfc);
|
||||
popup_set_callback(popup, nfc_scene_delete_success_popup_callback);
|
||||
popup_enable_timeout(popup);
|
||||
view_dispatcher_switch_to_view(nfc->view_dispatcher, NfcViewPopup);
|
||||
free(settings);
|
||||
}
|
||||
|
||||
bool nfc_scene_delete_success_on_event(void* context, SceneManagerEvent event) {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "../nfc_i.h"
|
||||
#include "../../../settings/desktop_settings/desktop_settings_app.h"
|
||||
|
||||
#define NFC_SCENE_EMULATE_UID_LOG_SIZE_MAX (200)
|
||||
|
||||
@@ -36,8 +37,15 @@ static void nfc_scene_emulate_uid_widget_config(Nfc* nfc, bool data_received) {
|
||||
widget_reset(widget);
|
||||
FuriString* info_str;
|
||||
info_str = furi_string_alloc();
|
||||
DesktopSettings* settings = malloc(sizeof(DesktopSettings));
|
||||
DESKTOP_SETTINGS_LOAD(settings);
|
||||
|
||||
widget_add_icon_element(widget, 0, 3, &I_NFC_dolphin_emulation_47x61);
|
||||
if (settings->sfw_mode) {
|
||||
widget_add_icon_element(widget, 0, 3, &I_NFC_dolphin_emulation_47x61_sfw);
|
||||
}
|
||||
else {
|
||||
widget_add_icon_element(widget, 0, 3, &I_NFC_dolphin_emulation_47x61);
|
||||
}
|
||||
widget_add_string_element(widget, 57, 13, AlignLeft, AlignTop, FontPrimary, "Emulating UID");
|
||||
if(strcmp(nfc->dev->dev_name, "") != 0) {
|
||||
furi_string_printf(info_str, "%s", nfc->dev->dev_name);
|
||||
@@ -54,6 +62,7 @@ static void nfc_scene_emulate_uid_widget_config(Nfc* nfc, bool data_received) {
|
||||
widget_add_button_element(
|
||||
widget, GuiButtonTypeCenter, "Log", nfc_scene_emulate_uid_widget_callback, nfc);
|
||||
}
|
||||
free(settings);
|
||||
}
|
||||
|
||||
void nfc_scene_emulate_uid_on_enter(void* context) {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "../nfc_i.h"
|
||||
#include "../../../settings/desktop_settings/desktop_settings_app.h"
|
||||
|
||||
#define NFC_MF_CLASSIC_DATA_NOT_CHANGED (0UL)
|
||||
#define NFC_MF_CLASSIC_DATA_CHANGED (1UL)
|
||||
@@ -14,6 +15,8 @@ bool nfc_mf_classic_emulate_worker_callback(NfcWorkerEvent event, void* context)
|
||||
|
||||
void nfc_scene_mf_classic_emulate_on_enter(void* context) {
|
||||
Nfc* nfc = context;
|
||||
DesktopSettings* settings = malloc(sizeof(DesktopSettings));
|
||||
DESKTOP_SETTINGS_LOAD(settings);
|
||||
|
||||
// Setup view
|
||||
Popup* popup = nfc->popup;
|
||||
@@ -23,7 +26,12 @@ void nfc_scene_mf_classic_emulate_on_enter(void* context) {
|
||||
} else {
|
||||
nfc_text_store_set(nfc, "MIFARE\nClassic");
|
||||
}
|
||||
popup_set_icon(popup, 0, 3, &I_NFC_dolphin_emulation_47x61);
|
||||
if (settings->sfw_mode) {
|
||||
popup_set_icon(popup, 0, 3, &I_NFC_dolphin_emulation_47x61_sfw);
|
||||
}
|
||||
else {
|
||||
popup_set_icon(popup, 0, 3, &I_NFC_dolphin_emulation_47x61);
|
||||
}
|
||||
popup_set_text(popup, nfc->text_store, 90, 28, AlignCenter, AlignTop);
|
||||
|
||||
// Setup and start worker
|
||||
@@ -35,6 +43,7 @@ void nfc_scene_mf_classic_emulate_on_enter(void* context) {
|
||||
nfc_mf_classic_emulate_worker_callback,
|
||||
nfc);
|
||||
nfc_blink_emulate_start(nfc);
|
||||
free(settings);
|
||||
}
|
||||
|
||||
bool nfc_scene_mf_classic_emulate_on_event(void* context, SceneManagerEvent event) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "../nfc_i.h"
|
||||
#include <dolphin/dolphin.h>
|
||||
#include "../../../settings/desktop_settings/desktop_settings_app.h"
|
||||
|
||||
void nfc_scene_mf_classic_update_success_popup_callback(void* context) {
|
||||
Nfc* nfc = context;
|
||||
@@ -9,11 +10,18 @@ void nfc_scene_mf_classic_update_success_popup_callback(void* context) {
|
||||
void nfc_scene_mf_classic_update_success_on_enter(void* context) {
|
||||
Nfc* nfc = context;
|
||||
DOLPHIN_DEED(DolphinDeedNfcSave);
|
||||
DesktopSettings* settings = malloc(sizeof(DesktopSettings));
|
||||
DESKTOP_SETTINGS_LOAD(settings);
|
||||
|
||||
notification_message(nfc->notifications, &sequence_success);
|
||||
|
||||
Popup* popup = nfc->popup;
|
||||
popup_set_icon(popup, 32, 5, &I_DolphinNice_96x59);
|
||||
if (settings->sfw_mode) {
|
||||
popup_set_icon(popup, 32, 5, &I_DolphinNice_96x59_sfw);
|
||||
}
|
||||
else {
|
||||
popup_set_icon(popup, 32, 5, &I_DolphinNice_96x59);
|
||||
}
|
||||
popup_set_header(popup, "Updated!", 11, 20, AlignLeft, AlignBottom);
|
||||
popup_set_timeout(popup, 1500);
|
||||
popup_set_context(popup, nfc);
|
||||
@@ -21,6 +29,7 @@ void nfc_scene_mf_classic_update_success_on_enter(void* context) {
|
||||
popup_enable_timeout(popup);
|
||||
|
||||
view_dispatcher_switch_to_view(nfc->view_dispatcher, NfcViewPopup);
|
||||
free(settings);
|
||||
}
|
||||
|
||||
bool nfc_scene_mf_classic_update_success_on_event(void* context, SceneManagerEvent event) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "../nfc_i.h"
|
||||
#include <dolphin/dolphin.h>
|
||||
#include "../../../settings/desktop_settings/desktop_settings_app.h"
|
||||
|
||||
void nfc_scene_mf_classic_write_success_popup_callback(void* context) {
|
||||
Nfc* nfc = context;
|
||||
@@ -9,11 +10,18 @@ void nfc_scene_mf_classic_write_success_popup_callback(void* context) {
|
||||
void nfc_scene_mf_classic_write_success_on_enter(void* context) {
|
||||
Nfc* nfc = context;
|
||||
DOLPHIN_DEED(DolphinDeedNfcSave);
|
||||
DesktopSettings* settings = malloc(sizeof(DesktopSettings));
|
||||
DESKTOP_SETTINGS_LOAD(settings);
|
||||
|
||||
notification_message(nfc->notifications, &sequence_success);
|
||||
|
||||
Popup* popup = nfc->popup;
|
||||
popup_set_icon(popup, 32, 5, &I_DolphinNice_96x59);
|
||||
if (settings->sfw_mode) {
|
||||
popup_set_icon(popup, 32, 5, &I_DolphinNice_96x59_sfw);
|
||||
}
|
||||
else {
|
||||
popup_set_icon(popup, 32, 5, &I_DolphinNice_96x59);
|
||||
}
|
||||
popup_set_header(popup, "Successfully\nwritten", 13, 22, AlignLeft, AlignBottom);
|
||||
popup_set_timeout(popup, 1500);
|
||||
popup_set_context(popup, nfc);
|
||||
@@ -21,6 +29,7 @@ void nfc_scene_mf_classic_write_success_on_enter(void* context) {
|
||||
popup_enable_timeout(popup);
|
||||
|
||||
view_dispatcher_switch_to_view(nfc->view_dispatcher, NfcViewPopup);
|
||||
free(settings);
|
||||
}
|
||||
|
||||
bool nfc_scene_mf_classic_write_success_on_event(void* context, SceneManagerEvent event) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "../nfc_i.h"
|
||||
#include <lib/nfc/protocols/mifare_ultralight.h>
|
||||
#include "../../../settings/desktop_settings/desktop_settings_app.h"
|
||||
|
||||
#define NFC_SCENE_MF_ULTRALIGHT_EMULATE_LOG_SIZE_MAX (200)
|
||||
|
||||
@@ -89,6 +90,8 @@ void nfc_scene_mf_ultralight_emulate_on_enter(void* context) {
|
||||
Nfc* nfc = context;
|
||||
uint32_t state =
|
||||
scene_manager_get_scene_state(nfc->scene_manager, NfcSceneMfUltralightEmulate);
|
||||
DesktopSettings* settings = malloc(sizeof(DesktopSettings));
|
||||
DESKTOP_SETTINGS_LOAD(settings);
|
||||
|
||||
// Setup Widget
|
||||
nfc_scene_mf_ultralight_emulate_widget_config(nfc, false);
|
||||
@@ -111,7 +114,12 @@ void nfc_scene_mf_ultralight_emulate_on_enter(void* context) {
|
||||
} else {
|
||||
nfc_text_store_set(nfc, "MIFARE\nNTAG");
|
||||
}
|
||||
popup_set_icon(popup, 0, 3, &I_NFC_dolphin_emulation_47x61);
|
||||
if (settings->sfw_mode) {
|
||||
popup_set_icon(popup, 0, 3, &I_NFC_dolphin_emulation_47x61_sfw);
|
||||
}
|
||||
else {
|
||||
popup_set_icon(popup, 0, 3, &I_NFC_dolphin_emulation_47x61);
|
||||
}
|
||||
popup_set_text(popup, nfc->text_store, 90, 28, AlignCenter, AlignTop);
|
||||
|
||||
// Set Widget state and view
|
||||
@@ -127,6 +135,7 @@ void nfc_scene_mf_ultralight_emulate_on_enter(void* context) {
|
||||
nfc_mf_ultralight_emulate_worker_callback,
|
||||
nfc);
|
||||
nfc_blink_emulate_start(nfc);
|
||||
free(settings);
|
||||
}
|
||||
|
||||
bool nfc_scene_mf_ultralight_emulate_on_event(void* context, SceneManagerEvent event) {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "../nfc_i.h"
|
||||
#include "../../../settings/desktop_settings/desktop_settings_app.h"
|
||||
|
||||
void nfc_scene_restore_original_popup_callback(void* context) {
|
||||
Nfc* nfc = context;
|
||||
@@ -7,16 +8,24 @@ void nfc_scene_restore_original_popup_callback(void* context) {
|
||||
|
||||
void nfc_scene_restore_original_on_enter(void* context) {
|
||||
Nfc* nfc = context;
|
||||
DesktopSettings* settings = malloc(sizeof(DesktopSettings));
|
||||
DESKTOP_SETTINGS_LOAD(settings);
|
||||
|
||||
// Setup view
|
||||
Popup* popup = nfc->popup;
|
||||
popup_set_icon(popup, 32, 5, &I_DolphinNice_96x59);
|
||||
if (settings->sfw_mode) {
|
||||
popup_set_icon(popup, 32, 5, &I_DolphinNice_96x59_sfw);
|
||||
}
|
||||
else {
|
||||
popup_set_icon(popup, 32, 5, &I_DolphinNice_96x59);
|
||||
}
|
||||
popup_set_header(popup, "Original file\nrestored", 13, 22, AlignLeft, AlignBottom);
|
||||
popup_set_timeout(popup, 1500);
|
||||
popup_set_context(popup, nfc);
|
||||
popup_set_callback(popup, nfc_scene_restore_original_popup_callback);
|
||||
popup_enable_timeout(popup);
|
||||
view_dispatcher_switch_to_view(nfc->view_dispatcher, NfcViewPopup);
|
||||
free(settings);
|
||||
}
|
||||
|
||||
bool nfc_scene_restore_original_on_event(void* context, SceneManagerEvent event) {
|
||||
|
||||
@@ -1,17 +1,26 @@
|
||||
#include "../nfc_i.h"
|
||||
#include "../../../settings/desktop_settings/desktop_settings_app.h"
|
||||
|
||||
void nfc_scene_rpc_on_enter(void* context) {
|
||||
Nfc* nfc = context;
|
||||
Popup* popup = nfc->popup;
|
||||
DesktopSettings* settings = malloc(sizeof(DesktopSettings));
|
||||
DESKTOP_SETTINGS_LOAD(settings);
|
||||
|
||||
popup_set_header(popup, "NFC", 89, 42, AlignCenter, AlignBottom);
|
||||
popup_set_text(popup, "RPC mode", 89, 44, AlignCenter, AlignTop);
|
||||
|
||||
popup_set_icon(popup, 0, 12, &I_NFC_dolphin_emulation_47x61);
|
||||
if (settings->sfw_mode) {
|
||||
popup_set_icon(popup, 0, 12, &I_NFC_dolphin_emulation_47x61_sfw);
|
||||
}
|
||||
else {
|
||||
popup_set_icon(popup, 0, 12, &I_NFC_dolphin_emulation_47x61);
|
||||
}
|
||||
|
||||
view_dispatcher_switch_to_view(nfc->view_dispatcher, NfcViewPopup);
|
||||
|
||||
notification_message(nfc->notifications, &sequence_display_backlight_on);
|
||||
free(settings);
|
||||
}
|
||||
|
||||
static bool nfc_scene_rpc_emulate_callback(NfcWorkerEvent event, void* context) {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "../nfc_i.h"
|
||||
#include "../../../settings/desktop_settings/desktop_settings_app.h"
|
||||
|
||||
void nfc_scene_save_success_popup_callback(void* context) {
|
||||
Nfc* nfc = context;
|
||||
@@ -7,16 +8,24 @@ void nfc_scene_save_success_popup_callback(void* context) {
|
||||
|
||||
void nfc_scene_save_success_on_enter(void* context) {
|
||||
Nfc* nfc = context;
|
||||
DesktopSettings* settings = malloc(sizeof(DesktopSettings));
|
||||
DESKTOP_SETTINGS_LOAD(settings);
|
||||
|
||||
// Setup view
|
||||
Popup* popup = nfc->popup;
|
||||
popup_set_icon(popup, 32, 5, &I_DolphinNice_96x59);
|
||||
if (settings->sfw_mode) {
|
||||
popup_set_icon(popup, 32, 5, &I_DolphinNice_96x59_sfw);
|
||||
}
|
||||
else {
|
||||
popup_set_icon(popup, 32, 5, &I_DolphinNice_96x59);
|
||||
}
|
||||
popup_set_header(popup, "Saved!", 13, 22, AlignLeft, AlignBottom);
|
||||
popup_set_timeout(popup, 1500);
|
||||
popup_set_context(popup, nfc);
|
||||
popup_set_callback(popup, nfc_scene_save_success_popup_callback);
|
||||
popup_enable_timeout(popup);
|
||||
view_dispatcher_switch_to_view(nfc->view_dispatcher, NfcViewPopup);
|
||||
free(settings);
|
||||
}
|
||||
|
||||
bool nfc_scene_save_success_on_event(void* context, SceneManagerEvent event) {
|
||||
|
||||
Reference in New Issue
Block a user