This repository has been archived by the owner on Jul 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Saved cards can now display stored values, and be deleted
- Loading branch information
1 parent
ca5a553
commit 3e646d9
Showing
6 changed files
with
94 additions
and
46 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,48 @@ | ||
#include "../mag_i.h" | ||
#include "../mag_device.h" | ||
#include <toolbox/path.h> | ||
|
||
void mag_scene_delete_confirm_on_enter(void* context) { | ||
Mag* mag = context; | ||
UNUSED(mag); | ||
Widget* widget = mag->widget; | ||
MagDevice* mag_dev = mag->mag_dev; | ||
|
||
FuriString* tmp_str; | ||
tmp_str = furi_string_alloc(); | ||
|
||
furi_string_printf(tmp_str, "\e#Delete %s?\e#", mag_dev->dev_name); | ||
|
||
widget_add_text_box_element( | ||
widget, 0, 0, 128, 27, AlignCenter, AlignCenter, furi_string_get_cstr(tmp_str), true); | ||
widget_add_button_element(widget, GuiButtonTypeLeft, "Cancel", mag_widget_callback, mag); | ||
widget_add_button_element(widget, GuiButtonTypeRight, "Delete", mag_widget_callback, mag); | ||
|
||
view_dispatcher_switch_to_view(mag->view_dispatcher, MagViewWidget); | ||
|
||
furi_string_free(tmp_str); | ||
} | ||
|
||
bool mag_scene_delete_confirm_on_event(void* context, SceneManagerEvent event) { | ||
Mag* mag = context; | ||
UNUSED(mag); | ||
UNUSED(event); | ||
SceneManager* scene_manager = mag->scene_manager; | ||
bool consumed = false; | ||
|
||
if(event.type == SceneManagerEventTypeCustom) { | ||
if(event.event == GuiButtonTypeRight) { | ||
consumed = true; | ||
if(mag_device_delete(mag->mag_dev, true)) { | ||
scene_manager_next_scene(scene_manager, MagSceneDeleteSuccess); | ||
} | ||
} else if(event.event == GuiButtonTypeLeft) { | ||
consumed = true; | ||
scene_manager_previous_scene(scene_manager); | ||
} | ||
} | ||
|
||
return consumed; | ||
} | ||
|
||
void mag_scene_delete_confirm_on_exit(void* context) { | ||
Mag* mag = context; | ||
UNUSED(mag); | ||
widget_reset(mag->widget); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters