mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-07-29 02:08:10 -07:00
rise and shine mr freeman...
This commit is contained in:
@@ -46,21 +46,23 @@ bool subbrute_attack_view_input(InputEvent* event, void* context) {
|
||||
if(event->key == InputKeyBack && event->type == InputTypeShort) {
|
||||
instance->callback(SubBruteCustomEventTypeBackPressed, instance->context);
|
||||
with_view_model(
|
||||
instance->view, (SubBruteAttackViewModel * model) {
|
||||
instance->view,
|
||||
SubBruteAttackViewModel * model,
|
||||
{
|
||||
model->is_attacking = false;
|
||||
model->is_continuous_worker = false;
|
||||
return true;
|
||||
});
|
||||
},
|
||||
true);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool is_attacking = false;
|
||||
|
||||
with_view_model(
|
||||
instance->view, (SubBruteAttackViewModel * model) {
|
||||
is_attacking = model->is_attacking;
|
||||
return false;
|
||||
});
|
||||
instance->view,
|
||||
SubBruteAttackViewModel * model,
|
||||
{ is_attacking = model->is_attacking; },
|
||||
false);
|
||||
|
||||
// if(!is_attacking) {
|
||||
// instance->callback(SubBruteCustomEventTypeTransmitNotStarted, instance->context);
|
||||
@@ -74,13 +76,15 @@ bool subbrute_attack_view_input(InputEvent* event, void* context) {
|
||||
FURI_LOG_D(TAG, "InputKey: %d OK", event->key);
|
||||
#endif
|
||||
with_view_model(
|
||||
instance->view, (SubBruteAttackViewModel * model) {
|
||||
instance->view,
|
||||
SubBruteAttackViewModel * model,
|
||||
{
|
||||
model->is_attacking = true;
|
||||
model->is_continuous_worker = false;
|
||||
icon_animation_stop(model->icon);
|
||||
icon_animation_start(model->icon);
|
||||
return true;
|
||||
});
|
||||
},
|
||||
true);
|
||||
instance->callback(SubBruteCustomEventTypeTransmitStarted, instance->context);
|
||||
/*if(event->type == InputTypeRepeat && event->key == InputKeyOk) {
|
||||
#ifdef FURI_DEBUG
|
||||
@@ -151,13 +155,15 @@ bool subbrute_attack_view_input(InputEvent* event, void* context) {
|
||||
if((event->type == InputTypeShort || event->type == InputTypeRepeat) &&
|
||||
(event->key == InputKeyOk || event->key == InputKeyBack)) {
|
||||
with_view_model(
|
||||
instance->view, (SubBruteAttackViewModel * model) {
|
||||
instance->view,
|
||||
SubBruteAttackViewModel * model,
|
||||
{
|
||||
model->is_attacking = false;
|
||||
model->is_continuous_worker = false;
|
||||
icon_animation_stop(model->icon);
|
||||
icon_animation_start(model->icon);
|
||||
return true;
|
||||
});
|
||||
},
|
||||
true);
|
||||
instance->callback(SubBruteCustomEventTypeTransmitNotStarted, instance->context);
|
||||
}
|
||||
}
|
||||
@@ -173,11 +179,13 @@ SubBruteAttackView* subbrute_attack_view_alloc() {
|
||||
view_set_context(instance->view, instance);
|
||||
|
||||
with_view_model(
|
||||
instance->view, (SubBruteAttackViewModel * model) {
|
||||
instance->view,
|
||||
SubBruteAttackViewModel * model,
|
||||
{
|
||||
model->icon = icon_animation_alloc(&A_Sub1ghz_14);
|
||||
view_tie_icon_animation(instance->view, model->icon);
|
||||
return false;
|
||||
});
|
||||
},
|
||||
false);
|
||||
|
||||
view_set_draw_callback(instance->view, (ViewDrawCallback)subbrute_attack_view_draw);
|
||||
view_set_input_callback(instance->view, subbrute_attack_view_input);
|
||||
@@ -203,10 +211,10 @@ void subbrute_attack_view_free(SubBruteAttackView* instance) {
|
||||
#endif
|
||||
|
||||
with_view_model(
|
||||
instance->view, (SubBruteAttackViewModel * model) {
|
||||
icon_animation_free(model->icon);
|
||||
return false;
|
||||
});
|
||||
instance->view,
|
||||
SubBruteAttackViewModel * model,
|
||||
{ icon_animation_free(model->icon); },
|
||||
false);
|
||||
|
||||
view_free(instance->view);
|
||||
free(instance);
|
||||
@@ -223,19 +231,19 @@ void subbrute_attack_view_set_current_step(SubBruteAttackView* instance, uint64_
|
||||
//FURI_LOG_D(TAG, "Set step: %d", current_step);
|
||||
#endif
|
||||
with_view_model(
|
||||
instance->view, (SubBruteAttackViewModel * model) {
|
||||
model->current_step = current_step;
|
||||
return true;
|
||||
});
|
||||
instance->view,
|
||||
SubBruteAttackViewModel * model,
|
||||
{ model->current_step = current_step; },
|
||||
true);
|
||||
}
|
||||
|
||||
void subbrute_attack_view_set_worker_type(SubBruteAttackView* instance, bool is_continuous_worker) {
|
||||
furi_assert(instance);
|
||||
with_view_model(
|
||||
instance->view, (SubBruteAttackViewModel * model) {
|
||||
model->is_continuous_worker = is_continuous_worker;
|
||||
return true;
|
||||
});
|
||||
instance->view,
|
||||
SubBruteAttackViewModel * model,
|
||||
{ model->is_continuous_worker = is_continuous_worker; },
|
||||
true);
|
||||
}
|
||||
|
||||
// We need to call init every time, because not every time we calls enter
|
||||
@@ -255,7 +263,9 @@ void subbrute_attack_view_init_values(
|
||||
current_step);
|
||||
#endif
|
||||
with_view_model(
|
||||
instance->view, (SubBruteAttackViewModel * model) {
|
||||
instance->view,
|
||||
SubBruteAttackViewModel * model,
|
||||
{
|
||||
model->max_value = max_value;
|
||||
model->index = index;
|
||||
model->current_step = current_step;
|
||||
@@ -265,8 +275,8 @@ void subbrute_attack_view_init_values(
|
||||
} else {
|
||||
icon_animation_stop(model->icon);
|
||||
}
|
||||
return true;
|
||||
});
|
||||
},
|
||||
true);
|
||||
}
|
||||
|
||||
void subbrute_attack_view_exit(void* context) {
|
||||
@@ -276,10 +286,10 @@ void subbrute_attack_view_exit(void* context) {
|
||||
FURI_LOG_D(TAG, "subbrute_attack_view_exit");
|
||||
#endif
|
||||
with_view_model(
|
||||
instance->view, (SubBruteAttackViewModel * model) {
|
||||
icon_animation_stop(model->icon);
|
||||
return false;
|
||||
});
|
||||
instance->view,
|
||||
SubBruteAttackViewModel * model,
|
||||
{ icon_animation_stop(model->icon); },
|
||||
false);
|
||||
}
|
||||
|
||||
void elements_button_top_left(Canvas* canvas, const char* str) {
|
||||
|
||||
@@ -173,17 +173,19 @@ bool subbrute_main_view_input(InputEvent* event, void* context) {
|
||||
uint8_t index = 0;
|
||||
bool is_select_byte = false;
|
||||
with_view_model(
|
||||
instance->view, (SubBruteMainViewModel * model) {
|
||||
is_select_byte = model->is_select_byte;
|
||||
return false;
|
||||
});
|
||||
instance->view,
|
||||
SubBruteMainViewModel * model,
|
||||
{ is_select_byte = model->is_select_byte; },
|
||||
false);
|
||||
|
||||
bool consumed = false;
|
||||
if(!is_select_byte) {
|
||||
if((event->type == InputTypeShort) || (event->type == InputTypeRepeat)) {
|
||||
bool ret = false;
|
||||
with_view_model(
|
||||
instance->view, (SubBruteMainViewModel * model) {
|
||||
bool ret = false;
|
||||
instance->view,
|
||||
SubBruteMainViewModel * model,
|
||||
{
|
||||
uint8_t items_on_screen = 3;
|
||||
if(event->key == InputKeyUp) {
|
||||
if(model->index == min_value) {
|
||||
@@ -219,8 +221,8 @@ bool subbrute_main_view_input(InputEvent* event, void* context) {
|
||||
}
|
||||
}
|
||||
index = model->index;
|
||||
return ret;
|
||||
});
|
||||
},
|
||||
ret);
|
||||
}
|
||||
|
||||
#ifdef FURI_DEBUG
|
||||
@@ -243,7 +245,9 @@ bool subbrute_main_view_input(InputEvent* event, void* context) {
|
||||
} else {
|
||||
if((event->type == InputTypeShort) || (event->type == InputTypeRepeat)) {
|
||||
with_view_model(
|
||||
instance->view, (SubBruteMainViewModel * model) {
|
||||
instance->view,
|
||||
SubBruteMainViewModel * model,
|
||||
{
|
||||
if(event->key == InputKeyLeft) {
|
||||
if(model->index > 0) {
|
||||
model->index--;
|
||||
@@ -255,8 +259,8 @@ bool subbrute_main_view_input(InputEvent* event, void* context) {
|
||||
}
|
||||
|
||||
index = model->index;
|
||||
return true;
|
||||
});
|
||||
},
|
||||
true);
|
||||
}
|
||||
|
||||
#ifdef FURI_DEBUG
|
||||
@@ -304,13 +308,15 @@ SubBruteMainView* subbrute_main_view_alloc() {
|
||||
view_set_exit_callback(instance->view, subbrute_main_view_exit);
|
||||
|
||||
with_view_model(
|
||||
instance->view, (SubBruteMainViewModel * model) {
|
||||
instance->view,
|
||||
SubBruteMainViewModel * model,
|
||||
{
|
||||
model->index = 0;
|
||||
model->window_position = 0;
|
||||
model->key_field = NULL;
|
||||
model->is_select_byte = false;
|
||||
return true;
|
||||
});
|
||||
},
|
||||
true);
|
||||
|
||||
return instance;
|
||||
}
|
||||
@@ -338,7 +344,9 @@ void subbrute_main_view_set_index(
|
||||
FURI_LOG_I(TAG, "Set index: %d", idx);
|
||||
#endif
|
||||
with_view_model(
|
||||
instance->view, (SubBruteMainViewModel * model) {
|
||||
instance->view,
|
||||
SubBruteMainViewModel * model,
|
||||
{
|
||||
model->is_select_byte = is_select_byte;
|
||||
model->key_field = key_field;
|
||||
model->index = idx;
|
||||
@@ -359,8 +367,8 @@ void subbrute_main_view_set_index(
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
});
|
||||
},
|
||||
true);
|
||||
}
|
||||
|
||||
SubBruteAttacks subbrute_main_view_get_index(SubBruteMainView* instance) {
|
||||
@@ -368,10 +376,7 @@ SubBruteAttacks subbrute_main_view_get_index(SubBruteMainView* instance) {
|
||||
|
||||
uint8_t idx = 0;
|
||||
with_view_model(
|
||||
instance->view, (SubBruteMainViewModel * model) {
|
||||
idx = model->index;
|
||||
return false;
|
||||
});
|
||||
instance->view, SubBruteMainViewModel * model, { idx = model->index; }, false);
|
||||
|
||||
#ifdef FURI_DEBUG
|
||||
FURI_LOG_D(TAG, "Get index: %d", idx);
|
||||
|
||||
Reference in New Issue
Block a user