NFC: Edit UID feature (#1513)
* Added option to edit UID in saved NFC files * Fixed bug with saved filename * Only show for data that can't be read Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
		
							parent
							
								
									135fbd294b
								
							
						
					
					
						commit
						284c56718b
					
				| @ -2,6 +2,7 @@ | |||||||
| 
 | 
 | ||||||
| enum SubmenuIndex { | enum SubmenuIndex { | ||||||
|     SubmenuIndexEmulate, |     SubmenuIndexEmulate, | ||||||
|  |     SubmenuIndexEditUid, | ||||||
|     SubmenuIndexRename, |     SubmenuIndexRename, | ||||||
|     SubmenuIndexDelete, |     SubmenuIndexDelete, | ||||||
|     SubmenuIndexInfo, |     SubmenuIndexInfo, | ||||||
| @ -27,6 +28,14 @@ void nfc_scene_saved_menu_on_enter(void* context) { | |||||||
|             SubmenuIndexEmulate, |             SubmenuIndexEmulate, | ||||||
|             nfc_scene_saved_menu_submenu_callback, |             nfc_scene_saved_menu_submenu_callback, | ||||||
|             nfc); |             nfc); | ||||||
|  |         if(nfc->dev->dev_data.protocol == NfcDeviceProtocolUnknown) { | ||||||
|  |             submenu_add_item( | ||||||
|  |                 submenu, | ||||||
|  |                 "Edit UID", | ||||||
|  |                 SubmenuIndexEditUid, | ||||||
|  |                 nfc_scene_saved_menu_submenu_callback, | ||||||
|  |                 nfc); | ||||||
|  |         } | ||||||
|     } else if( |     } else if( | ||||||
|         nfc->dev->format == NfcDeviceSaveFormatMifareUl || |         nfc->dev->format == NfcDeviceSaveFormatMifareUl || | ||||||
|         nfc->dev->format == NfcDeviceSaveFormatMifareClassic) { |         nfc->dev->format == NfcDeviceSaveFormatMifareClassic) { | ||||||
| @ -71,6 +80,9 @@ bool nfc_scene_saved_menu_on_event(void* context, SceneManagerEvent event) { | |||||||
|         } else if(event.event == SubmenuIndexRename) { |         } else if(event.event == SubmenuIndexRename) { | ||||||
|             scene_manager_next_scene(nfc->scene_manager, NfcSceneSaveName); |             scene_manager_next_scene(nfc->scene_manager, NfcSceneSaveName); | ||||||
|             consumed = true; |             consumed = true; | ||||||
|  |         } else if(event.event == SubmenuIndexEditUid) { | ||||||
|  |             scene_manager_next_scene(nfc->scene_manager, NfcSceneSetUid); | ||||||
|  |             consumed = true; | ||||||
|         } else if(event.event == SubmenuIndexDelete) { |         } else if(event.event == SubmenuIndexDelete) { | ||||||
|             scene_manager_next_scene(nfc->scene_manager, NfcSceneDelete); |             scene_manager_next_scene(nfc->scene_manager, NfcSceneDelete); | ||||||
|             consumed = true; |             consumed = true; | ||||||
|  | |||||||
| @ -31,8 +31,16 @@ bool nfc_scene_set_uid_on_event(void* context, SceneManagerEvent event) { | |||||||
|     if(event.type == SceneManagerEventTypeCustom) { |     if(event.type == SceneManagerEventTypeCustom) { | ||||||
|         if(event.event == NfcCustomEventByteInputDone) { |         if(event.event == NfcCustomEventByteInputDone) { | ||||||
|             DOLPHIN_DEED(DolphinDeedNfcAdd); |             DOLPHIN_DEED(DolphinDeedNfcAdd); | ||||||
|             scene_manager_next_scene(nfc->scene_manager, NfcSceneSaveName); |             if(scene_manager_has_previous_scene(nfc->scene_manager, NfcSceneSavedMenu)) { | ||||||
|             consumed = true; |                 nfc->dev->dev_data.nfc_data = nfc->dev_edit_data; | ||||||
|  |                 if(nfc_device_save(nfc->dev, nfc->dev->dev_name)) { | ||||||
|  |                     scene_manager_next_scene(nfc->scene_manager, NfcSceneSaveSuccess); | ||||||
|  |                     consumed = true; | ||||||
|  |                 } | ||||||
|  |             } else { | ||||||
|  |                 scene_manager_next_scene(nfc->scene_manager, NfcSceneSaveName); | ||||||
|  |                 consumed = true; | ||||||
|  |             } | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|     return consumed; |     return consumed; | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Ryan Murphy
						Ryan Murphy