Просмотр исходного кода

new file extension check + error messages

- I changed the extension check to check for a value of either 0 or 10 as these are the 2 values that are returned on correct extensions
- Improved error messages to explain more when they appear
acegoal07 1 год назад
Родитель
Сommit
981c7de774
2 измененных файлов с 5 добавлено и 4 удалено
  1. 1 1
      application.fam
  2. 4 3
      scenes/nfc_playlist_scene_emulation.c

+ 1 - 1
application.fam

@@ -8,7 +8,7 @@ App(
     fap_category="NFC",
     fap_category="NFC",
     fap_author="@acegoal07",
     fap_author="@acegoal07",
     fap_weburl="https://github.com/acegoal07/FlipperZero_NFC_Playlist/tree/main",
     fap_weburl="https://github.com/acegoal07/FlipperZero_NFC_Playlist/tree/main",
-    fap_version="2.3",
+    fap_version="2.4",
     fap_icon_assets="assets",
     fap_icon_assets="assets",
     fap_icon="assets/Playlist_10px.png",
     fap_icon="assets/Playlist_10px.png",
     fap_private_libs=[
     fap_private_libs=[

+ 4 - 3
scenes/nfc_playlist_scene_emulation.c

@@ -67,12 +67,13 @@ int32_t nfc_playlist_emulation_task(void* context) {
 
 
          int time_counter_ms = (options_emulate_timeout[nfc_playlist->settings.emulate_timeout]*1000);
          int time_counter_ms = (options_emulate_timeout[nfc_playlist->settings.emulate_timeout]*1000);
 
 
-         if(!strcasestr(furi_string_get_cstr(tmp_file_ext), ".nfc")) {
+         int ext_check = furi_string_cmpi_str(tmp_file_ext, ".nfc");
+         if(ext_check != 0 && ext_check != 10) {
             if(nfc_playlist->settings.skip_error) {
             if(nfc_playlist->settings.skip_error) {
                skip_delay = true;
                skip_delay = true;
                continue;
                continue;
             }
             }
-            furi_string_printf(tmp_header_str, "ERROR invalid file:\n%s", furi_string_get_cstr(tmp_file_name));
+            furi_string_printf(tmp_header_str, "ERROR invalid file type:\n%s", furi_string_get_cstr(tmp_file_name));
             popup_set_header(nfc_playlist->popup, furi_string_get_cstr(tmp_header_str), 64, 10, AlignCenter, AlignTop);
             popup_set_header(nfc_playlist->popup, furi_string_get_cstr(tmp_header_str), 64, 10, AlignCenter, AlignTop);
             start_blink(nfc_playlist, NfcPlaylistLedState_Error);
             start_blink(nfc_playlist, NfcPlaylistLedState_Error);
             while(time_counter_ms > 0 && EmulationState == NfcPlaylistEmulationState_Emulating) {
             while(time_counter_ms > 0 && EmulationState == NfcPlaylistEmulationState_Emulating) {
@@ -86,7 +87,7 @@ int32_t nfc_playlist_emulation_task(void* context) {
                skip_delay = true;
                skip_delay = true;
                continue;
                continue;
             }
             }
-            furi_string_printf(tmp_header_str, "ERROR not found:\n%s", furi_string_get_cstr(tmp_file_name));
+            furi_string_printf(tmp_header_str, "ERROR file not found:\n%s", furi_string_get_cstr(tmp_file_name));
             popup_set_header(nfc_playlist->popup, furi_string_get_cstr(tmp_header_str), 64, 10, AlignCenter, AlignTop);
             popup_set_header(nfc_playlist->popup, furi_string_get_cstr(tmp_header_str), 64, 10, AlignCenter, AlignTop);
             start_blink(nfc_playlist, NfcPlaylistLedState_Error);
             start_blink(nfc_playlist, NfcPlaylistLedState_Error);
             while(time_counter_ms > 0 && EmulationState == NfcPlaylistEmulationState_Emulating) {
             while(time_counter_ms > 0 && EmulationState == NfcPlaylistEmulationState_Emulating) {