[FL-2212] File validators and archive fixes #972

Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
This commit is contained in:
Nikolay Minaylov
2022-01-29 12:39:10 +03:00
committed by GitHub
parent 84410c83b5
commit 6264ee8c3b
24 changed files with 194 additions and 52 deletions

View File

@@ -21,6 +21,10 @@ void LfRfidAppSceneSaveName::on_enter(LfRfidApp* app, bool need_restore) {
app->worker.key.get_name_length(),
key_name_empty);
ValidatorIsFile* validator_is_file =
validator_is_file_alloc_init(app->app_folder, app->app_extension);
text_input->set_validator(validator_is_file_callback, validator_is_file);
app->view_controller.switch_to<TextInputVM>();
}
@@ -46,6 +50,11 @@ bool LfRfidAppSceneSaveName::on_event(LfRfidApp* app, LfRfidApp::Event* event) {
}
void LfRfidAppSceneSaveName::on_exit(LfRfidApp* app) {
void* validator_context =
app->view_controller.get<TextInputVM>()->get_validator_callback_context();
app->view_controller.get<TextInputVM>()->set_validator(NULL, NULL);
validator_is_file_free((ValidatorIsFile*)validator_context);
app->view_controller.get<TextInputVM>()->clean();
}