[FL-976] Removing lambdas (#1849)
* Removing lambdas... * Wake the fk up, Gordon! We have a citadel to burn! * Here comes the Nihilanth * Lambda documentation Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
@@ -28,22 +28,25 @@ void updater_main_model_set_state(
|
||||
const char* message,
|
||||
uint8_t progress,
|
||||
bool failed) {
|
||||
bool update = false;
|
||||
with_view_model(
|
||||
main_view->view, (UpdaterProgressModel * model) {
|
||||
main_view->view,
|
||||
UpdaterProgressModel * model,
|
||||
{
|
||||
model->failed = failed;
|
||||
model->progress = progress;
|
||||
if(furi_string_cmp_str(model->status, message)) {
|
||||
furi_string_set(model->status, message);
|
||||
model->rendered_progress = progress;
|
||||
return true;
|
||||
}
|
||||
if((model->rendered_progress > progress) ||
|
||||
((progress - model->rendered_progress) > PROGRESS_RENDER_STEP)) {
|
||||
update = true;
|
||||
} else if(
|
||||
(model->rendered_progress > progress) ||
|
||||
((progress - model->rendered_progress) > PROGRESS_RENDER_STEP)) {
|
||||
model->rendered_progress = progress;
|
||||
return true;
|
||||
update = true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
},
|
||||
update);
|
||||
}
|
||||
|
||||
View* updater_main_get_view(UpdaterMainView* main_view) {
|
||||
@@ -104,10 +107,10 @@ UpdaterMainView* updater_main_alloc() {
|
||||
view_allocate_model(main_view->view, ViewModelTypeLocking, sizeof(UpdaterProgressModel));
|
||||
|
||||
with_view_model(
|
||||
main_view->view, (UpdaterProgressModel * model) {
|
||||
model->status = furi_string_alloc_set("Waiting for SD card");
|
||||
return true;
|
||||
});
|
||||
main_view->view,
|
||||
UpdaterProgressModel * model,
|
||||
{ model->status = furi_string_alloc_set("Waiting for SD card"); },
|
||||
true);
|
||||
|
||||
view_set_context(main_view->view, main_view);
|
||||
view_set_input_callback(main_view->view, updater_main_input);
|
||||
@@ -119,10 +122,7 @@ UpdaterMainView* updater_main_alloc() {
|
||||
void updater_main_free(UpdaterMainView* main_view) {
|
||||
furi_assert(main_view);
|
||||
with_view_model(
|
||||
main_view->view, (UpdaterProgressModel * model) {
|
||||
furi_string_free(model->status);
|
||||
return false;
|
||||
});
|
||||
main_view->view, UpdaterProgressModel * model, { furi_string_free(model->status); }, false);
|
||||
view_free(main_view->view);
|
||||
free(main_view);
|
||||
}
|
||||
|
Reference in New Issue
Block a user