 79920a3522
			
		
	
	
		79920a3522
		
			
		
	
	
	
	
		
			
			* File browser module and test app * nfc: Add support for saved files in subdirectories * nfc: Use helper function to get shadow path when loading data * File browser dialog integration pt.1 * File browser dialog integration pt.2 * Gui,Dialogs: drop file select * Correct use of dynamic string_t(string_ptr) Co-authored-by: Yukai Li <yukaili.geek@gmail.com> Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
		
			
				
	
	
		
			46 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			46 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
| #include "../bad_usb_app_i.h"
 | |
| #include "furi_hal_power.h"
 | |
| #include "furi_hal_usb.h"
 | |
| 
 | |
| static bool bad_usb_file_select(BadUsbApp* bad_usb) {
 | |
|     furi_assert(bad_usb);
 | |
| 
 | |
|     // Input events and views are managed by file_browser
 | |
|     bool res = dialog_file_browser_show(
 | |
|         bad_usb->dialogs,
 | |
|         bad_usb->file_path,
 | |
|         bad_usb->file_path,
 | |
|         BAD_USB_APP_EXTENSION,
 | |
|         true,
 | |
|         &I_badusb_10px,
 | |
|         true);
 | |
| 
 | |
|     return res;
 | |
| }
 | |
| 
 | |
| void bad_usb_scene_file_select_on_enter(void* context) {
 | |
|     BadUsbApp* bad_usb = context;
 | |
| 
 | |
|     furi_hal_usb_disable();
 | |
| 
 | |
|     if(bad_usb_file_select(bad_usb)) {
 | |
|         scene_manager_next_scene(bad_usb->scene_manager, BadUsbSceneWork);
 | |
|     } else {
 | |
|         furi_hal_usb_enable();
 | |
|         //scene_manager_previous_scene(bad_usb->scene_manager);
 | |
|         view_dispatcher_stop(bad_usb->view_dispatcher);
 | |
|     }
 | |
| }
 | |
| 
 | |
| bool bad_usb_scene_file_select_on_event(void* context, SceneManagerEvent event) {
 | |
|     UNUSED(context);
 | |
|     UNUSED(event);
 | |
|     // BadUsbApp* bad_usb = context;
 | |
|     return false;
 | |
| }
 | |
| 
 | |
| void bad_usb_scene_file_select_on_exit(void* context) {
 | |
|     UNUSED(context);
 | |
|     // BadUsbApp* bad_usb = context;
 | |
| }
 |