mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-13 01:08:35 -07:00
Merge branch 'Flipper-XFW:dev' into dev
This commit is contained in:
6
.gitignore
vendored
6
.gitignore
vendored
@@ -78,7 +78,7 @@ commitnotes.md
|
|||||||
fbt_options.py
|
fbt_options.py
|
||||||
|
|
||||||
# Asset packs
|
# Asset packs
|
||||||
assets/dolphin/custom/*
|
assets/asset_packs/*
|
||||||
!assets/dolphin/custom/WatchDogs/
|
!assets/asset_packs/WatchDogs/
|
||||||
!assets/dolphin/custom/ReadMe.md
|
!assets/asset_packs/ReadMe.md
|
||||||
assets/resources/asset_packs/
|
assets/resources/asset_packs/
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
App(
|
App(
|
||||||
appid="lightmeter",
|
appid="lightmeter",
|
||||||
name="Lightmeter",
|
name="[BH1750] Lightmeter",
|
||||||
apptype=FlipperAppType.EXTERNAL,
|
apptype=FlipperAppType.EXTERNAL,
|
||||||
entry_point="lightmeter_app",
|
entry_point="lightmeter_app",
|
||||||
requires=[
|
requires=[
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ static void xtreme_app_scene_interface_graphics_asset_pack_changed(VariableItem*
|
|||||||
XtremeApp* app = variable_item_get_context(item);
|
XtremeApp* app = variable_item_get_context(item);
|
||||||
uint8_t index = variable_item_get_current_value_index(item);
|
uint8_t index = variable_item_get_current_value_index(item);
|
||||||
variable_item_set_current_value_text(
|
variable_item_set_current_value_text(
|
||||||
item, index == 0 ? "SFW" : *CharList_get(app->asset_pack_names, index - 1));
|
item, index == 0 ? "Default" : *CharList_get(app->asset_pack_names, index - 1));
|
||||||
strlcpy(
|
strlcpy(
|
||||||
XTREME_SETTINGS()->asset_pack,
|
XTREME_SETTINGS()->asset_pack,
|
||||||
index == 0 ? "" : *CharList_get(app->asset_pack_names, index - 1),
|
index == 0 ? "" : *CharList_get(app->asset_pack_names, index - 1),
|
||||||
|
|||||||
@@ -14,11 +14,15 @@ void xtreme_app_scene_interface_mainmenu_var_item_list_callback(void* context, u
|
|||||||
view_dispatcher_send_custom_event(app->view_dispatcher, index);
|
view_dispatcher_send_custom_event(app->view_dispatcher, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void xtreme_app_scene_interface_mainmenu_wii_menu_changed(VariableItem* item) {
|
const char* const menu_style_names[MenuStyleCount] = {
|
||||||
|
"List",
|
||||||
|
"Wii",
|
||||||
|
};
|
||||||
|
static void xtreme_app_scene_interface_mainmenu_menu_style_changed(VariableItem* item) {
|
||||||
XtremeApp* app = variable_item_get_context(item);
|
XtremeApp* app = variable_item_get_context(item);
|
||||||
bool value = variable_item_get_current_value_index(item);
|
uint8_t index = variable_item_get_current_value_index(item);
|
||||||
variable_item_set_current_value_text(item, value ? "Wii Grid" : "App List");
|
variable_item_set_current_value_text(item, menu_style_names[index]);
|
||||||
XTREME_SETTINGS()->wii_menu = value;
|
XTREME_SETTINGS()->menu_style = index;
|
||||||
app->save_settings = true;
|
app->save_settings = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -62,10 +66,13 @@ void xtreme_app_scene_interface_mainmenu_on_enter(void* context) {
|
|||||||
VariableItem* item;
|
VariableItem* item;
|
||||||
|
|
||||||
item = variable_item_list_add(
|
item = variable_item_list_add(
|
||||||
var_item_list, "Menu Style", 2, xtreme_app_scene_interface_mainmenu_wii_menu_changed, app);
|
var_item_list,
|
||||||
variable_item_set_current_value_index(item, xtreme_settings->wii_menu);
|
"Menu Style",
|
||||||
variable_item_set_current_value_text(
|
MenuStyleCount,
|
||||||
item, xtreme_settings->wii_menu ? "Wii Grid" : "App List");
|
xtreme_app_scene_interface_mainmenu_menu_style_changed,
|
||||||
|
app);
|
||||||
|
variable_item_set_current_value_index(item, xtreme_settings->menu_style);
|
||||||
|
variable_item_set_current_value_text(item, menu_style_names[xtreme_settings->menu_style]);
|
||||||
|
|
||||||
variable_item_list_add(var_item_list, "Reset Menu", 0, NULL, app);
|
variable_item_list_add(var_item_list, "Reset Menu", 0, NULL, app);
|
||||||
|
|
||||||
|
|||||||
@@ -215,12 +215,10 @@ XtremeApp* xtreme_app_alloc() {
|
|||||||
if(info.flags & FSF_DIRECTORY) {
|
if(info.flags & FSF_DIRECTORY) {
|
||||||
char* copy = strdup(name);
|
char* copy = strdup(name);
|
||||||
size_t idx = 0;
|
size_t idx = 0;
|
||||||
if(strcmp(copy, "NSFW") != 0) {
|
for(; idx < CharList_size(app->asset_pack_names); idx++) {
|
||||||
for(; idx < CharList_size(app->asset_pack_names); idx++) {
|
char* comp = *CharList_get(app->asset_pack_names, idx);
|
||||||
char* comp = *CharList_get(app->asset_pack_names, idx);
|
if(strcasecmp(copy, comp) < 0) {
|
||||||
if(strcasecmp(copy, comp) < 0 && strcmp(comp, "NSFW") != 0) {
|
break;
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CharList_push_at(app->asset_pack_names, idx, copy);
|
CharList_push_at(app->asset_pack_names, idx, copy);
|
||||||
|
|||||||
@@ -489,6 +489,8 @@ void desktop_run_keybind(Desktop* instance, InputType _type, InputKey _key) {
|
|||||||
view_dispatcher_send_custom_event(instance->view_dispatcher, DesktopMainEventLockKeypad);
|
view_dispatcher_send_custom_event(instance->view_dispatcher, DesktopMainEventLockKeypad);
|
||||||
} else if(!strncmp(keybind, "Lock with PIN", MAX_KEYBIND_LENGTH)) {
|
} else if(!strncmp(keybind, "Lock with PIN", MAX_KEYBIND_LENGTH)) {
|
||||||
view_dispatcher_send_custom_event(instance->view_dispatcher, DesktopMainEventLockWithPin);
|
view_dispatcher_send_custom_event(instance->view_dispatcher, DesktopMainEventLockWithPin);
|
||||||
|
} else if(!strncmp(keybind, "Wipe Device", MAX_KEYBIND_LENGTH)) {
|
||||||
|
loader_start_detached_with_gui_error(instance->loader, "Storage", "wipe");
|
||||||
} else {
|
} else {
|
||||||
loader_start_detached_with_gui_error(instance->loader, keybind, NULL);
|
loader_start_detached_with_gui_error(instance->loader, keybind, NULL);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,7 +48,8 @@ static void menu_draw_callback(Canvas* canvas, void* _model) {
|
|||||||
if(items_count) {
|
if(items_count) {
|
||||||
MenuItem* item;
|
MenuItem* item;
|
||||||
size_t shift_position;
|
size_t shift_position;
|
||||||
if(XTREME_SETTINGS()->wii_menu) {
|
switch(XTREME_SETTINGS()->menu_style) {
|
||||||
|
case MenuStyleWii: {
|
||||||
FuriString* name = furi_string_alloc();
|
FuriString* name = furi_string_alloc();
|
||||||
if(items_count > 6 && position >= 4) {
|
if(items_count > 6 && position >= 4) {
|
||||||
if(position >= items_count - 2 + (items_count % 2)) {
|
if(position >= items_count - 2 + (items_count % 2)) {
|
||||||
@@ -102,7 +103,9 @@ static void menu_draw_callback(Canvas* canvas, void* _model) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
furi_string_free(name);
|
furi_string_free(name);
|
||||||
} else {
|
break;
|
||||||
|
}
|
||||||
|
case MenuStyleList: {
|
||||||
// First line
|
// First line
|
||||||
canvas_set_font(canvas, FontSecondary);
|
canvas_set_font(canvas, FontSecondary);
|
||||||
shift_position = (0 + position + items_count - 1) % items_count;
|
shift_position = (0 + position + items_count - 1) % items_count;
|
||||||
@@ -149,6 +152,10 @@ static void menu_draw_callback(Canvas* canvas, void* _model) {
|
|||||||
// Frame and scrollbar
|
// Frame and scrollbar
|
||||||
elements_frame(canvas, 0, 21, 128 - 5, 21);
|
elements_frame(canvas, 0, 21, 128 - 5, 21);
|
||||||
elements_scrollbar(canvas, position, items_count);
|
elements_scrollbar(canvas, position, items_count);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
canvas_draw_str(canvas, 2, 32, "Empty");
|
canvas_draw_str(canvas, 2, 32, "Empty");
|
||||||
@@ -354,19 +361,24 @@ static void menu_process_up(Menu* menu) {
|
|||||||
icon_animation_stop(item->icon);
|
icon_animation_stop(item->icon);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(XTREME_SETTINGS()->wii_menu) {
|
switch(XTREME_SETTINGS()->menu_style) {
|
||||||
|
case MenuStyleWii:
|
||||||
if(model->position % 2 || (model->position == count - 1 && count % 2)) {
|
if(model->position % 2 || (model->position == count - 1 && count % 2)) {
|
||||||
model->position--;
|
model->position--;
|
||||||
} else {
|
} else {
|
||||||
model->position++;
|
model->position++;
|
||||||
}
|
}
|
||||||
model->scroll_counter = 0;
|
model->scroll_counter = 0;
|
||||||
} else {
|
break;
|
||||||
|
case MenuStyleList:
|
||||||
if(model->position > 0) {
|
if(model->position > 0) {
|
||||||
model->position--;
|
model->position--;
|
||||||
} else {
|
} else {
|
||||||
model->position = count - 1;
|
model->position = count - 1;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
item = MenuItemArray_get(model->items, model->position);
|
item = MenuItemArray_get(model->items, model->position);
|
||||||
@@ -388,19 +400,24 @@ static void menu_process_down(Menu* menu) {
|
|||||||
icon_animation_stop(item->icon);
|
icon_animation_stop(item->icon);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(XTREME_SETTINGS()->wii_menu) {
|
switch(XTREME_SETTINGS()->menu_style) {
|
||||||
|
case MenuStyleWii:
|
||||||
if(model->position % 2 || (model->position == count - 1 && count % 2)) {
|
if(model->position % 2 || (model->position == count - 1 && count % 2)) {
|
||||||
model->position--;
|
model->position--;
|
||||||
} else {
|
} else {
|
||||||
model->position++;
|
model->position++;
|
||||||
}
|
}
|
||||||
model->scroll_counter = 0;
|
model->scroll_counter = 0;
|
||||||
} else {
|
break;
|
||||||
|
case MenuStyleList:
|
||||||
if(model->position < count - 1) {
|
if(model->position < count - 1) {
|
||||||
model->position++;
|
model->position++;
|
||||||
} else {
|
} else {
|
||||||
model->position = 0;
|
model->position = 0;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
item = MenuItemArray_get(model->items, model->position);
|
item = MenuItemArray_get(model->items, model->position);
|
||||||
@@ -412,27 +429,33 @@ static void menu_process_down(Menu* menu) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void menu_process_left(Menu* menu) {
|
static void menu_process_left(Menu* menu) {
|
||||||
if(!XTREME_SETTINGS()->wii_menu) return;
|
if(XTREME_SETTINGS()->menu_style == MenuStyleList) return;
|
||||||
with_view_model(
|
with_view_model(
|
||||||
menu->view,
|
menu->view,
|
||||||
MenuModel * model,
|
MenuModel * model,
|
||||||
{
|
{
|
||||||
|
size_t count = MenuItemArray_size(model->items);
|
||||||
MenuItem* item = MenuItemArray_get(model->items, model->position);
|
MenuItem* item = MenuItemArray_get(model->items, model->position);
|
||||||
if(item && item->icon) {
|
if(item && item->icon) {
|
||||||
icon_animation_stop(item->icon);
|
icon_animation_stop(item->icon);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t count = MenuItemArray_size(model->items);
|
switch(XTREME_SETTINGS()->menu_style) {
|
||||||
if(model->position < 2) {
|
case MenuStyleWii:
|
||||||
if(count % 2) {
|
if(model->position < 2) {
|
||||||
model->position = count - 1;
|
if(count % 2) {
|
||||||
|
model->position = count - 1;
|
||||||
|
} else {
|
||||||
|
model->position = count - 2 + model->position % 2;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
model->position = count - 2 + model->position % 2;
|
model->position -= 2;
|
||||||
}
|
}
|
||||||
} else {
|
model->scroll_counter = 0;
|
||||||
model->position -= 2;
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
model->scroll_counter = 0;
|
|
||||||
|
|
||||||
item = MenuItemArray_get(model->items, model->position);
|
item = MenuItemArray_get(model->items, model->position);
|
||||||
if(item && item->icon) {
|
if(item && item->icon) {
|
||||||
@@ -443,32 +466,38 @@ static void menu_process_left(Menu* menu) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void menu_process_right(Menu* menu) {
|
static void menu_process_right(Menu* menu) {
|
||||||
if(!XTREME_SETTINGS()->wii_menu) return;
|
if(XTREME_SETTINGS()->menu_style == MenuStyleList) return;
|
||||||
with_view_model(
|
with_view_model(
|
||||||
menu->view,
|
menu->view,
|
||||||
MenuModel * model,
|
MenuModel * model,
|
||||||
{
|
{
|
||||||
|
size_t count = MenuItemArray_size(model->items);
|
||||||
MenuItem* item = MenuItemArray_get(model->items, model->position);
|
MenuItem* item = MenuItemArray_get(model->items, model->position);
|
||||||
if(item && item->icon) {
|
if(item && item->icon) {
|
||||||
icon_animation_stop(item->icon);
|
icon_animation_stop(item->icon);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t count = MenuItemArray_size(model->items);
|
switch(XTREME_SETTINGS()->menu_style) {
|
||||||
if(count % 2) {
|
case MenuStyleWii:
|
||||||
if(model->position == count - 1) {
|
if(count % 2) {
|
||||||
model->position = 0;
|
if(model->position == count - 1) {
|
||||||
} else if(model->position == count - 2) {
|
model->position = 0;
|
||||||
model->position = count - 1;
|
} else if(model->position == count - 2) {
|
||||||
|
model->position = count - 1;
|
||||||
|
} else {
|
||||||
|
model->position += 2;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
model->position += 2;
|
model->position += 2;
|
||||||
|
if(model->position >= count) {
|
||||||
|
model->position = model->position % 2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
model->scroll_counter = 0;
|
||||||
model->position += 2;
|
break;
|
||||||
if(model->position >= count) {
|
default:
|
||||||
model->position = model->position % 2;
|
break;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
model->scroll_counter = 0;
|
|
||||||
|
|
||||||
item = MenuItemArray_get(model->items, model->position);
|
item = MenuItemArray_get(model->items, model->position);
|
||||||
if(item && item->icon) {
|
if(item && item->icon) {
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ const char* EXTRA_KEYBINDS[] = {
|
|||||||
"Lock Keypad",
|
"Lock Keypad",
|
||||||
"Lock with PIN",
|
"Lock with PIN",
|
||||||
"Passport",
|
"Passport",
|
||||||
|
"Wipe Device",
|
||||||
};
|
};
|
||||||
const size_t EXTRA_KEYBINDS_COUNT = COUNT_OF(EXTRA_KEYBINDS);
|
const size_t EXTRA_KEYBINDS_COUNT = COUNT_OF(EXTRA_KEYBINDS);
|
||||||
|
|
||||||
|
|||||||
@@ -7,3 +7,4 @@ ADD_SCENE(storage_settings, sd_info, SDInfo)
|
|||||||
ADD_SCENE(storage_settings, internal_info, InternalInfo)
|
ADD_SCENE(storage_settings, internal_info, InternalInfo)
|
||||||
ADD_SCENE(storage_settings, benchmark, Benchmark)
|
ADD_SCENE(storage_settings, benchmark, Benchmark)
|
||||||
ADD_SCENE(storage_settings, factory_reset, FactoryReset)
|
ADD_SCENE(storage_settings, factory_reset, FactoryReset)
|
||||||
|
ADD_SCENE(storage_settings, wipe_device, WipeDevice)
|
||||||
@@ -44,6 +44,7 @@ bool storage_settings_scene_format_confirm_on_event(void* context, SceneManagerE
|
|||||||
consumed = scene_manager_previous_scene(app->scene_manager);
|
consumed = scene_manager_previous_scene(app->scene_manager);
|
||||||
break;
|
break;
|
||||||
case DialogExResultRight:
|
case DialogExResultRight:
|
||||||
|
scene_manager_set_scene_state(app->scene_manager, StorageSettingsFormatting, false);
|
||||||
scene_manager_next_scene(app->scene_manager, StorageSettingsFormatting);
|
scene_manager_next_scene(app->scene_manager, StorageSettingsFormatting);
|
||||||
consumed = true;
|
consumed = true;
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#include "../storage_settings.h"
|
#include "../storage_settings.h"
|
||||||
|
#include <power/power_service/power.h>
|
||||||
|
|
||||||
static const NotificationMessage message_green_165 = {
|
static const NotificationMessage message_green_165 = {
|
||||||
.type = NotificationMessageTypeLedGreen,
|
.type = NotificationMessageTypeLedGreen,
|
||||||
@@ -47,8 +48,12 @@ void storage_settings_scene_formatting_on_enter(void* context) {
|
|||||||
dialog_ex_set_text(
|
dialog_ex_set_text(
|
||||||
dialog_ex, storage_error_get_desc(error), 64, 32, AlignCenter, AlignCenter);
|
dialog_ex, storage_error_get_desc(error), 64, 32, AlignCenter, AlignCenter);
|
||||||
} else {
|
} else {
|
||||||
dialog_ex_set_icon(dialog_ex, 72, 17, &I_DolphinCommon_56x48);
|
if(scene_manager_get_scene_state(app->scene_manager, StorageSettingsFormatting)) {
|
||||||
dialog_ex_set_header(dialog_ex, "Format\ncomplete!", 14, 15, AlignLeft, AlignTop);
|
power_reboot(PowerBootModeNormal);
|
||||||
|
} else {
|
||||||
|
dialog_ex_set_icon(dialog_ex, 72, 17, &I_DolphinCommon_56x48);
|
||||||
|
dialog_ex_set_header(dialog_ex, "Format\ncomplete!", 14, 15, AlignLeft, AlignTop);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
dialog_ex_set_center_button_text(dialog_ex, "OK");
|
dialog_ex_set_center_button_text(dialog_ex, "OK");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,8 @@ enum StorageSettingsStartSubmenuIndex {
|
|||||||
StorageSettingsStartSubmenuIndexUnmount,
|
StorageSettingsStartSubmenuIndexUnmount,
|
||||||
StorageSettingsStartSubmenuIndexFormat,
|
StorageSettingsStartSubmenuIndexFormat,
|
||||||
StorageSettingsStartSubmenuIndexBenchy,
|
StorageSettingsStartSubmenuIndexBenchy,
|
||||||
StorageSettingsStartSubmenuIndexFactoryReset
|
StorageSettingsStartSubmenuIndexFactoryReset,
|
||||||
|
StorageSettingsStartSubmenuIndexWipeDevice,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void storage_settings_scene_start_submenu_callback(void* context, uint32_t index) {
|
static void storage_settings_scene_start_submenu_callback(void* context, uint32_t index) {
|
||||||
@@ -55,6 +56,12 @@ void storage_settings_scene_start_on_enter(void* context) {
|
|||||||
StorageSettingsStartSubmenuIndexFactoryReset,
|
StorageSettingsStartSubmenuIndexFactoryReset,
|
||||||
storage_settings_scene_start_submenu_callback,
|
storage_settings_scene_start_submenu_callback,
|
||||||
app);
|
app);
|
||||||
|
submenu_add_item(
|
||||||
|
submenu,
|
||||||
|
"Wipe Device",
|
||||||
|
StorageSettingsStartSubmenuIndexWipeDevice,
|
||||||
|
storage_settings_scene_start_submenu_callback,
|
||||||
|
app);
|
||||||
|
|
||||||
submenu_set_selected_item(
|
submenu_set_selected_item(
|
||||||
submenu, scene_manager_get_scene_state(app->scene_manager, StorageSettingsStart));
|
submenu, scene_manager_get_scene_state(app->scene_manager, StorageSettingsStart));
|
||||||
@@ -108,6 +115,14 @@ bool storage_settings_scene_start_on_event(void* context, SceneManagerEvent even
|
|||||||
scene_manager_next_scene(app->scene_manager, StorageSettingsFactoryReset);
|
scene_manager_next_scene(app->scene_manager, StorageSettingsFactoryReset);
|
||||||
consumed = true;
|
consumed = true;
|
||||||
break;
|
break;
|
||||||
|
case StorageSettingsStartSubmenuIndexWipeDevice:
|
||||||
|
scene_manager_set_scene_state(
|
||||||
|
app->scene_manager,
|
||||||
|
StorageSettingsStart,
|
||||||
|
StorageSettingsStartSubmenuIndexWipeDevice);
|
||||||
|
scene_manager_next_scene(app->scene_manager, StorageSettingsWipeDevice);
|
||||||
|
consumed = true;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return consumed;
|
return consumed;
|
||||||
|
|||||||
@@ -0,0 +1,90 @@
|
|||||||
|
#include "../storage_settings.h"
|
||||||
|
#include <furi_hal.h>
|
||||||
|
|
||||||
|
#define STORAGE_SETTINGS_SCENE_WIPE_DEVICE_CONFIRM_COUNT 5
|
||||||
|
|
||||||
|
static void
|
||||||
|
storage_settings_scene_wipe_device_dialog_callback(DialogExResult result, void* context) {
|
||||||
|
StorageSettings* app = context;
|
||||||
|
|
||||||
|
view_dispatcher_send_custom_event(app->view_dispatcher, result);
|
||||||
|
}
|
||||||
|
|
||||||
|
void storage_settings_scene_wipe_device_on_enter(void* context) {
|
||||||
|
StorageSettings* app = context;
|
||||||
|
DialogEx* dialog_ex = app->dialog_ex;
|
||||||
|
|
||||||
|
dialog_ex_set_context(dialog_ex, app);
|
||||||
|
dialog_ex_set_result_callback(dialog_ex, storage_settings_scene_wipe_device_dialog_callback);
|
||||||
|
|
||||||
|
dialog_ex_set_left_button_text(dialog_ex, "Cancel");
|
||||||
|
dialog_ex_set_right_button_text(dialog_ex, "Erase");
|
||||||
|
|
||||||
|
dialog_ex_set_header(dialog_ex, "Confirm full Wipe", 64, 10, AlignCenter, AlignCenter);
|
||||||
|
dialog_ex_set_text(
|
||||||
|
dialog_ex,
|
||||||
|
"Everything will be erased\r\nData and settings will be lost!",
|
||||||
|
64,
|
||||||
|
32,
|
||||||
|
AlignCenter,
|
||||||
|
AlignCenter);
|
||||||
|
|
||||||
|
view_dispatcher_switch_to_view(app->view_dispatcher, StorageSettingsViewDialogEx);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool storage_settings_scene_wipe_device_on_event(void* context, SceneManagerEvent event) {
|
||||||
|
StorageSettings* app = context;
|
||||||
|
bool consumed = false;
|
||||||
|
|
||||||
|
uint32_t counter =
|
||||||
|
scene_manager_get_scene_state(app->scene_manager, StorageSettingsWipeDevice);
|
||||||
|
|
||||||
|
if(event.type == SceneManagerEventTypeCustom) {
|
||||||
|
switch(event.event) {
|
||||||
|
case DialogExResultLeft:
|
||||||
|
scene_manager_set_scene_state(app->scene_manager, StorageSettingsWipeDevice, 0);
|
||||||
|
consumed = scene_manager_previous_scene(app->scene_manager);
|
||||||
|
if(!consumed) {
|
||||||
|
view_dispatcher_stop(app->view_dispatcher);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case DialogExResultRight:
|
||||||
|
counter++;
|
||||||
|
if(counter < STORAGE_SETTINGS_SCENE_WIPE_DEVICE_CONFIRM_COUNT) {
|
||||||
|
furi_string_printf(
|
||||||
|
app->text_string,
|
||||||
|
"%ld presses left",
|
||||||
|
STORAGE_SETTINGS_SCENE_WIPE_DEVICE_CONFIRM_COUNT - counter);
|
||||||
|
dialog_ex_set_text(
|
||||||
|
app->dialog_ex,
|
||||||
|
furi_string_get_cstr(app->text_string),
|
||||||
|
64,
|
||||||
|
32,
|
||||||
|
AlignCenter,
|
||||||
|
AlignCenter);
|
||||||
|
scene_manager_set_scene_state(
|
||||||
|
app->scene_manager, StorageSettingsWipeDevice, counter);
|
||||||
|
} else {
|
||||||
|
furi_hal_rtc_set_flag(FuriHalRtcFlagFactoryReset);
|
||||||
|
scene_manager_set_scene_state(app->scene_manager, StorageSettingsFormatting, true);
|
||||||
|
scene_manager_next_scene(app->scene_manager, StorageSettingsFormatting);
|
||||||
|
}
|
||||||
|
|
||||||
|
consumed = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else if(event.type == SceneManagerEventTypeBack) {
|
||||||
|
consumed = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return consumed;
|
||||||
|
}
|
||||||
|
|
||||||
|
void storage_settings_scene_wipe_device_on_exit(void* context) {
|
||||||
|
StorageSettings* app = context;
|
||||||
|
DialogEx* dialog_ex = app->dialog_ex;
|
||||||
|
|
||||||
|
dialog_ex_reset(dialog_ex);
|
||||||
|
|
||||||
|
furi_string_reset(app->text_string);
|
||||||
|
}
|
||||||
@@ -41,8 +41,6 @@ static StorageSettings* storage_settings_alloc() {
|
|||||||
view_dispatcher_add_view(
|
view_dispatcher_add_view(
|
||||||
app->view_dispatcher, StorageSettingsViewDialogEx, dialog_ex_get_view(app->dialog_ex));
|
app->view_dispatcher, StorageSettingsViewDialogEx, dialog_ex_get_view(app->dialog_ex));
|
||||||
|
|
||||||
scene_manager_next_scene(app->scene_manager, StorageSettingsStart);
|
|
||||||
|
|
||||||
return app;
|
return app;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,10 +63,15 @@ static void storage_settings_free(StorageSettings* app) {
|
|||||||
free(app);
|
free(app);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t storage_settings_app(void* p) {
|
int32_t storage_settings_app(char* p) {
|
||||||
UNUSED(p);
|
|
||||||
StorageSettings* app = storage_settings_alloc();
|
StorageSettings* app = storage_settings_alloc();
|
||||||
|
|
||||||
|
if(p && strlen(p) && strcmp(p, "wipe") == 0) {
|
||||||
|
scene_manager_next_scene(app->scene_manager, StorageSettingsWipeDevice);
|
||||||
|
} else {
|
||||||
|
scene_manager_next_scene(app->scene_manager, StorageSettingsStart);
|
||||||
|
}
|
||||||
|
|
||||||
view_dispatcher_run(app->view_dispatcher);
|
view_dispatcher_run(app->view_dispatcher);
|
||||||
|
|
||||||
storage_settings_free(app);
|
storage_settings_free(app);
|
||||||
|
|||||||
@@ -5,12 +5,12 @@
|
|||||||
#define TAG "XtremeSettings"
|
#define TAG "XtremeSettings"
|
||||||
|
|
||||||
XtremeSettings xtreme_settings = {
|
XtremeSettings xtreme_settings = {
|
||||||
.asset_pack = "", // SFW
|
.asset_pack = "", // Default
|
||||||
.anim_speed = 100, // 100%
|
.anim_speed = 100, // 100%
|
||||||
.cycle_anims = 0, // Meta.txt
|
.cycle_anims = 0, // Meta.txt
|
||||||
.unlock_anims = false, // OFF
|
.unlock_anims = false, // OFF
|
||||||
.fallback_anim = true, // ON
|
.fallback_anim = true, // ON
|
||||||
.wii_menu = true, // ON
|
.menu_style = MenuStyleWii, // Wii
|
||||||
.lock_on_boot = false, // OFF
|
.lock_on_boot = false, // OFF
|
||||||
.bad_pins_format = false, // OFF
|
.bad_pins_format = false, // OFF
|
||||||
.allow_locked_rpc_commands = false, // OFF
|
.allow_locked_rpc_commands = false, // OFF
|
||||||
@@ -68,8 +68,8 @@ void XTREME_SETTINGS_LOAD() {
|
|||||||
x->fallback_anim = b;
|
x->fallback_anim = b;
|
||||||
}
|
}
|
||||||
flipper_format_rewind(file);
|
flipper_format_rewind(file);
|
||||||
if(flipper_format_read_bool(file, "wii_menu", &b, 1)) {
|
if(flipper_format_read_uint32(file, "menu_style", &u, 1)) {
|
||||||
x->wii_menu = b;
|
x->menu_style = CLAMP(u, MenuStyleCount - 1U, 0U);
|
||||||
}
|
}
|
||||||
flipper_format_rewind(file);
|
flipper_format_rewind(file);
|
||||||
if(flipper_format_read_bool(file, "bad_pins_format", &b, 1)) {
|
if(flipper_format_read_bool(file, "bad_pins_format", &b, 1)) {
|
||||||
@@ -175,12 +175,14 @@ void XTREME_SETTINGS_SAVE() {
|
|||||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||||
FlipperFormat* file = flipper_format_file_alloc(storage);
|
FlipperFormat* file = flipper_format_file_alloc(storage);
|
||||||
if(flipper_format_file_open_always(file, XTREME_SETTINGS_PATH)) {
|
if(flipper_format_file_open_always(file, XTREME_SETTINGS_PATH)) {
|
||||||
|
uint32_t e;
|
||||||
flipper_format_write_string_cstr(file, "asset_pack", x->asset_pack);
|
flipper_format_write_string_cstr(file, "asset_pack", x->asset_pack);
|
||||||
flipper_format_write_uint32(file, "anim_speed", &x->anim_speed, 1);
|
flipper_format_write_uint32(file, "anim_speed", &x->anim_speed, 1);
|
||||||
flipper_format_write_int32(file, "cycle_anims", &x->cycle_anims, 1);
|
flipper_format_write_int32(file, "cycle_anims", &x->cycle_anims, 1);
|
||||||
flipper_format_write_bool(file, "unlock_anims", &x->unlock_anims, 1);
|
flipper_format_write_bool(file, "unlock_anims", &x->unlock_anims, 1);
|
||||||
flipper_format_write_bool(file, "fallback_anim", &x->fallback_anim, 1);
|
flipper_format_write_bool(file, "fallback_anim", &x->fallback_anim, 1);
|
||||||
flipper_format_write_bool(file, "wii_menu", &x->wii_menu, 1);
|
e = x->menu_style;
|
||||||
|
flipper_format_write_uint32(file, "menu_style", &e, 1);
|
||||||
flipper_format_write_bool(file, "bad_pins_format", &x->bad_pins_format, 1);
|
flipper_format_write_bool(file, "bad_pins_format", &x->bad_pins_format, 1);
|
||||||
flipper_format_write_bool(file, "allow_locked_rpc_commands", &x->allow_locked_rpc_commands, 1);
|
flipper_format_write_bool(file, "allow_locked_rpc_commands", &x->allow_locked_rpc_commands, 1);
|
||||||
flipper_format_write_bool(file, "lock_on_boot", &x->lock_on_boot, 1);
|
flipper_format_write_bool(file, "lock_on_boot", &x->lock_on_boot, 1);
|
||||||
@@ -189,7 +191,8 @@ void XTREME_SETTINGS_SAVE() {
|
|||||||
flipper_format_write_bool(file, "lockscreen_date", &x->lockscreen_date, 1);
|
flipper_format_write_bool(file, "lockscreen_date", &x->lockscreen_date, 1);
|
||||||
flipper_format_write_bool(file, "lockscreen_statusbar", &x->lockscreen_statusbar, 1);
|
flipper_format_write_bool(file, "lockscreen_statusbar", &x->lockscreen_statusbar, 1);
|
||||||
flipper_format_write_bool(file, "lockscreen_prompt", &x->lockscreen_prompt, 1);
|
flipper_format_write_bool(file, "lockscreen_prompt", &x->lockscreen_prompt, 1);
|
||||||
flipper_format_write_uint32(file, "battery_icon", &x->battery_icon, 1);
|
e = x->battery_icon;
|
||||||
|
flipper_format_write_uint32(file, "battery_icon", &e, 1);
|
||||||
flipper_format_write_bool(file, "statusbar_clock", &x->statusbar_clock, 1);
|
flipper_format_write_bool(file, "statusbar_clock", &x->statusbar_clock, 1);
|
||||||
flipper_format_write_bool(file, "status_icons", &x->status_icons, 1);
|
flipper_format_write_bool(file, "status_icons", &x->status_icons, 1);
|
||||||
flipper_format_write_bool(file, "bar_borders", &x->bar_borders, 1);
|
flipper_format_write_bool(file, "bar_borders", &x->bar_borders, 1);
|
||||||
|
|||||||
@@ -24,6 +24,12 @@ typedef enum {
|
|||||||
BatteryIconCount,
|
BatteryIconCount,
|
||||||
} BatteryIcon;
|
} BatteryIcon;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
MenuStyleList,
|
||||||
|
MenuStyleWii,
|
||||||
|
MenuStyleCount,
|
||||||
|
} MenuStyle;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
bool is_nsfw; // TODO: replace with packs text support
|
bool is_nsfw; // TODO: replace with packs text support
|
||||||
|
|
||||||
@@ -32,7 +38,7 @@ typedef struct {
|
|||||||
int32_t cycle_anims;
|
int32_t cycle_anims;
|
||||||
bool unlock_anims;
|
bool unlock_anims;
|
||||||
bool fallback_anim;
|
bool fallback_anim;
|
||||||
bool wii_menu;
|
MenuStyle menu_style;
|
||||||
bool lock_on_boot;
|
bool lock_on_boot;
|
||||||
bool bad_pins_format;
|
bool bad_pins_format;
|
||||||
bool allow_locked_rpc_commands;
|
bool allow_locked_rpc_commands;
|
||||||
@@ -41,7 +47,7 @@ typedef struct {
|
|||||||
bool lockscreen_date;
|
bool lockscreen_date;
|
||||||
bool lockscreen_statusbar;
|
bool lockscreen_statusbar;
|
||||||
bool lockscreen_prompt;
|
bool lockscreen_prompt;
|
||||||
uint32_t battery_icon;
|
BatteryIcon battery_icon;
|
||||||
bool statusbar_clock;
|
bool statusbar_clock;
|
||||||
bool status_icons;
|
bool status_icons;
|
||||||
bool bar_borders;
|
bool bar_borders;
|
||||||
|
|||||||
Reference in New Issue
Block a user