mirror of
https://github.com/DarkFlippers/unleashed-firmware
synced 2024-11-10 06:54:19 +00:00
[FL-3897] Happy mode (#3863)
* feat: happy mode * feat: remove sad dolphin when powering off in happy mode * style: address review comments * Dolphin: add missing furi_checks * Komi: add missing region initialization on startup Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
parent
3c75356b49
commit
266d4b3234
23 changed files with 231 additions and 72 deletions
|
@ -47,6 +47,26 @@ void dolphin_deed(DolphinDeed deed) {
|
||||||
furi_record_close(RECORD_DOLPHIN);
|
furi_record_close(RECORD_DOLPHIN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void dolphin_get_settings(Dolphin* dolphin, DolphinSettings* settings) {
|
||||||
|
furi_check(dolphin);
|
||||||
|
furi_check(settings);
|
||||||
|
|
||||||
|
DolphinEvent event;
|
||||||
|
event.type = DolphinEventTypeSettingsGet;
|
||||||
|
event.settings = settings;
|
||||||
|
dolphin_event_send_wait(dolphin, &event);
|
||||||
|
}
|
||||||
|
|
||||||
|
void dolphin_set_settings(Dolphin* dolphin, DolphinSettings* settings) {
|
||||||
|
furi_check(dolphin);
|
||||||
|
furi_check(settings);
|
||||||
|
|
||||||
|
DolphinEvent event;
|
||||||
|
event.type = DolphinEventTypeSettingsSet;
|
||||||
|
event.settings = settings;
|
||||||
|
dolphin_event_send_wait(dolphin, &event);
|
||||||
|
}
|
||||||
|
|
||||||
DolphinStats dolphin_stats(Dolphin* dolphin) {
|
DolphinStats dolphin_stats(Dolphin* dolphin) {
|
||||||
furi_check(dolphin);
|
furi_check(dolphin);
|
||||||
|
|
||||||
|
@ -211,7 +231,9 @@ static bool dolphin_process_event(FuriEventLoopObject* object, void* context) {
|
||||||
|
|
||||||
} else if(event.type == DolphinEventTypeStats) {
|
} else if(event.type == DolphinEventTypeStats) {
|
||||||
event.stats->icounter = dolphin->state->data.icounter;
|
event.stats->icounter = dolphin->state->data.icounter;
|
||||||
event.stats->butthurt = dolphin->state->data.butthurt;
|
event.stats->butthurt = (dolphin->state->data.flags & DolphinFlagHappyMode) ?
|
||||||
|
0 :
|
||||||
|
dolphin->state->data.butthurt;
|
||||||
event.stats->timestamp = dolphin->state->data.timestamp;
|
event.stats->timestamp = dolphin->state->data.timestamp;
|
||||||
event.stats->level = dolphin_get_level(dolphin->state->data.icounter);
|
event.stats->level = dolphin_get_level(dolphin->state->data.icounter);
|
||||||
event.stats->level_up_is_pending =
|
event.stats->level_up_is_pending =
|
||||||
|
@ -228,6 +250,15 @@ static bool dolphin_process_event(FuriEventLoopObject* object, void* context) {
|
||||||
dolphin_state_load(dolphin->state);
|
dolphin_state_load(dolphin->state);
|
||||||
furi_event_loop_timer_start(dolphin->butthurt_timer, BUTTHURT_INCREASE_PERIOD_TICKS);
|
furi_event_loop_timer_start(dolphin->butthurt_timer, BUTTHURT_INCREASE_PERIOD_TICKS);
|
||||||
|
|
||||||
|
} else if(event.type == DolphinEventTypeSettingsGet) {
|
||||||
|
event.settings->happy_mode = dolphin->state->data.flags & DolphinFlagHappyMode;
|
||||||
|
|
||||||
|
} else if(event.type == DolphinEventTypeSettingsSet) {
|
||||||
|
dolphin->state->data.flags &= ~DolphinFlagHappyMode;
|
||||||
|
if(event.settings->happy_mode) dolphin->state->data.flags |= DolphinFlagHappyMode;
|
||||||
|
dolphin->state->dirty = true;
|
||||||
|
dolphin_state_save(dolphin->state);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
furi_crash();
|
furi_crash();
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,10 @@ typedef struct {
|
||||||
bool level_up_is_pending;
|
bool level_up_is_pending;
|
||||||
} DolphinStats;
|
} DolphinStats;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
bool happy_mode;
|
||||||
|
} DolphinSettings;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
DolphinPubsubEventUpdate,
|
DolphinPubsubEventUpdate,
|
||||||
} DolphinPubsubEvent;
|
} DolphinPubsubEvent;
|
||||||
|
@ -31,6 +35,10 @@ typedef enum {
|
||||||
*/
|
*/
|
||||||
void dolphin_deed(DolphinDeed deed);
|
void dolphin_deed(DolphinDeed deed);
|
||||||
|
|
||||||
|
void dolphin_get_settings(Dolphin* dolphin, DolphinSettings* settings);
|
||||||
|
|
||||||
|
void dolphin_set_settings(Dolphin* dolphin, DolphinSettings* settings);
|
||||||
|
|
||||||
/** Retrieve dolphin stats
|
/** Retrieve dolphin stats
|
||||||
* Thread safe, blocking
|
* Thread safe, blocking
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -13,6 +13,8 @@ typedef enum {
|
||||||
DolphinEventTypeFlush,
|
DolphinEventTypeFlush,
|
||||||
DolphinEventTypeLevel,
|
DolphinEventTypeLevel,
|
||||||
DolphinEventTypeReloadState,
|
DolphinEventTypeReloadState,
|
||||||
|
DolphinEventTypeSettingsGet,
|
||||||
|
DolphinEventTypeSettingsSet,
|
||||||
} DolphinEventType;
|
} DolphinEventType;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -21,6 +23,7 @@ typedef struct {
|
||||||
union {
|
union {
|
||||||
DolphinDeed deed;
|
DolphinDeed deed;
|
||||||
DolphinStats* stats;
|
DolphinStats* stats;
|
||||||
|
DolphinSettings* settings;
|
||||||
};
|
};
|
||||||
} DolphinEvent;
|
} DolphinEvent;
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,10 @@
|
||||||
|
|
||||||
#include "dolphin_deed.h"
|
#include "dolphin_deed.h"
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
DolphinFlagHappyMode = 1,
|
||||||
|
} DolphinFlags;
|
||||||
|
|
||||||
typedef struct DolphinState DolphinState;
|
typedef struct DolphinState DolphinState;
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint8_t icounter_daily_limit[DolphinAppMAX];
|
uint8_t icounter_daily_limit[DolphinAppMAX];
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#include <furi.h>
|
#include <furi.h>
|
||||||
#include <gui/modules/popup.h>
|
#include <gui/modules/popup.h>
|
||||||
|
#include <gui/modules/dialog_ex.h>
|
||||||
#include <gui/scene_manager.h>
|
#include <gui/scene_manager.h>
|
||||||
|
|
||||||
#include <desktop/desktop.h>
|
#include <desktop/desktop.h>
|
||||||
|
@ -42,6 +43,7 @@ DesktopSettingsApp* desktop_settings_app_alloc(void) {
|
||||||
app->pin_input_view = desktop_view_pin_input_alloc();
|
app->pin_input_view = desktop_view_pin_input_alloc();
|
||||||
app->pin_setup_howto_view = desktop_settings_view_pin_setup_howto_alloc();
|
app->pin_setup_howto_view = desktop_settings_view_pin_setup_howto_alloc();
|
||||||
app->pin_setup_howto2_view = desktop_settings_view_pin_setup_howto2_alloc();
|
app->pin_setup_howto2_view = desktop_settings_view_pin_setup_howto2_alloc();
|
||||||
|
app->dialog_ex = dialog_ex_alloc();
|
||||||
|
|
||||||
view_dispatcher_add_view(
|
view_dispatcher_add_view(
|
||||||
app->view_dispatcher, DesktopSettingsAppViewMenu, submenu_get_view(app->submenu));
|
app->view_dispatcher, DesktopSettingsAppViewMenu, submenu_get_view(app->submenu));
|
||||||
|
@ -63,6 +65,8 @@ DesktopSettingsApp* desktop_settings_app_alloc(void) {
|
||||||
app->view_dispatcher,
|
app->view_dispatcher,
|
||||||
DesktopSettingsAppViewIdPinSetupHowto2,
|
DesktopSettingsAppViewIdPinSetupHowto2,
|
||||||
desktop_settings_view_pin_setup_howto2_get_view(app->pin_setup_howto2_view));
|
desktop_settings_view_pin_setup_howto2_get_view(app->pin_setup_howto2_view));
|
||||||
|
view_dispatcher_add_view(
|
||||||
|
app->view_dispatcher, DesktopSettingsAppViewDialogEx, dialog_ex_get_view(app->dialog_ex));
|
||||||
return app;
|
return app;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,12 +79,14 @@ void desktop_settings_app_free(DesktopSettingsApp* app) {
|
||||||
view_dispatcher_remove_view(app->view_dispatcher, DesktopSettingsAppViewIdPinInput);
|
view_dispatcher_remove_view(app->view_dispatcher, DesktopSettingsAppViewIdPinInput);
|
||||||
view_dispatcher_remove_view(app->view_dispatcher, DesktopSettingsAppViewIdPinSetupHowto);
|
view_dispatcher_remove_view(app->view_dispatcher, DesktopSettingsAppViewIdPinSetupHowto);
|
||||||
view_dispatcher_remove_view(app->view_dispatcher, DesktopSettingsAppViewIdPinSetupHowto2);
|
view_dispatcher_remove_view(app->view_dispatcher, DesktopSettingsAppViewIdPinSetupHowto2);
|
||||||
|
view_dispatcher_remove_view(app->view_dispatcher, DesktopSettingsAppViewDialogEx);
|
||||||
variable_item_list_free(app->variable_item_list);
|
variable_item_list_free(app->variable_item_list);
|
||||||
submenu_free(app->submenu);
|
submenu_free(app->submenu);
|
||||||
popup_free(app->popup);
|
popup_free(app->popup);
|
||||||
desktop_view_pin_input_free(app->pin_input_view);
|
desktop_view_pin_input_free(app->pin_input_view);
|
||||||
desktop_settings_view_pin_setup_howto_free(app->pin_setup_howto_view);
|
desktop_settings_view_pin_setup_howto_free(app->pin_setup_howto_view);
|
||||||
desktop_settings_view_pin_setup_howto2_free(app->pin_setup_howto2_view);
|
desktop_settings_view_pin_setup_howto2_free(app->pin_setup_howto2_view);
|
||||||
|
dialog_ex_free(app->dialog_ex);
|
||||||
// View dispatcher
|
// View dispatcher
|
||||||
view_dispatcher_free(app->view_dispatcher);
|
view_dispatcher_free(app->view_dispatcher);
|
||||||
scene_manager_free(app->scene_manager);
|
scene_manager_free(app->scene_manager);
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#include <gui/scene_manager.h>
|
#include <gui/scene_manager.h>
|
||||||
#include <gui/modules/submenu.h>
|
#include <gui/modules/submenu.h>
|
||||||
#include <gui/modules/variable_item_list.h>
|
#include <gui/modules/variable_item_list.h>
|
||||||
|
#include <gui/modules/dialog_ex.h>
|
||||||
#include <dialogs/dialogs.h>
|
#include <dialogs/dialogs.h>
|
||||||
#include <assets_icons.h>
|
#include <assets_icons.h>
|
||||||
|
|
||||||
|
@ -21,6 +22,7 @@ typedef enum {
|
||||||
DesktopSettingsAppViewIdPinInput,
|
DesktopSettingsAppViewIdPinInput,
|
||||||
DesktopSettingsAppViewIdPinSetupHowto,
|
DesktopSettingsAppViewIdPinSetupHowto,
|
||||||
DesktopSettingsAppViewIdPinSetupHowto2,
|
DesktopSettingsAppViewIdPinSetupHowto2,
|
||||||
|
DesktopSettingsAppViewDialogEx,
|
||||||
} DesktopSettingsAppView;
|
} DesktopSettingsAppView;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -36,6 +38,7 @@ typedef struct {
|
||||||
DesktopViewPinInput* pin_input_view;
|
DesktopViewPinInput* pin_input_view;
|
||||||
DesktopSettingsViewPinSetupHowto* pin_setup_howto_view;
|
DesktopSettingsViewPinSetupHowto* pin_setup_howto_view;
|
||||||
DesktopSettingsViewPinSetupHowto2* pin_setup_howto2_view;
|
DesktopSettingsViewPinSetupHowto2* pin_setup_howto2_view;
|
||||||
|
DialogEx* dialog_ex;
|
||||||
|
|
||||||
DesktopPinCode pincode_buffer;
|
DesktopPinCode pincode_buffer;
|
||||||
bool pincode_buffer_filled;
|
bool pincode_buffer_filled;
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
// reserve 100 for button presses, submenu selections, etc.
|
||||||
|
DesktopSettingsCustomEventExit = 100,
|
||||||
|
DesktopSettingsCustomEventDone,
|
||||||
|
|
||||||
|
DesktopSettingsCustomEvent1stPinEntered,
|
||||||
|
DesktopSettingsCustomEventPinsEqual,
|
||||||
|
DesktopSettingsCustomEventPinsDifferent,
|
||||||
|
|
||||||
|
DesktopSettingsCustomEventSetPin,
|
||||||
|
DesktopSettingsCustomEventChangePin,
|
||||||
|
DesktopSettingsCustomEventDisablePin,
|
||||||
|
|
||||||
|
DesktopSettingsCustomEventSetDefault,
|
||||||
|
DesktopSettingsCustomEventSetDummy,
|
||||||
|
} DesktopSettingsCustomEvent;
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
|
@ -12,3 +12,5 @@ ADD_SCENE(desktop_settings, pin_setup_done, PinSetupDone)
|
||||||
|
|
||||||
ADD_SCENE(desktop_settings, quick_apps_menu, QuickAppsMenu)
|
ADD_SCENE(desktop_settings, quick_apps_menu, QuickAppsMenu)
|
||||||
ADD_SCENE(desktop_settings, quick_apps_direction_menu, QuickAppsDirectionMenu)
|
ADD_SCENE(desktop_settings, quick_apps_direction_menu, QuickAppsDirectionMenu)
|
||||||
|
|
||||||
|
ADD_SCENE(desktop_settings, happy_mode, HappyMode)
|
||||||
|
|
|
@ -0,0 +1,64 @@
|
||||||
|
#include <furi.h>
|
||||||
|
#include <gui/scene_manager.h>
|
||||||
|
#include <gui/view_dispatcher.h>
|
||||||
|
#include <gui/modules/dialog_ex.h>
|
||||||
|
#include <dolphin/dolphin.h>
|
||||||
|
|
||||||
|
#include "desktop_settings_scene.h"
|
||||||
|
#include "../desktop_settings_app.h"
|
||||||
|
#include "../desktop_settings_custom_event.h"
|
||||||
|
|
||||||
|
static void desktop_settings_scene_happy_mode_done_callback(DialogExResult result, void* context) {
|
||||||
|
DesktopSettingsApp* app = context;
|
||||||
|
DolphinSettings settings;
|
||||||
|
Dolphin* dolphin = furi_record_open(RECORD_DOLPHIN);
|
||||||
|
dolphin_get_settings(dolphin, &settings);
|
||||||
|
settings.happy_mode = (result == DialogExResultRight);
|
||||||
|
dolphin_set_settings(dolphin, &settings);
|
||||||
|
furi_record_close(RECORD_DOLPHIN);
|
||||||
|
view_dispatcher_send_custom_event(app->view_dispatcher, DesktopSettingsCustomEventExit);
|
||||||
|
}
|
||||||
|
|
||||||
|
void desktop_settings_scene_happy_mode_on_enter(void* context) {
|
||||||
|
DesktopSettingsApp* app = context;
|
||||||
|
Dolphin* dolphin = furi_record_open(RECORD_DOLPHIN);
|
||||||
|
DolphinSettings settings;
|
||||||
|
dolphin_get_settings(dolphin, &settings);
|
||||||
|
furi_record_close(RECORD_DOLPHIN);
|
||||||
|
|
||||||
|
dialog_ex_set_header(app->dialog_ex, "Happy Mode", 64, 0, AlignCenter, AlignTop);
|
||||||
|
dialog_ex_set_text(
|
||||||
|
app->dialog_ex,
|
||||||
|
"I will never get angry at you\nfor not spending time with me\nas long as this mode is enabled",
|
||||||
|
64,
|
||||||
|
30,
|
||||||
|
AlignCenter,
|
||||||
|
AlignCenter);
|
||||||
|
dialog_ex_set_left_button_text(app->dialog_ex, settings.happy_mode ? "Disable" : "Go back");
|
||||||
|
dialog_ex_set_right_button_text(
|
||||||
|
app->dialog_ex, settings.happy_mode ? "Keep enabled" : "Enable");
|
||||||
|
dialog_ex_set_result_callback(app->dialog_ex, desktop_settings_scene_happy_mode_done_callback);
|
||||||
|
dialog_ex_set_context(app->dialog_ex, app);
|
||||||
|
view_dispatcher_switch_to_view(app->view_dispatcher, DesktopSettingsAppViewDialogEx);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool desktop_settings_scene_happy_mode_on_event(void* context, SceneManagerEvent event) {
|
||||||
|
DesktopSettingsApp* app = context;
|
||||||
|
bool consumed = false;
|
||||||
|
|
||||||
|
if(event.type == SceneManagerEventTypeCustom) {
|
||||||
|
switch(event.event) {
|
||||||
|
case DesktopSettingsCustomEventExit:
|
||||||
|
scene_manager_previous_scene(app->scene_manager);
|
||||||
|
consumed = true;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
furi_crash();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return consumed;
|
||||||
|
}
|
||||||
|
|
||||||
|
void desktop_settings_scene_happy_mode_on_exit(void* context) {
|
||||||
|
UNUSED(context);
|
||||||
|
}
|
|
@ -3,15 +3,12 @@
|
||||||
#include <gui/scene_manager.h>
|
#include <gui/scene_manager.h>
|
||||||
#include <desktop/helpers/pin_code.h>
|
#include <desktop/helpers/pin_code.h>
|
||||||
#include "../desktop_settings_app.h"
|
#include "../desktop_settings_app.h"
|
||||||
|
#include "../desktop_settings_custom_event.h"
|
||||||
#include <desktop/desktop_settings.h>
|
#include <desktop/desktop_settings.h>
|
||||||
#include <desktop/views/desktop_view_pin_input.h>
|
#include <desktop/views/desktop_view_pin_input.h>
|
||||||
#include "desktop_settings_scene.h"
|
#include "desktop_settings_scene.h"
|
||||||
#include "desktop_settings_scene_i.h"
|
#include "desktop_settings_scene_i.h"
|
||||||
|
|
||||||
#define SCENE_EVENT_EXIT (0U)
|
|
||||||
#define SCENE_EVENT_PINS_EQUAL (1U)
|
|
||||||
#define SCENE_EVENT_PINS_DIFFERENT (2U)
|
|
||||||
|
|
||||||
static void pin_auth_done_callback(const DesktopPinCode* pin_code, void* context) {
|
static void pin_auth_done_callback(const DesktopPinCode* pin_code, void* context) {
|
||||||
furi_assert(pin_code);
|
furi_assert(pin_code);
|
||||||
furi_assert(context);
|
furi_assert(context);
|
||||||
|
@ -20,15 +17,17 @@ static void pin_auth_done_callback(const DesktopPinCode* pin_code, void* context
|
||||||
app->pincode_buffer = *pin_code;
|
app->pincode_buffer = *pin_code;
|
||||||
|
|
||||||
if(desktop_pin_code_check(pin_code)) {
|
if(desktop_pin_code_check(pin_code)) {
|
||||||
view_dispatcher_send_custom_event(app->view_dispatcher, SCENE_EVENT_PINS_EQUAL);
|
view_dispatcher_send_custom_event(
|
||||||
|
app->view_dispatcher, DesktopSettingsCustomEventPinsEqual);
|
||||||
} else {
|
} else {
|
||||||
view_dispatcher_send_custom_event(app->view_dispatcher, SCENE_EVENT_PINS_DIFFERENT);
|
view_dispatcher_send_custom_event(
|
||||||
|
app->view_dispatcher, DesktopSettingsCustomEventPinsDifferent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pin_auth_back_callback(void* context) {
|
static void pin_auth_back_callback(void* context) {
|
||||||
DesktopSettingsApp* app = context;
|
DesktopSettingsApp* app = context;
|
||||||
view_dispatcher_send_custom_event(app->view_dispatcher, SCENE_EVENT_EXIT);
|
view_dispatcher_send_custom_event(app->view_dispatcher, DesktopSettingsCustomEventExit);
|
||||||
}
|
}
|
||||||
|
|
||||||
void desktop_settings_scene_pin_auth_on_enter(void* context) {
|
void desktop_settings_scene_pin_auth_on_enter(void* context) {
|
||||||
|
@ -54,13 +53,13 @@ bool desktop_settings_scene_pin_auth_on_event(void* context, SceneManagerEvent e
|
||||||
|
|
||||||
if(event.type == SceneManagerEventTypeCustom) {
|
if(event.type == SceneManagerEventTypeCustom) {
|
||||||
switch(event.event) {
|
switch(event.event) {
|
||||||
case SCENE_EVENT_PINS_DIFFERENT:
|
case DesktopSettingsCustomEventPinsDifferent:
|
||||||
scene_manager_set_scene_state(
|
scene_manager_set_scene_state(
|
||||||
app->scene_manager, DesktopSettingsAppScenePinError, SCENE_STATE_PIN_ERROR_WRONG);
|
app->scene_manager, DesktopSettingsAppScenePinError, SCENE_STATE_PIN_ERROR_WRONG);
|
||||||
scene_manager_next_scene(app->scene_manager, DesktopSettingsAppScenePinError);
|
scene_manager_next_scene(app->scene_manager, DesktopSettingsAppScenePinError);
|
||||||
consumed = true;
|
consumed = true;
|
||||||
break;
|
break;
|
||||||
case SCENE_EVENT_PINS_EQUAL: {
|
case DesktopSettingsCustomEventPinsEqual: {
|
||||||
uint32_t state =
|
uint32_t state =
|
||||||
scene_manager_get_scene_state(app->scene_manager, DesktopSettingsAppScenePinAuth);
|
scene_manager_get_scene_state(app->scene_manager, DesktopSettingsAppScenePinAuth);
|
||||||
if(state == SCENE_STATE_PIN_AUTH_CHANGE_PIN) {
|
if(state == SCENE_STATE_PIN_AUTH_CHANGE_PIN) {
|
||||||
|
@ -73,7 +72,7 @@ bool desktop_settings_scene_pin_auth_on_event(void* context, SceneManagerEvent e
|
||||||
consumed = true;
|
consumed = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SCENE_EVENT_EXIT:
|
case DesktopSettingsCustomEventExit:
|
||||||
scene_manager_search_and_switch_to_previous_scene(
|
scene_manager_search_and_switch_to_previous_scene(
|
||||||
app->scene_manager, DesktopSettingsAppScenePinMenu);
|
app->scene_manager, DesktopSettingsAppScenePinMenu);
|
||||||
consumed = true;
|
consumed = true;
|
||||||
|
|
|
@ -3,15 +3,14 @@
|
||||||
#include <gui/modules/popup.h>
|
#include <gui/modules/popup.h>
|
||||||
|
|
||||||
#include "../desktop_settings_app.h"
|
#include "../desktop_settings_app.h"
|
||||||
|
#include "../desktop_settings_custom_event.h"
|
||||||
#include <desktop/desktop_settings.h>
|
#include <desktop/desktop_settings.h>
|
||||||
#include "desktop_settings_scene.h"
|
#include "desktop_settings_scene.h"
|
||||||
|
|
||||||
#define SCENE_EVENT_EXIT (0U)
|
|
||||||
|
|
||||||
static void pin_disable_back_callback(void* context) {
|
static void pin_disable_back_callback(void* context) {
|
||||||
furi_assert(context);
|
furi_assert(context);
|
||||||
DesktopSettingsApp* app = context;
|
DesktopSettingsApp* app = context;
|
||||||
view_dispatcher_send_custom_event(app->view_dispatcher, SCENE_EVENT_EXIT);
|
view_dispatcher_send_custom_event(app->view_dispatcher, DesktopSettingsCustomEventExit);
|
||||||
}
|
}
|
||||||
|
|
||||||
void desktop_settings_scene_pin_disable_on_enter(void* context) {
|
void desktop_settings_scene_pin_disable_on_enter(void* context) {
|
||||||
|
@ -35,7 +34,7 @@ bool desktop_settings_scene_pin_disable_on_event(void* context, SceneManagerEven
|
||||||
|
|
||||||
if(event.type == SceneManagerEventTypeCustom) {
|
if(event.type == SceneManagerEventTypeCustom) {
|
||||||
switch(event.event) {
|
switch(event.event) {
|
||||||
case SCENE_EVENT_EXIT:
|
case DesktopSettingsCustomEventExit:
|
||||||
scene_manager_search_and_switch_to_previous_scene(
|
scene_manager_search_and_switch_to_previous_scene(
|
||||||
app->scene_manager, DesktopSettingsAppScenePinMenu);
|
app->scene_manager, DesktopSettingsAppScenePinMenu);
|
||||||
consumed = true;
|
consumed = true;
|
||||||
|
|
|
@ -8,20 +8,19 @@
|
||||||
#include "desktop_settings_scene_i.h"
|
#include "desktop_settings_scene_i.h"
|
||||||
#include <desktop/helpers/pin_code.h>
|
#include <desktop/helpers/pin_code.h>
|
||||||
#include "../desktop_settings_app.h"
|
#include "../desktop_settings_app.h"
|
||||||
|
#include "../desktop_settings_custom_event.h"
|
||||||
#define SCENE_EVENT_EXIT (0U)
|
|
||||||
|
|
||||||
static void pin_error_back_callback(void* context) {
|
static void pin_error_back_callback(void* context) {
|
||||||
furi_assert(context);
|
furi_assert(context);
|
||||||
DesktopSettingsApp* app = context;
|
DesktopSettingsApp* app = context;
|
||||||
view_dispatcher_send_custom_event(app->view_dispatcher, SCENE_EVENT_EXIT);
|
view_dispatcher_send_custom_event(app->view_dispatcher, DesktopSettingsCustomEventExit);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pin_error_done_callback(const DesktopPinCode* pin_code, void* context) {
|
static void pin_error_done_callback(const DesktopPinCode* pin_code, void* context) {
|
||||||
UNUSED(pin_code);
|
UNUSED(pin_code);
|
||||||
furi_assert(context);
|
furi_assert(context);
|
||||||
DesktopSettingsApp* app = context;
|
DesktopSettingsApp* app = context;
|
||||||
view_dispatcher_send_custom_event(app->view_dispatcher, SCENE_EVENT_EXIT);
|
view_dispatcher_send_custom_event(app->view_dispatcher, DesktopSettingsCustomEventExit);
|
||||||
}
|
}
|
||||||
|
|
||||||
void desktop_settings_scene_pin_error_on_enter(void* context) {
|
void desktop_settings_scene_pin_error_on_enter(void* context) {
|
||||||
|
@ -55,7 +54,7 @@ bool desktop_settings_scene_pin_error_on_event(void* context, SceneManagerEvent
|
||||||
|
|
||||||
if(event.type == SceneManagerEventTypeCustom) {
|
if(event.type == SceneManagerEventTypeCustom) {
|
||||||
switch(event.event) {
|
switch(event.event) {
|
||||||
case SCENE_EVENT_EXIT:
|
case DesktopSettingsCustomEventExit:
|
||||||
scene_manager_previous_scene(app->scene_manager);
|
scene_manager_previous_scene(app->scene_manager);
|
||||||
consumed = true;
|
consumed = true;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -4,10 +4,7 @@
|
||||||
#include "../desktop_settings_app.h"
|
#include "../desktop_settings_app.h"
|
||||||
#include "desktop_settings_scene.h"
|
#include "desktop_settings_scene.h"
|
||||||
#include "desktop_settings_scene_i.h"
|
#include "desktop_settings_scene_i.h"
|
||||||
|
#include "../desktop_settings_custom_event.h"
|
||||||
#define SCENE_EVENT_SET_PIN 0
|
|
||||||
#define SCENE_EVENT_CHANGE_PIN 1
|
|
||||||
#define SCENE_EVENT_DISABLE_PIN 2
|
|
||||||
|
|
||||||
static void desktop_settings_scene_pin_menu_submenu_callback(void* context, uint32_t index) {
|
static void desktop_settings_scene_pin_menu_submenu_callback(void* context, uint32_t index) {
|
||||||
DesktopSettingsApp* app = context;
|
DesktopSettingsApp* app = context;
|
||||||
|
@ -23,7 +20,7 @@ void desktop_settings_scene_pin_menu_on_enter(void* context) {
|
||||||
submenu_add_item(
|
submenu_add_item(
|
||||||
submenu,
|
submenu,
|
||||||
"Set PIN",
|
"Set PIN",
|
||||||
SCENE_EVENT_SET_PIN,
|
DesktopSettingsCustomEventSetPin,
|
||||||
desktop_settings_scene_pin_menu_submenu_callback,
|
desktop_settings_scene_pin_menu_submenu_callback,
|
||||||
app);
|
app);
|
||||||
|
|
||||||
|
@ -31,14 +28,14 @@ void desktop_settings_scene_pin_menu_on_enter(void* context) {
|
||||||
submenu_add_item(
|
submenu_add_item(
|
||||||
submenu,
|
submenu,
|
||||||
"Change PIN",
|
"Change PIN",
|
||||||
SCENE_EVENT_CHANGE_PIN,
|
DesktopSettingsCustomEventChangePin,
|
||||||
desktop_settings_scene_pin_menu_submenu_callback,
|
desktop_settings_scene_pin_menu_submenu_callback,
|
||||||
app);
|
app);
|
||||||
|
|
||||||
submenu_add_item(
|
submenu_add_item(
|
||||||
submenu,
|
submenu,
|
||||||
"Remove PIN",
|
"Remove PIN",
|
||||||
SCENE_EVENT_DISABLE_PIN,
|
DesktopSettingsCustomEventDisablePin,
|
||||||
desktop_settings_scene_pin_menu_submenu_callback,
|
desktop_settings_scene_pin_menu_submenu_callback,
|
||||||
app);
|
app);
|
||||||
}
|
}
|
||||||
|
@ -54,11 +51,11 @@ bool desktop_settings_scene_pin_menu_on_event(void* context, SceneManagerEvent e
|
||||||
|
|
||||||
if(event.type == SceneManagerEventTypeCustom) {
|
if(event.type == SceneManagerEventTypeCustom) {
|
||||||
switch(event.event) {
|
switch(event.event) {
|
||||||
case SCENE_EVENT_SET_PIN:
|
case DesktopSettingsCustomEventSetPin:
|
||||||
scene_manager_next_scene(app->scene_manager, DesktopSettingsAppScenePinSetupHowto);
|
scene_manager_next_scene(app->scene_manager, DesktopSettingsAppScenePinSetupHowto);
|
||||||
consumed = true;
|
consumed = true;
|
||||||
break;
|
break;
|
||||||
case SCENE_EVENT_CHANGE_PIN:
|
case DesktopSettingsCustomEventChangePin:
|
||||||
scene_manager_set_scene_state(
|
scene_manager_set_scene_state(
|
||||||
app->scene_manager,
|
app->scene_manager,
|
||||||
DesktopSettingsAppScenePinAuth,
|
DesktopSettingsAppScenePinAuth,
|
||||||
|
@ -66,7 +63,7 @@ bool desktop_settings_scene_pin_menu_on_event(void* context, SceneManagerEvent e
|
||||||
scene_manager_next_scene(app->scene_manager, DesktopSettingsAppScenePinAuth);
|
scene_manager_next_scene(app->scene_manager, DesktopSettingsAppScenePinAuth);
|
||||||
consumed = true;
|
consumed = true;
|
||||||
break;
|
break;
|
||||||
case SCENE_EVENT_DISABLE_PIN:
|
case DesktopSettingsCustomEventDisablePin:
|
||||||
scene_manager_set_scene_state(
|
scene_manager_set_scene_state(
|
||||||
app->scene_manager, DesktopSettingsAppScenePinAuth, SCENE_STATE_PIN_AUTH_DISABLE);
|
app->scene_manager, DesktopSettingsAppScenePinAuth, SCENE_STATE_PIN_AUTH_DISABLE);
|
||||||
scene_manager_next_scene(app->scene_manager, DesktopSettingsAppScenePinAuth);
|
scene_manager_next_scene(app->scene_manager, DesktopSettingsAppScenePinAuth);
|
||||||
|
|
|
@ -8,11 +8,7 @@
|
||||||
#include "desktop_settings_scene.h"
|
#include "desktop_settings_scene.h"
|
||||||
#include "desktop_settings_scene_i.h"
|
#include "desktop_settings_scene_i.h"
|
||||||
#include <desktop/helpers/pin_code.h>
|
#include <desktop/helpers/pin_code.h>
|
||||||
|
#include "../desktop_settings_custom_event.h"
|
||||||
#define SCENE_EVENT_EXIT (0U)
|
|
||||||
#define SCENE_EVENT_1ST_PIN_ENTERED (1U)
|
|
||||||
#define SCENE_EVENT_PINS_EQUAL (2U)
|
|
||||||
#define SCENE_EVENT_PINS_DIFFERENT (3U)
|
|
||||||
|
|
||||||
static void pin_setup_done_callback(const DesktopPinCode* pin_code, void* context) {
|
static void pin_setup_done_callback(const DesktopPinCode* pin_code, void* context) {
|
||||||
furi_assert(pin_code);
|
furi_assert(pin_code);
|
||||||
|
@ -22,20 +18,23 @@ static void pin_setup_done_callback(const DesktopPinCode* pin_code, void* contex
|
||||||
if(!app->pincode_buffer_filled) {
|
if(!app->pincode_buffer_filled) {
|
||||||
app->pincode_buffer = *pin_code;
|
app->pincode_buffer = *pin_code;
|
||||||
app->pincode_buffer_filled = true;
|
app->pincode_buffer_filled = true;
|
||||||
view_dispatcher_send_custom_event(app->view_dispatcher, SCENE_EVENT_1ST_PIN_ENTERED);
|
view_dispatcher_send_custom_event(
|
||||||
|
app->view_dispatcher, DesktopSettingsCustomEvent1stPinEntered);
|
||||||
} else {
|
} else {
|
||||||
app->pincode_buffer_filled = false;
|
app->pincode_buffer_filled = false;
|
||||||
if(desktop_pin_code_is_equal(&app->pincode_buffer, pin_code)) {
|
if(desktop_pin_code_is_equal(&app->pincode_buffer, pin_code)) {
|
||||||
view_dispatcher_send_custom_event(app->view_dispatcher, SCENE_EVENT_PINS_EQUAL);
|
view_dispatcher_send_custom_event(
|
||||||
|
app->view_dispatcher, DesktopSettingsCustomEventPinsEqual);
|
||||||
} else {
|
} else {
|
||||||
view_dispatcher_send_custom_event(app->view_dispatcher, SCENE_EVENT_PINS_DIFFERENT);
|
view_dispatcher_send_custom_event(
|
||||||
|
app->view_dispatcher, DesktopSettingsCustomEventPinsDifferent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pin_setup_back_callback(void* context) {
|
static void pin_setup_back_callback(void* context) {
|
||||||
DesktopSettingsApp* app = context;
|
DesktopSettingsApp* app = context;
|
||||||
view_dispatcher_send_custom_event(app->view_dispatcher, SCENE_EVENT_EXIT);
|
view_dispatcher_send_custom_event(app->view_dispatcher, DesktopSettingsCustomEventExit);
|
||||||
}
|
}
|
||||||
|
|
||||||
void desktop_settings_scene_pin_setup_on_enter(void* context) {
|
void desktop_settings_scene_pin_setup_on_enter(void* context) {
|
||||||
|
@ -60,7 +59,7 @@ bool desktop_settings_scene_pin_setup_on_event(void* context, SceneManagerEvent
|
||||||
|
|
||||||
if(event.type == SceneManagerEventTypeCustom) {
|
if(event.type == SceneManagerEventTypeCustom) {
|
||||||
switch(event.event) {
|
switch(event.event) {
|
||||||
case SCENE_EVENT_1ST_PIN_ENTERED:
|
case DesktopSettingsCustomEvent1stPinEntered:
|
||||||
desktop_view_pin_input_set_label_button(app->pin_input_view, "OK");
|
desktop_view_pin_input_set_label_button(app->pin_input_view, "OK");
|
||||||
desktop_view_pin_input_set_label_primary(app->pin_input_view, 0, 0, NULL);
|
desktop_view_pin_input_set_label_primary(app->pin_input_view, 0, 0, NULL);
|
||||||
desktop_view_pin_input_set_label_secondary(
|
desktop_view_pin_input_set_label_secondary(
|
||||||
|
@ -69,7 +68,7 @@ bool desktop_settings_scene_pin_setup_on_event(void* context, SceneManagerEvent
|
||||||
desktop_view_pin_input_unlock_input(app->pin_input_view);
|
desktop_view_pin_input_unlock_input(app->pin_input_view);
|
||||||
consumed = true;
|
consumed = true;
|
||||||
break;
|
break;
|
||||||
case SCENE_EVENT_PINS_DIFFERENT:
|
case DesktopSettingsCustomEventPinsDifferent:
|
||||||
scene_manager_set_scene_state(
|
scene_manager_set_scene_state(
|
||||||
app->scene_manager,
|
app->scene_manager,
|
||||||
DesktopSettingsAppScenePinError,
|
DesktopSettingsAppScenePinError,
|
||||||
|
@ -77,11 +76,11 @@ bool desktop_settings_scene_pin_setup_on_event(void* context, SceneManagerEvent
|
||||||
scene_manager_next_scene(app->scene_manager, DesktopSettingsAppScenePinError);
|
scene_manager_next_scene(app->scene_manager, DesktopSettingsAppScenePinError);
|
||||||
consumed = true;
|
consumed = true;
|
||||||
break;
|
break;
|
||||||
case SCENE_EVENT_PINS_EQUAL:
|
case DesktopSettingsCustomEventPinsEqual:
|
||||||
scene_manager_next_scene(app->scene_manager, DesktopSettingsAppScenePinSetupHowto2);
|
scene_manager_next_scene(app->scene_manager, DesktopSettingsAppScenePinSetupHowto2);
|
||||||
consumed = true;
|
consumed = true;
|
||||||
break;
|
break;
|
||||||
case SCENE_EVENT_EXIT: {
|
case DesktopSettingsCustomEventExit: {
|
||||||
uint32_t scene_found;
|
uint32_t scene_found;
|
||||||
scene_found = scene_manager_search_and_switch_to_previous_scene(
|
scene_found = scene_manager_search_and_switch_to_previous_scene(
|
||||||
app->scene_manager, DesktopSettingsAppScenePinMenu);
|
app->scene_manager, DesktopSettingsAppScenePinMenu);
|
||||||
|
|
|
@ -5,18 +5,17 @@
|
||||||
#include <gui/view_dispatcher.h>
|
#include <gui/view_dispatcher.h>
|
||||||
|
|
||||||
#include "../desktop_settings_app.h"
|
#include "../desktop_settings_app.h"
|
||||||
|
#include "../desktop_settings_custom_event.h"
|
||||||
#include <desktop/desktop_settings.h>
|
#include <desktop/desktop_settings.h>
|
||||||
#include <desktop/views/desktop_view_pin_input.h>
|
#include <desktop/views/desktop_view_pin_input.h>
|
||||||
#include "desktop_settings_scene.h"
|
#include "desktop_settings_scene.h"
|
||||||
|
|
||||||
#define SCENE_EVENT_DONE (0U)
|
|
||||||
|
|
||||||
static void pin_setup_done_callback(const DesktopPinCode* pin_code, void* context) {
|
static void pin_setup_done_callback(const DesktopPinCode* pin_code, void* context) {
|
||||||
furi_assert(pin_code);
|
furi_assert(pin_code);
|
||||||
furi_assert(context);
|
furi_assert(context);
|
||||||
DesktopSettingsApp* app = context;
|
DesktopSettingsApp* app = context;
|
||||||
|
|
||||||
view_dispatcher_send_custom_event(app->view_dispatcher, SCENE_EVENT_DONE);
|
view_dispatcher_send_custom_event(app->view_dispatcher, DesktopSettingsCustomEventDone);
|
||||||
}
|
}
|
||||||
|
|
||||||
void desktop_settings_scene_pin_setup_done_on_enter(void* context) {
|
void desktop_settings_scene_pin_setup_done_on_enter(void* context) {
|
||||||
|
@ -48,7 +47,7 @@ bool desktop_settings_scene_pin_setup_done_on_event(void* context, SceneManagerE
|
||||||
|
|
||||||
if(event.type == SceneManagerEventTypeCustom) {
|
if(event.type == SceneManagerEventTypeCustom) {
|
||||||
switch(event.event) {
|
switch(event.event) {
|
||||||
case SCENE_EVENT_DONE: {
|
case DesktopSettingsCustomEventDone: {
|
||||||
bool scene_found = false;
|
bool scene_found = false;
|
||||||
scene_found = scene_manager_search_and_switch_to_previous_scene(
|
scene_found = scene_manager_search_and_switch_to_previous_scene(
|
||||||
app->scene_manager, DesktopSettingsAppScenePinMenu);
|
app->scene_manager, DesktopSettingsAppScenePinMenu);
|
||||||
|
|
|
@ -5,12 +5,11 @@
|
||||||
#include "desktop_settings_scene.h"
|
#include "desktop_settings_scene.h"
|
||||||
#include "../desktop_settings_app.h"
|
#include "../desktop_settings_app.h"
|
||||||
#include "../views/desktop_settings_view_pin_setup_howto.h"
|
#include "../views/desktop_settings_view_pin_setup_howto.h"
|
||||||
|
#include "../desktop_settings_custom_event.h"
|
||||||
#define SCENE_EXIT_EVENT (0U)
|
|
||||||
|
|
||||||
static void desktop_settings_scene_pin_lock_done_callback(void* context) {
|
static void desktop_settings_scene_pin_lock_done_callback(void* context) {
|
||||||
DesktopSettingsApp* app = context;
|
DesktopSettingsApp* app = context;
|
||||||
view_dispatcher_send_custom_event(app->view_dispatcher, SCENE_EXIT_EVENT);
|
view_dispatcher_send_custom_event(app->view_dispatcher, DesktopSettingsCustomEventExit);
|
||||||
}
|
}
|
||||||
|
|
||||||
void desktop_settings_scene_pin_setup_howto_on_enter(void* context) {
|
void desktop_settings_scene_pin_setup_howto_on_enter(void* context) {
|
||||||
|
@ -27,7 +26,7 @@ bool desktop_settings_scene_pin_setup_howto_on_event(void* context, SceneManager
|
||||||
|
|
||||||
if(event.type == SceneManagerEventTypeCustom) {
|
if(event.type == SceneManagerEventTypeCustom) {
|
||||||
switch(event.event) {
|
switch(event.event) {
|
||||||
case SCENE_EXIT_EVENT:
|
case DesktopSettingsCustomEventExit:
|
||||||
scene_manager_next_scene(app->scene_manager, DesktopSettingsAppScenePinSetup);
|
scene_manager_next_scene(app->scene_manager, DesktopSettingsAppScenePinSetup);
|
||||||
consumed = true;
|
consumed = true;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -4,18 +4,16 @@
|
||||||
#include "desktop_settings_scene.h"
|
#include "desktop_settings_scene.h"
|
||||||
#include "../desktop_settings_app.h"
|
#include "../desktop_settings_app.h"
|
||||||
#include "../views/desktop_settings_view_pin_setup_howto2.h"
|
#include "../views/desktop_settings_view_pin_setup_howto2.h"
|
||||||
|
#include "../desktop_settings_custom_event.h"
|
||||||
#define SCENE_EXIT_EVENT (0U)
|
|
||||||
#define SCENE_DONE_EVENT (1U)
|
|
||||||
|
|
||||||
static void desktop_settings_scene_pin_setup_howto2_done_callback(void* context) {
|
static void desktop_settings_scene_pin_setup_howto2_done_callback(void* context) {
|
||||||
DesktopSettingsApp* app = context;
|
DesktopSettingsApp* app = context;
|
||||||
view_dispatcher_send_custom_event(app->view_dispatcher, SCENE_DONE_EVENT);
|
view_dispatcher_send_custom_event(app->view_dispatcher, DesktopSettingsCustomEventDone);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void desktop_settings_scene_pin_setup_howto2_exit_callback(void* context) {
|
static void desktop_settings_scene_pin_setup_howto2_exit_callback(void* context) {
|
||||||
DesktopSettingsApp* app = context;
|
DesktopSettingsApp* app = context;
|
||||||
view_dispatcher_send_custom_event(app->view_dispatcher, SCENE_EXIT_EVENT);
|
view_dispatcher_send_custom_event(app->view_dispatcher, DesktopSettingsCustomEventExit);
|
||||||
}
|
}
|
||||||
|
|
||||||
void desktop_settings_scene_pin_setup_howto2_on_enter(void* context) {
|
void desktop_settings_scene_pin_setup_howto2_on_enter(void* context) {
|
||||||
|
@ -35,12 +33,12 @@ bool desktop_settings_scene_pin_setup_howto2_on_event(void* context, SceneManage
|
||||||
|
|
||||||
if(event.type == SceneManagerEventTypeCustom) {
|
if(event.type == SceneManagerEventTypeCustom) {
|
||||||
switch(event.event) {
|
switch(event.event) {
|
||||||
case SCENE_DONE_EVENT: {
|
case DesktopSettingsCustomEventDone: {
|
||||||
scene_manager_next_scene(app->scene_manager, DesktopSettingsAppScenePinSetupDone);
|
scene_manager_next_scene(app->scene_manager, DesktopSettingsAppScenePinSetupDone);
|
||||||
consumed = true;
|
consumed = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SCENE_EXIT_EVENT: {
|
case DesktopSettingsCustomEventExit: {
|
||||||
bool scene_found = false;
|
bool scene_found = false;
|
||||||
scene_found = scene_manager_search_and_switch_to_previous_scene(
|
scene_found = scene_manager_search_and_switch_to_previous_scene(
|
||||||
app->scene_manager, DesktopSettingsAppScenePinMenu);
|
app->scene_manager, DesktopSettingsAppScenePinMenu);
|
||||||
|
|
|
@ -2,12 +2,10 @@
|
||||||
#include <applications.h>
|
#include <applications.h>
|
||||||
|
|
||||||
#include "../desktop_settings_app.h"
|
#include "../desktop_settings_app.h"
|
||||||
|
#include "../desktop_settings_custom_event.h"
|
||||||
#include "desktop_settings_scene.h"
|
#include "desktop_settings_scene.h"
|
||||||
#include "desktop_settings_scene_i.h"
|
#include "desktop_settings_scene_i.h"
|
||||||
|
|
||||||
#define SCENE_EVENT_SET_DEFAULT (0U)
|
|
||||||
#define SCENE_EVENT_SET_DUMMY (1U)
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
desktop_settings_scene_quick_apps_menu_submenu_callback(void* context, uint32_t index) {
|
desktop_settings_scene_quick_apps_menu_submenu_callback(void* context, uint32_t index) {
|
||||||
DesktopSettingsApp* app = context;
|
DesktopSettingsApp* app = context;
|
||||||
|
@ -22,14 +20,14 @@ void desktop_settings_scene_quick_apps_menu_on_enter(void* context) {
|
||||||
submenu_add_item(
|
submenu_add_item(
|
||||||
submenu,
|
submenu,
|
||||||
"Default Mode",
|
"Default Mode",
|
||||||
SCENE_EVENT_SET_DEFAULT,
|
DesktopSettingsCustomEventSetDefault,
|
||||||
desktop_settings_scene_quick_apps_menu_submenu_callback,
|
desktop_settings_scene_quick_apps_menu_submenu_callback,
|
||||||
app);
|
app);
|
||||||
|
|
||||||
submenu_add_item(
|
submenu_add_item(
|
||||||
submenu,
|
submenu,
|
||||||
"Dummy Mode",
|
"Dummy Mode",
|
||||||
SCENE_EVENT_SET_DUMMY,
|
DesktopSettingsCustomEventSetDummy,
|
||||||
desktop_settings_scene_quick_apps_menu_submenu_callback,
|
desktop_settings_scene_quick_apps_menu_submenu_callback,
|
||||||
app);
|
app);
|
||||||
|
|
||||||
|
@ -44,7 +42,7 @@ bool desktop_settings_scene_quick_apps_menu_on_event(void* context, SceneManager
|
||||||
|
|
||||||
if(event.type == SceneManagerEventTypeCustom) {
|
if(event.type == SceneManagerEventTypeCustom) {
|
||||||
switch(event.event) {
|
switch(event.event) {
|
||||||
case SCENE_EVENT_SET_DEFAULT:
|
case DesktopSettingsCustomEventSetDefault:
|
||||||
scene_manager_set_scene_state(
|
scene_manager_set_scene_state(
|
||||||
app->scene_manager,
|
app->scene_manager,
|
||||||
DesktopSettingsAppSceneQuickAppsDirectionMenu,
|
DesktopSettingsAppSceneQuickAppsDirectionMenu,
|
||||||
|
@ -53,7 +51,7 @@ bool desktop_settings_scene_quick_apps_menu_on_event(void* context, SceneManager
|
||||||
app->scene_manager, DesktopSettingsAppSceneQuickAppsDirectionMenu);
|
app->scene_manager, DesktopSettingsAppSceneQuickAppsDirectionMenu);
|
||||||
consumed = true;
|
consumed = true;
|
||||||
break;
|
break;
|
||||||
case SCENE_EVENT_SET_DUMMY:
|
case DesktopSettingsCustomEventSetDummy:
|
||||||
scene_manager_set_scene_state(
|
scene_manager_set_scene_state(
|
||||||
app->scene_manager,
|
app->scene_manager,
|
||||||
DesktopSettingsAppSceneQuickAppsDirectionMenu,
|
DesktopSettingsAppSceneQuickAppsDirectionMenu,
|
||||||
|
|
|
@ -9,6 +9,7 @@ typedef enum {
|
||||||
DesktopSettingsAutoLockDelay,
|
DesktopSettingsAutoLockDelay,
|
||||||
DesktopSettingsClockDisplay,
|
DesktopSettingsClockDisplay,
|
||||||
DesktopSettingsFavoriteApps,
|
DesktopSettingsFavoriteApps,
|
||||||
|
DesktopSettingsHappyMode,
|
||||||
} DesktopSettingsEntry;
|
} DesktopSettingsEntry;
|
||||||
|
|
||||||
#define AUTO_LOCK_DELAY_COUNT 6
|
#define AUTO_LOCK_DELAY_COUNT 6
|
||||||
|
@ -77,7 +78,7 @@ void desktop_settings_scene_start_on_enter(void* context) {
|
||||||
variable_item_list,
|
variable_item_list,
|
||||||
"Show Clock",
|
"Show Clock",
|
||||||
CLOCK_ENABLE_COUNT,
|
CLOCK_ENABLE_COUNT,
|
||||||
desktop_settings_scene_start_clock_enable_changed, //
|
desktop_settings_scene_start_clock_enable_changed,
|
||||||
app);
|
app);
|
||||||
|
|
||||||
value_index =
|
value_index =
|
||||||
|
@ -87,6 +88,8 @@ void desktop_settings_scene_start_on_enter(void* context) {
|
||||||
|
|
||||||
variable_item_list_add(variable_item_list, "Set Quick Access Apps", 1, NULL, NULL);
|
variable_item_list_add(variable_item_list, "Set Quick Access Apps", 1, NULL, NULL);
|
||||||
|
|
||||||
|
variable_item_list_add(variable_item_list, "Happy Mode", 1, NULL, NULL);
|
||||||
|
|
||||||
variable_item_list_set_enter_callback(
|
variable_item_list_set_enter_callback(
|
||||||
variable_item_list, desktop_settings_scene_start_var_list_enter_callback, app);
|
variable_item_list, desktop_settings_scene_start_var_list_enter_callback, app);
|
||||||
|
|
||||||
|
@ -107,6 +110,10 @@ bool desktop_settings_scene_start_on_event(void* context, SceneManagerEvent even
|
||||||
scene_manager_next_scene(app->scene_manager, DesktopSettingsAppSceneQuickAppsMenu);
|
scene_manager_next_scene(app->scene_manager, DesktopSettingsAppSceneQuickAppsMenu);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case DesktopSettingsHappyMode:
|
||||||
|
scene_manager_next_scene(app->scene_manager, DesktopSettingsAppSceneHappyMode);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#include "../power_settings_app.h"
|
#include "../power_settings_app.h"
|
||||||
|
#include <dolphin/dolphin.h>
|
||||||
|
|
||||||
void power_settings_scene_power_off_dialog_callback(DialogExResult result, void* context) {
|
void power_settings_scene_power_off_dialog_callback(DialogExResult result, void* context) {
|
||||||
furi_assert(context);
|
furi_assert(context);
|
||||||
|
@ -9,11 +10,23 @@ void power_settings_scene_power_off_dialog_callback(DialogExResult result, void*
|
||||||
void power_settings_scene_power_off_on_enter(void* context) {
|
void power_settings_scene_power_off_on_enter(void* context) {
|
||||||
PowerSettingsApp* app = context;
|
PowerSettingsApp* app = context;
|
||||||
DialogEx* dialog = app->dialog;
|
DialogEx* dialog = app->dialog;
|
||||||
|
Dolphin* dolphin = furi_record_open(RECORD_DOLPHIN);
|
||||||
|
DolphinSettings settings;
|
||||||
|
dolphin_get_settings(dolphin, &settings);
|
||||||
|
furi_record_close(RECORD_DOLPHIN);
|
||||||
|
|
||||||
dialog_ex_set_header(dialog, "Turn Off Device?", 64, 0, AlignCenter, AlignTop);
|
dialog_ex_set_header(
|
||||||
dialog_ex_set_text(
|
dialog,
|
||||||
dialog, " I will be\nwaiting for\n you here...", 78, 14, AlignLeft, AlignTop);
|
"Turn Off Device?",
|
||||||
dialog_ex_set_icon(dialog, 14, 10, &I_dolph_cry_49x54);
|
64,
|
||||||
|
settings.happy_mode ? 32 : 0,
|
||||||
|
AlignCenter,
|
||||||
|
settings.happy_mode ? AlignCenter : AlignTop);
|
||||||
|
if(!settings.happy_mode) {
|
||||||
|
dialog_ex_set_text(
|
||||||
|
dialog, " I will be\nwaiting for\n you here...", 78, 14, AlignLeft, AlignTop);
|
||||||
|
dialog_ex_set_icon(dialog, 14, 10, &I_dolph_cry_49x54);
|
||||||
|
}
|
||||||
dialog_ex_set_left_button_text(dialog, "Cancel");
|
dialog_ex_set_left_button_text(dialog, "Cancel");
|
||||||
dialog_ex_set_right_button_text(dialog, "Power Off");
|
dialog_ex_set_right_button_text(dialog, "Power Off");
|
||||||
dialog_ex_set_result_callback(dialog, power_settings_scene_power_off_dialog_callback);
|
dialog_ex_set_result_callback(dialog, power_settings_scene_power_off_dialog_callback);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
entry,status,name,type,params
|
entry,status,name,type,params
|
||||||
Version,+,72.3,,
|
Version,+,72.4,,
|
||||||
Header,+,applications/services/bt/bt_service/bt.h,,
|
Header,+,applications/services/bt/bt_service/bt.h,,
|
||||||
Header,+,applications/services/bt/bt_service/bt_keys_storage.h,,
|
Header,+,applications/services/bt/bt_service/bt_keys_storage.h,,
|
||||||
Header,+,applications/services/cli/cli.h,,
|
Header,+,applications/services/cli/cli.h,,
|
||||||
|
@ -869,6 +869,8 @@ Function,+,dolphin_deed_get_app_limit,uint8_t,DolphinApp
|
||||||
Function,+,dolphin_deed_get_weight,uint8_t,DolphinDeed
|
Function,+,dolphin_deed_get_weight,uint8_t,DolphinDeed
|
||||||
Function,+,dolphin_flush,void,Dolphin*
|
Function,+,dolphin_flush,void,Dolphin*
|
||||||
Function,+,dolphin_get_pubsub,FuriPubSub*,Dolphin*
|
Function,+,dolphin_get_pubsub,FuriPubSub*,Dolphin*
|
||||||
|
Function,+,dolphin_get_settings,void,"Dolphin*, DolphinSettings*"
|
||||||
|
Function,+,dolphin_set_settings,void,"Dolphin*, DolphinSettings*"
|
||||||
Function,+,dolphin_stats,DolphinStats,Dolphin*
|
Function,+,dolphin_stats,DolphinStats,Dolphin*
|
||||||
Function,+,dolphin_upgrade_level,void,Dolphin*
|
Function,+,dolphin_upgrade_level,void,Dolphin*
|
||||||
Function,-,dprintf,int,"int, const char*, ..."
|
Function,-,dprintf,int,"int, const char*, ..."
|
||||||
|
|
|
|
@ -40,6 +40,7 @@ void furi_hal_init(void) {
|
||||||
furi_hal_interrupt_init();
|
furi_hal_interrupt_init();
|
||||||
furi_hal_flash_init();
|
furi_hal_flash_init();
|
||||||
furi_hal_resources_init();
|
furi_hal_resources_init();
|
||||||
|
furi_hal_region_init();
|
||||||
furi_hal_spi_config_init();
|
furi_hal_spi_config_init();
|
||||||
furi_hal_spi_dma_init();
|
furi_hal_spi_dma_init();
|
||||||
furi_hal_speaker_init();
|
furi_hal_speaker_init();
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
entry,status,name,type,params
|
entry,status,name,type,params
|
||||||
Version,+,72.3,,
|
Version,+,72.4,,
|
||||||
Header,+,applications/drivers/subghz/cc1101_ext/cc1101_ext_interconnect.h,,
|
Header,+,applications/drivers/subghz/cc1101_ext/cc1101_ext_interconnect.h,,
|
||||||
Header,+,applications/services/bt/bt_service/bt.h,,
|
Header,+,applications/services/bt/bt_service/bt.h,,
|
||||||
Header,+,applications/services/bt/bt_service/bt_keys_storage.h,,
|
Header,+,applications/services/bt/bt_service/bt_keys_storage.h,,
|
||||||
|
@ -956,6 +956,8 @@ Function,+,dolphin_deed_get_app_limit,uint8_t,DolphinApp
|
||||||
Function,+,dolphin_deed_get_weight,uint8_t,DolphinDeed
|
Function,+,dolphin_deed_get_weight,uint8_t,DolphinDeed
|
||||||
Function,+,dolphin_flush,void,Dolphin*
|
Function,+,dolphin_flush,void,Dolphin*
|
||||||
Function,+,dolphin_get_pubsub,FuriPubSub*,Dolphin*
|
Function,+,dolphin_get_pubsub,FuriPubSub*,Dolphin*
|
||||||
|
Function,+,dolphin_get_settings,void,"Dolphin*, DolphinSettings*"
|
||||||
|
Function,+,dolphin_set_settings,void,"Dolphin*, DolphinSettings*"
|
||||||
Function,+,dolphin_stats,DolphinStats,Dolphin*
|
Function,+,dolphin_stats,DolphinStats,Dolphin*
|
||||||
Function,+,dolphin_upgrade_level,void,Dolphin*
|
Function,+,dolphin_upgrade_level,void,Dolphin*
|
||||||
Function,-,dprintf,int,"int, const char*, ..."
|
Function,-,dprintf,int,"int, const char*, ..."
|
||||||
|
|
|
Loading…
Reference in a new issue