mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-07-11 23:38:11 -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);
|
||||
|
||||
@@ -146,52 +146,39 @@ View* wav_player_view_get_view(WavPlayerView* wav_view) {
|
||||
void wav_player_view_set_volume(WavPlayerView* wav_view, float volume) {
|
||||
furi_assert(wav_view);
|
||||
with_view_model(
|
||||
wav_view->view, (WavPlayerViewModel * model) {
|
||||
model->volume = volume;
|
||||
return true;
|
||||
});
|
||||
wav_view->view, WavPlayerViewModel * model, { model->volume = volume; }, true);
|
||||
}
|
||||
|
||||
void wav_player_view_set_start(WavPlayerView* wav_view, size_t start) {
|
||||
furi_assert(wav_view);
|
||||
with_view_model(
|
||||
wav_view->view, (WavPlayerViewModel * model) {
|
||||
model->start = start;
|
||||
return true;
|
||||
});
|
||||
wav_view->view, WavPlayerViewModel * model, { model->start = start; }, true);
|
||||
}
|
||||
|
||||
void wav_player_view_set_end(WavPlayerView* wav_view, size_t end) {
|
||||
furi_assert(wav_view);
|
||||
with_view_model(
|
||||
wav_view->view, (WavPlayerViewModel * model) {
|
||||
model->end = end;
|
||||
return true;
|
||||
});
|
||||
wav_view->view, WavPlayerViewModel * model, { model->end = end; }, true);
|
||||
}
|
||||
|
||||
void wav_player_view_set_current(WavPlayerView* wav_view, size_t current) {
|
||||
furi_assert(wav_view);
|
||||
with_view_model(
|
||||
wav_view->view, (WavPlayerViewModel * model) {
|
||||
model->current = current;
|
||||
return true;
|
||||
});
|
||||
wav_view->view, WavPlayerViewModel * model, { model->current = current; }, true);
|
||||
}
|
||||
|
||||
void wav_player_view_set_play(WavPlayerView* wav_view, bool play) {
|
||||
furi_assert(wav_view);
|
||||
with_view_model(
|
||||
wav_view->view, (WavPlayerViewModel * model) {
|
||||
model->play = play;
|
||||
return true;
|
||||
});
|
||||
wav_view->view, WavPlayerViewModel * model, { model->play = play; }, true);
|
||||
}
|
||||
|
||||
void wav_player_view_set_data(WavPlayerView* wav_view, uint16_t* data, size_t data_count) {
|
||||
furi_assert(wav_view);
|
||||
with_view_model(
|
||||
wav_view->view, (WavPlayerViewModel * model) {
|
||||
wav_view->view,
|
||||
WavPlayerViewModel * model,
|
||||
{
|
||||
size_t inc = (data_count / DATA_COUNT) - 1;
|
||||
|
||||
for(size_t i = 0; i < DATA_COUNT; i++) {
|
||||
@@ -199,8 +186,8 @@ void wav_player_view_set_data(WavPlayerView* wav_view, uint16_t* data, size_t da
|
||||
if(model->data[i] > 42) model->data[i] = 42;
|
||||
data += inc;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
},
|
||||
true);
|
||||
}
|
||||
|
||||
void wav_player_view_set_ctrl_callback(WavPlayerView* wav_view, WavPlayerCtrlCallback callback) {
|
||||
|
||||
Reference in New Issue
Block a user