[FL-1061] iButton save and load from sd card (#394)

* SD App: fix queue adresses
* sd-filesystem: fix making path on file select event
* ibutton: add key reading from sd card
* ibutton: save ibutton key to sd card
* ibutton: add deleting keys from sd card
* ibutton: remove KeyStore from application
* ibutton: make directory if necessary on key save

Co-authored-by: DrZlo13 <who.just.the.doctor@gmail.com>
Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
gornekich
2021-03-31 20:47:32 +03:00
committed by GitHub
parent 6375f21cf5
commit 5309bfae41
15 changed files with 132 additions and 256 deletions

View File

@@ -55,10 +55,19 @@ bool iButtonSceneDeleteConfirm::on_event(iButtonApp* app, iButtonEvent* event) {
if(event->type == iButtonEvent::Type::EventTypeDialogResult) {
if(event->payload.dialog_result == DialogExResultRight) {
KeyStore* store = app->get_key_store();
store->remove_key(app->get_stored_key_index());
app->switch_to_next_scene(iButtonApp::Scene::SceneDeleteSuccess);
iButtonKey* key = app->get_key();
string_t key_file_name;
string_init_set_str(key_file_name, "ibutton/");
string_cat_str(key_file_name, key->get_name());
bool res =
(app->get_fs_api()->common.remove(string_get_cstr(key_file_name)) == FSE_OK);
string_clear(key_file_name);
if(res) {
app->switch_to_next_scene(iButtonApp::Scene::SceneDeleteSuccess);
} else {
// TODO error file path
// app->switch_to_next_scene(iButtonApp::Scene::SceneDeleteFail);
}
} else {
app->switch_to_previous_scene();
}