[FL-2183] [FL-2209] Dolphin Deeds, Level up, assets generation, refactoring (#965)
* Desktop: cleanup headers
* Get loader pubsub via record
* [FL-2183] Dolphin refactoring 2022.01
* Restruct animations assets structure
* Rename assets
* Cleanup headers
* Update Recording animation
* Add BadBattery animation
* Provide loader's pubsub via record
* Fix load/unload animations
* Scripts: add flipper format support, initial dolphin packager rework. Assets: internal and external dolphin.
* Sync internal meta.txt and manifest.txt
* Reorder, rename dolphin assets
* Split essential generated assets
* Add ReadMe for dolphin assets
* Separate essential blocking animations
* Scripts: full dolphin validation before packaging
* Assets, Scripts: dolphin external resources packer
* Github: update codeowners
* Scripts: proper slots handling in dolphin animation meta
* Scripts: correct frames enumeration and fix compiled assets.
* [FL-2209] Add Dolphin Deeds points and many more
* Remove excess frame_rate
* Change dolphin assets directory
* Scripts: add internal resource support to dolphin compiler
* Scripts: add internal assets generation, renaming
* Scripts: correct assert, renaming
* Code cleanup, documentation, fixes
* Update Levelup animations
* Rename essential -> blocking
* Fix Unlocked hint
* Scripts: rewrite Templite compiller, replace regexps with token parser, split block types into code and variable blocks. Update dolphin templates.
* Documentation: add key combos description and use information
* Scripts: cleanup templit, more debug info and add dev comment
Co-authored-by: あく <alleteam@gmail.com>
2022-01-29 09:20:41 +00:00
|
|
|
#include <storage/storage.h>
|
|
|
|
#include <assets_icons.h>
|
2022-04-14 12:20:41 +00:00
|
|
|
#include <gui/gui.h>
|
[FL-2183] [FL-2209] Dolphin Deeds, Level up, assets generation, refactoring (#965)
* Desktop: cleanup headers
* Get loader pubsub via record
* [FL-2183] Dolphin refactoring 2022.01
* Restruct animations assets structure
* Rename assets
* Cleanup headers
* Update Recording animation
* Add BadBattery animation
* Provide loader's pubsub via record
* Fix load/unload animations
* Scripts: add flipper format support, initial dolphin packager rework. Assets: internal and external dolphin.
* Sync internal meta.txt and manifest.txt
* Reorder, rename dolphin assets
* Split essential generated assets
* Add ReadMe for dolphin assets
* Separate essential blocking animations
* Scripts: full dolphin validation before packaging
* Assets, Scripts: dolphin external resources packer
* Github: update codeowners
* Scripts: proper slots handling in dolphin animation meta
* Scripts: correct frames enumeration and fix compiled assets.
* [FL-2209] Add Dolphin Deeds points and many more
* Remove excess frame_rate
* Change dolphin assets directory
* Scripts: add internal resource support to dolphin compiler
* Scripts: add internal assets generation, renaming
* Scripts: correct assert, renaming
* Code cleanup, documentation, fixes
* Update Levelup animations
* Rename essential -> blocking
* Fix Unlocked hint
* Scripts: rewrite Templite compiller, replace regexps with token parser, split block types into code and variable blocks. Update dolphin templates.
* Documentation: add key combos description and use information
* Scripts: cleanup templit, more debug info and add dev comment
Co-authored-by: あく <alleteam@gmail.com>
2022-01-29 09:20:41 +00:00
|
|
|
#include <gui/view_stack.h>
|
2022-04-14 12:20:41 +00:00
|
|
|
#include <notification/notification.h>
|
|
|
|
#include <notification/notification_messages.h>
|
[FL-2183] [FL-2209] Dolphin Deeds, Level up, assets generation, refactoring (#965)
* Desktop: cleanup headers
* Get loader pubsub via record
* [FL-2183] Dolphin refactoring 2022.01
* Restruct animations assets structure
* Rename assets
* Cleanup headers
* Update Recording animation
* Add BadBattery animation
* Provide loader's pubsub via record
* Fix load/unload animations
* Scripts: add flipper format support, initial dolphin packager rework. Assets: internal and external dolphin.
* Sync internal meta.txt and manifest.txt
* Reorder, rename dolphin assets
* Split essential generated assets
* Add ReadMe for dolphin assets
* Separate essential blocking animations
* Scripts: full dolphin validation before packaging
* Assets, Scripts: dolphin external resources packer
* Github: update codeowners
* Scripts: proper slots handling in dolphin animation meta
* Scripts: correct frames enumeration and fix compiled assets.
* [FL-2209] Add Dolphin Deeds points and many more
* Remove excess frame_rate
* Change dolphin assets directory
* Scripts: add internal resource support to dolphin compiler
* Scripts: add internal assets generation, renaming
* Scripts: correct assert, renaming
* Code cleanup, documentation, fixes
* Update Levelup animations
* Rename essential -> blocking
* Fix Unlocked hint
* Scripts: rewrite Templite compiller, replace regexps with token parser, split block types into code and variable blocks. Update dolphin templates.
* Documentation: add key combos description and use information
* Scripts: cleanup templit, more debug info and add dev comment
Co-authored-by: あく <alleteam@gmail.com>
2022-01-29 09:20:41 +00:00
|
|
|
#include <furi.h>
|
|
|
|
#include <furi_hal.h>
|
2022-02-13 19:24:03 +00:00
|
|
|
|
2022-02-10 18:17:41 +00:00
|
|
|
#include "animations/animation_manager.h"
|
|
|
|
#include "desktop/scenes/desktop_scene.h"
|
|
|
|
#include "desktop/scenes/desktop_scene_i.h"
|
|
|
|
#include "desktop/views/desktop_view_locked.h"
|
|
|
|
#include "desktop/views/desktop_view_pin_input.h"
|
|
|
|
#include "desktop/views/desktop_view_pin_timeout.h"
|
|
|
|
#include "desktop_i.h"
|
2022-04-27 16:30:37 +00:00
|
|
|
#include "helpers/pin_lock.h"
|
2022-02-10 18:17:41 +00:00
|
|
|
|
2022-04-14 12:20:41 +00:00
|
|
|
static void desktop_auto_lock_arm(Desktop*);
|
|
|
|
static void desktop_auto_lock_inhibit(Desktop*);
|
|
|
|
static void desktop_start_auto_lock_timer(Desktop*);
|
|
|
|
|
2022-03-28 13:42:31 +00:00
|
|
|
static void desktop_loader_callback(const void* message, void* context) {
|
|
|
|
furi_assert(context);
|
|
|
|
Desktop* desktop = context;
|
|
|
|
const LoaderEvent* event = message;
|
|
|
|
|
|
|
|
if(event->type == LoaderEventTypeApplicationStarted) {
|
|
|
|
view_dispatcher_send_custom_event(desktop->view_dispatcher, DesktopGlobalBeforeAppStarted);
|
|
|
|
} else if(event->type == LoaderEventTypeApplicationStopped) {
|
|
|
|
view_dispatcher_send_custom_event(desktop->view_dispatcher, DesktopGlobalAfterAppFinished);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-09-28 09:40:39 +00:00
|
|
|
static void desktop_lock_icon_callback(Canvas* canvas, void* context) {
|
|
|
|
furi_assert(canvas);
|
|
|
|
canvas_draw_icon(canvas, 0, 0, &I_Lock_8x8);
|
|
|
|
}
|
|
|
|
|
2022-02-10 18:17:41 +00:00
|
|
|
static bool desktop_custom_event_callback(void* context, uint32_t event) {
|
2021-09-28 09:40:39 +00:00
|
|
|
furi_assert(context);
|
|
|
|
Desktop* desktop = (Desktop*)context;
|
2022-03-28 13:42:31 +00:00
|
|
|
|
|
|
|
switch(event) {
|
|
|
|
case DesktopGlobalBeforeAppStarted:
|
|
|
|
animation_manager_unload_and_stall_animation(desktop->animation_manager);
|
2022-04-14 12:20:41 +00:00
|
|
|
desktop_auto_lock_inhibit(desktop);
|
2022-03-28 13:42:31 +00:00
|
|
|
return true;
|
|
|
|
case DesktopGlobalAfterAppFinished:
|
|
|
|
animation_manager_load_and_continue_animation(desktop->animation_manager);
|
2022-04-14 12:20:41 +00:00
|
|
|
// TODO: Implement a message mechanism for loading settings and (optionally)
|
|
|
|
// locking and unlocking
|
|
|
|
LOAD_DESKTOP_SETTINGS(&desktop->settings);
|
|
|
|
desktop_auto_lock_arm(desktop);
|
|
|
|
return true;
|
|
|
|
case DesktopGlobalAutoLock:
|
|
|
|
if(!loader_is_locked(desktop->loader)) {
|
|
|
|
desktop_lock(desktop);
|
|
|
|
}
|
2022-03-28 13:42:31 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2021-09-28 09:40:39 +00:00
|
|
|
return scene_manager_handle_custom_event(desktop->scene_manager, event);
|
|
|
|
}
|
|
|
|
|
2022-02-10 18:17:41 +00:00
|
|
|
static bool desktop_back_event_callback(void* context) {
|
2021-09-28 09:40:39 +00:00
|
|
|
furi_assert(context);
|
|
|
|
Desktop* desktop = (Desktop*)context;
|
|
|
|
return scene_manager_handle_back_event(desktop->scene_manager);
|
|
|
|
}
|
|
|
|
|
2022-02-10 18:17:41 +00:00
|
|
|
static void desktop_tick_event_callback(void* context) {
|
|
|
|
furi_assert(context);
|
|
|
|
Desktop* app = context;
|
|
|
|
scene_manager_handle_tick_event(app->scene_manager);
|
|
|
|
}
|
|
|
|
|
2022-04-14 12:20:41 +00:00
|
|
|
static void desktop_input_event_callback(const void* value, void* context) {
|
|
|
|
furi_assert(value);
|
|
|
|
furi_assert(context);
|
|
|
|
const InputEvent* event = value;
|
|
|
|
Desktop* desktop = context;
|
|
|
|
if(event->type == InputTypePress) {
|
|
|
|
desktop_start_auto_lock_timer(desktop);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void desktop_auto_lock_timer_callback(void* context) {
|
|
|
|
furi_assert(context);
|
|
|
|
Desktop* desktop = context;
|
|
|
|
view_dispatcher_send_custom_event(desktop->view_dispatcher, DesktopGlobalAutoLock);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void desktop_start_auto_lock_timer(Desktop* desktop) {
|
|
|
|
osTimerStart(
|
|
|
|
desktop->auto_lock_timer, furi_hal_ms_to_ticks(desktop->settings.auto_lock_delay_ms));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void desktop_stop_auto_lock_timer(Desktop* desktop) {
|
|
|
|
osTimerStop(desktop->auto_lock_timer);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void desktop_auto_lock_arm(Desktop* desktop) {
|
|
|
|
if(desktop->settings.auto_lock_delay_ms) {
|
|
|
|
desktop->input_events_subscription = furi_pubsub_subscribe(
|
|
|
|
desktop->input_events_pubsub, desktop_input_event_callback, desktop);
|
|
|
|
desktop_start_auto_lock_timer(desktop);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void desktop_auto_lock_inhibit(Desktop* desktop) {
|
|
|
|
desktop_stop_auto_lock_timer(desktop);
|
|
|
|
if(desktop->input_events_subscription) {
|
|
|
|
furi_pubsub_unsubscribe(desktop->input_events_pubsub, desktop->input_events_subscription);
|
|
|
|
desktop->input_events_subscription = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void desktop_lock(Desktop* desktop) {
|
|
|
|
desktop_auto_lock_inhibit(desktop);
|
|
|
|
scene_manager_set_scene_state(
|
|
|
|
desktop->scene_manager, DesktopSceneLocked, SCENE_LOCKED_FIRST_ENTER);
|
|
|
|
scene_manager_next_scene(desktop->scene_manager, DesktopSceneLocked);
|
|
|
|
notification_message(desktop->notification, &sequence_display_off_delay_1000);
|
|
|
|
}
|
|
|
|
|
|
|
|
void desktop_unlock(Desktop* desktop) {
|
2022-04-27 16:30:37 +00:00
|
|
|
view_port_enabled_set(desktop->lock_viewport, false);
|
|
|
|
Gui* gui = furi_record_open("gui");
|
|
|
|
gui_set_lockdown(gui, false);
|
|
|
|
furi_record_close("gui");
|
2022-04-14 12:20:41 +00:00
|
|
|
desktop_view_locked_unlock(desktop->locked_view);
|
|
|
|
scene_manager_search_and_switch_to_previous_scene(desktop->scene_manager, DesktopSceneMain);
|
|
|
|
desktop_auto_lock_arm(desktop);
|
|
|
|
}
|
|
|
|
|
2021-09-28 09:40:39 +00:00
|
|
|
Desktop* desktop_alloc() {
|
2022-02-18 19:53:46 +00:00
|
|
|
Desktop* desktop = malloc(sizeof(Desktop));
|
2021-09-28 09:40:39 +00:00
|
|
|
|
2022-01-02 21:39:56 +00:00
|
|
|
desktop->animation_manager = animation_manager_alloc();
|
2021-09-28 09:40:39 +00:00
|
|
|
desktop->gui = furi_record_open("gui");
|
|
|
|
desktop->scene_thread = furi_thread_alloc();
|
|
|
|
desktop->view_dispatcher = view_dispatcher_alloc();
|
|
|
|
desktop->scene_manager = scene_manager_alloc(&desktop_scene_handlers, desktop);
|
|
|
|
|
|
|
|
view_dispatcher_enable_queue(desktop->view_dispatcher);
|
|
|
|
view_dispatcher_attach_to_gui(
|
2021-11-24 16:21:12 +00:00
|
|
|
desktop->view_dispatcher, desktop->gui, ViewDispatcherTypeDesktop);
|
2022-02-10 18:17:41 +00:00
|
|
|
view_dispatcher_set_tick_event_callback(
|
|
|
|
desktop->view_dispatcher, desktop_tick_event_callback, 500);
|
2021-09-28 09:40:39 +00:00
|
|
|
|
|
|
|
view_dispatcher_set_event_callback_context(desktop->view_dispatcher, desktop);
|
|
|
|
view_dispatcher_set_custom_event_callback(
|
|
|
|
desktop->view_dispatcher, desktop_custom_event_callback);
|
|
|
|
view_dispatcher_set_navigation_event_callback(
|
|
|
|
desktop->view_dispatcher, desktop_back_event_callback);
|
|
|
|
|
2022-01-02 21:39:56 +00:00
|
|
|
desktop->lock_menu = desktop_lock_menu_alloc();
|
2021-09-28 09:40:39 +00:00
|
|
|
desktop->debug_view = desktop_debug_alloc();
|
|
|
|
desktop->first_start_view = desktop_first_start_alloc();
|
2021-10-04 09:33:31 +00:00
|
|
|
desktop->hw_mismatch_popup = popup_alloc();
|
2022-02-10 18:17:41 +00:00
|
|
|
desktop->locked_view = desktop_view_locked_alloc();
|
|
|
|
desktop->pin_input_view = desktop_view_pin_input_alloc();
|
|
|
|
desktop->pin_timeout_view = desktop_view_pin_timeout_alloc();
|
|
|
|
|
[FL-2183] [FL-2209] Dolphin Deeds, Level up, assets generation, refactoring (#965)
* Desktop: cleanup headers
* Get loader pubsub via record
* [FL-2183] Dolphin refactoring 2022.01
* Restruct animations assets structure
* Rename assets
* Cleanup headers
* Update Recording animation
* Add BadBattery animation
* Provide loader's pubsub via record
* Fix load/unload animations
* Scripts: add flipper format support, initial dolphin packager rework. Assets: internal and external dolphin.
* Sync internal meta.txt and manifest.txt
* Reorder, rename dolphin assets
* Split essential generated assets
* Add ReadMe for dolphin assets
* Separate essential blocking animations
* Scripts: full dolphin validation before packaging
* Assets, Scripts: dolphin external resources packer
* Github: update codeowners
* Scripts: proper slots handling in dolphin animation meta
* Scripts: correct frames enumeration and fix compiled assets.
* [FL-2209] Add Dolphin Deeds points and many more
* Remove excess frame_rate
* Change dolphin assets directory
* Scripts: add internal resource support to dolphin compiler
* Scripts: add internal assets generation, renaming
* Scripts: correct assert, renaming
* Code cleanup, documentation, fixes
* Update Levelup animations
* Rename essential -> blocking
* Fix Unlocked hint
* Scripts: rewrite Templite compiller, replace regexps with token parser, split block types into code and variable blocks. Update dolphin templates.
* Documentation: add key combos description and use information
* Scripts: cleanup templit, more debug info and add dev comment
Co-authored-by: あく <alleteam@gmail.com>
2022-01-29 09:20:41 +00:00
|
|
|
desktop->main_view_stack = view_stack_alloc();
|
|
|
|
desktop->main_view = desktop_main_alloc();
|
|
|
|
View* dolphin_view = animation_manager_get_animation_view(desktop->animation_manager);
|
|
|
|
view_stack_add_view(desktop->main_view_stack, desktop_main_get_view(desktop->main_view));
|
|
|
|
view_stack_add_view(desktop->main_view_stack, dolphin_view);
|
2022-02-10 18:17:41 +00:00
|
|
|
view_stack_add_view(
|
|
|
|
desktop->main_view_stack, desktop_view_locked_get_view(desktop->locked_view));
|
2021-09-28 09:40:39 +00:00
|
|
|
|
2022-02-10 18:17:41 +00:00
|
|
|
/* locked view (as animation view) attends in 2 scenes: main & locked,
|
|
|
|
* because it has to draw "Unlocked" label on main scene */
|
|
|
|
desktop->locked_view_stack = view_stack_alloc();
|
|
|
|
view_stack_add_view(desktop->locked_view_stack, dolphin_view);
|
|
|
|
view_stack_add_view(
|
|
|
|
desktop->locked_view_stack, desktop_view_locked_get_view(desktop->locked_view));
|
|
|
|
|
|
|
|
view_dispatcher_add_view(
|
|
|
|
desktop->view_dispatcher,
|
|
|
|
DesktopViewIdMain,
|
|
|
|
view_stack_get_view(desktop->main_view_stack));
|
2021-09-28 09:40:39 +00:00
|
|
|
view_dispatcher_add_view(
|
2022-02-10 18:17:41 +00:00
|
|
|
desktop->view_dispatcher,
|
|
|
|
DesktopViewIdLocked,
|
|
|
|
view_stack_get_view(desktop->locked_view_stack));
|
2021-09-28 09:40:39 +00:00
|
|
|
view_dispatcher_add_view(
|
|
|
|
desktop->view_dispatcher,
|
2022-02-10 18:17:41 +00:00
|
|
|
DesktopViewIdLockMenu,
|
2021-09-28 09:40:39 +00:00
|
|
|
desktop_lock_menu_get_view(desktop->lock_menu));
|
|
|
|
view_dispatcher_add_view(
|
2022-02-10 18:17:41 +00:00
|
|
|
desktop->view_dispatcher, DesktopViewIdDebug, desktop_debug_get_view(desktop->debug_view));
|
2021-09-28 09:40:39 +00:00
|
|
|
view_dispatcher_add_view(
|
|
|
|
desktop->view_dispatcher,
|
2022-02-10 18:17:41 +00:00
|
|
|
DesktopViewIdFirstStart,
|
2021-09-28 09:40:39 +00:00
|
|
|
desktop_first_start_get_view(desktop->first_start_view));
|
|
|
|
view_dispatcher_add_view(
|
|
|
|
desktop->view_dispatcher,
|
2022-02-10 18:17:41 +00:00
|
|
|
DesktopViewIdHwMismatch,
|
2021-10-04 09:33:31 +00:00
|
|
|
popup_get_view(desktop->hw_mismatch_popup));
|
2021-10-26 18:34:31 +00:00
|
|
|
view_dispatcher_add_view(
|
2022-02-10 18:17:41 +00:00
|
|
|
desktop->view_dispatcher,
|
|
|
|
DesktopViewIdPinTimeout,
|
|
|
|
desktop_view_pin_timeout_get_view(desktop->pin_timeout_view));
|
|
|
|
view_dispatcher_add_view(
|
|
|
|
desktop->view_dispatcher,
|
|
|
|
DesktopViewIdPinInput,
|
|
|
|
desktop_view_pin_input_get_view(desktop->pin_input_view));
|
|
|
|
|
2021-09-28 09:40:39 +00:00
|
|
|
// Lock icon
|
|
|
|
desktop->lock_viewport = view_port_alloc();
|
|
|
|
view_port_set_width(desktop->lock_viewport, icon_get_width(&I_Lock_8x8));
|
|
|
|
view_port_draw_callback_set(desktop->lock_viewport, desktop_lock_icon_callback, desktop);
|
|
|
|
view_port_enabled_set(desktop->lock_viewport, false);
|
|
|
|
gui_add_view_port(desktop->gui, desktop->lock_viewport, GuiLayerStatusBarLeft);
|
|
|
|
|
2022-02-13 19:24:03 +00:00
|
|
|
// Special case: autostart application is already running
|
2022-03-28 13:42:31 +00:00
|
|
|
desktop->loader = furi_record_open("loader");
|
|
|
|
if(loader_is_locked(desktop->loader) &&
|
2022-02-13 19:24:03 +00:00
|
|
|
animation_manager_is_animation_loaded(desktop->animation_manager)) {
|
|
|
|
animation_manager_unload_and_stall_animation(desktop->animation_manager);
|
|
|
|
}
|
2022-04-14 12:20:41 +00:00
|
|
|
|
|
|
|
desktop->notification = furi_record_open("notification");
|
2022-03-28 13:42:31 +00:00
|
|
|
desktop->app_start_stop_subscription = furi_pubsub_subscribe(
|
|
|
|
loader_get_pubsub(desktop->loader), desktop_loader_callback, desktop);
|
2022-02-13 19:24:03 +00:00
|
|
|
|
2022-04-14 12:20:41 +00:00
|
|
|
desktop->input_events_pubsub = furi_record_open("input_events");
|
|
|
|
desktop->input_events_subscription = NULL;
|
|
|
|
|
|
|
|
desktop->auto_lock_timer =
|
|
|
|
osTimerNew(desktop_auto_lock_timer_callback, osTimerOnce, desktop, NULL);
|
|
|
|
|
2021-09-28 09:40:39 +00:00
|
|
|
return desktop;
|
|
|
|
}
|
|
|
|
|
|
|
|
void desktop_free(Desktop* desktop) {
|
|
|
|
furi_assert(desktop);
|
|
|
|
|
2022-03-28 13:42:31 +00:00
|
|
|
furi_pubsub_unsubscribe(
|
|
|
|
loader_get_pubsub(desktop->loader), desktop->app_start_stop_subscription);
|
2022-04-14 12:20:41 +00:00
|
|
|
|
|
|
|
if(desktop->input_events_subscription) {
|
|
|
|
furi_pubsub_unsubscribe(desktop->input_events_pubsub, desktop->input_events_subscription);
|
|
|
|
desktop->input_events_subscription = NULL;
|
|
|
|
}
|
|
|
|
|
2022-03-28 13:42:31 +00:00
|
|
|
desktop->loader = NULL;
|
2022-04-14 12:20:41 +00:00
|
|
|
desktop->input_events_pubsub = NULL;
|
2022-03-28 13:42:31 +00:00
|
|
|
furi_record_close("loader");
|
2022-04-14 12:20:41 +00:00
|
|
|
furi_record_close("notification");
|
|
|
|
furi_record_close("input_events");
|
2022-03-28 13:42:31 +00:00
|
|
|
|
2022-02-10 18:17:41 +00:00
|
|
|
view_dispatcher_remove_view(desktop->view_dispatcher, DesktopViewIdMain);
|
|
|
|
view_dispatcher_remove_view(desktop->view_dispatcher, DesktopViewIdLockMenu);
|
|
|
|
view_dispatcher_remove_view(desktop->view_dispatcher, DesktopViewIdLocked);
|
|
|
|
view_dispatcher_remove_view(desktop->view_dispatcher, DesktopViewIdDebug);
|
|
|
|
view_dispatcher_remove_view(desktop->view_dispatcher, DesktopViewIdFirstStart);
|
|
|
|
view_dispatcher_remove_view(desktop->view_dispatcher, DesktopViewIdHwMismatch);
|
|
|
|
view_dispatcher_remove_view(desktop->view_dispatcher, DesktopViewIdPinInput);
|
|
|
|
view_dispatcher_remove_view(desktop->view_dispatcher, DesktopViewIdPinTimeout);
|
2021-09-28 09:40:39 +00:00
|
|
|
|
|
|
|
view_dispatcher_free(desktop->view_dispatcher);
|
|
|
|
scene_manager_free(desktop->scene_manager);
|
|
|
|
|
2022-01-02 21:39:56 +00:00
|
|
|
animation_manager_free(desktop->animation_manager);
|
[FL-2183] [FL-2209] Dolphin Deeds, Level up, assets generation, refactoring (#965)
* Desktop: cleanup headers
* Get loader pubsub via record
* [FL-2183] Dolphin refactoring 2022.01
* Restruct animations assets structure
* Rename assets
* Cleanup headers
* Update Recording animation
* Add BadBattery animation
* Provide loader's pubsub via record
* Fix load/unload animations
* Scripts: add flipper format support, initial dolphin packager rework. Assets: internal and external dolphin.
* Sync internal meta.txt and manifest.txt
* Reorder, rename dolphin assets
* Split essential generated assets
* Add ReadMe for dolphin assets
* Separate essential blocking animations
* Scripts: full dolphin validation before packaging
* Assets, Scripts: dolphin external resources packer
* Github: update codeowners
* Scripts: proper slots handling in dolphin animation meta
* Scripts: correct frames enumeration and fix compiled assets.
* [FL-2209] Add Dolphin Deeds points and many more
* Remove excess frame_rate
* Change dolphin assets directory
* Scripts: add internal resource support to dolphin compiler
* Scripts: add internal assets generation, renaming
* Scripts: correct assert, renaming
* Code cleanup, documentation, fixes
* Update Levelup animations
* Rename essential -> blocking
* Fix Unlocked hint
* Scripts: rewrite Templite compiller, replace regexps with token parser, split block types into code and variable blocks. Update dolphin templates.
* Documentation: add key combos description and use information
* Scripts: cleanup templit, more debug info and add dev comment
Co-authored-by: あく <alleteam@gmail.com>
2022-01-29 09:20:41 +00:00
|
|
|
view_stack_free(desktop->main_view_stack);
|
2021-09-28 09:40:39 +00:00
|
|
|
desktop_main_free(desktop->main_view);
|
2022-02-10 18:17:41 +00:00
|
|
|
view_stack_free(desktop->locked_view_stack);
|
|
|
|
desktop_view_locked_free(desktop->locked_view);
|
2021-09-28 09:40:39 +00:00
|
|
|
desktop_lock_menu_free(desktop->lock_menu);
|
2022-02-10 18:17:41 +00:00
|
|
|
desktop_view_locked_free(desktop->locked_view);
|
2021-09-28 09:40:39 +00:00
|
|
|
desktop_debug_free(desktop->debug_view);
|
|
|
|
desktop_first_start_free(desktop->first_start_view);
|
2021-10-04 09:33:31 +00:00
|
|
|
popup_free(desktop->hw_mismatch_popup);
|
2022-02-10 18:17:41 +00:00
|
|
|
desktop_view_pin_timeout_free(desktop->pin_timeout_view);
|
2021-09-28 09:40:39 +00:00
|
|
|
|
|
|
|
furi_record_close("gui");
|
|
|
|
desktop->gui = NULL;
|
|
|
|
|
|
|
|
furi_thread_free(desktop->scene_thread);
|
|
|
|
|
|
|
|
furi_record_close("menu");
|
|
|
|
|
2022-04-14 12:20:41 +00:00
|
|
|
osTimerDelete(desktop->auto_lock_timer);
|
|
|
|
|
2021-09-28 09:40:39 +00:00
|
|
|
free(desktop);
|
|
|
|
}
|
|
|
|
|
2021-09-28 14:42:52 +00:00
|
|
|
static bool desktop_is_first_start() {
|
|
|
|
Storage* storage = furi_record_open("storage");
|
|
|
|
bool exists = storage_common_stat(storage, "/int/first_start", NULL) == FSE_OK;
|
|
|
|
furi_record_close("storage");
|
|
|
|
|
|
|
|
return exists;
|
|
|
|
}
|
|
|
|
|
2021-09-28 09:40:39 +00:00
|
|
|
int32_t desktop_srv(void* p) {
|
|
|
|
Desktop* desktop = desktop_alloc();
|
2021-11-24 16:21:12 +00:00
|
|
|
|
2021-11-03 17:22:49 +00:00
|
|
|
bool loaded = LOAD_DESKTOP_SETTINGS(&desktop->settings);
|
|
|
|
if(!loaded) {
|
|
|
|
memset(&desktop->settings, 0, sizeof(desktop->settings));
|
2021-11-04 17:26:41 +00:00
|
|
|
SAVE_DESKTOP_SETTINGS(&desktop->settings);
|
2021-11-03 17:22:49 +00:00
|
|
|
}
|
2021-09-28 09:40:39 +00:00
|
|
|
|
2022-02-10 18:17:41 +00:00
|
|
|
scene_manager_next_scene(desktop->scene_manager, DesktopSceneMain);
|
|
|
|
|
2022-04-27 16:30:37 +00:00
|
|
|
desktop_pin_lock_init(&desktop->settings);
|
2022-04-14 12:20:41 +00:00
|
|
|
|
2022-04-27 16:30:37 +00:00
|
|
|
if(!desktop_pin_lock_is_locked()) {
|
2022-04-14 12:20:41 +00:00
|
|
|
if(!loader_is_locked(desktop->loader)) {
|
|
|
|
desktop_auto_lock_arm(desktop);
|
2022-02-10 18:17:41 +00:00
|
|
|
}
|
2022-04-14 12:20:41 +00:00
|
|
|
} else {
|
|
|
|
desktop_lock(desktop);
|
2021-11-03 17:22:49 +00:00
|
|
|
}
|
|
|
|
|
2021-09-28 14:42:52 +00:00
|
|
|
if(desktop_is_first_start()) {
|
2021-09-28 09:40:39 +00:00
|
|
|
scene_manager_next_scene(desktop->scene_manager, DesktopSceneFirstStart);
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!furi_hal_version_do_i_belong_here()) {
|
|
|
|
scene_manager_next_scene(desktop->scene_manager, DesktopSceneHwMismatch);
|
|
|
|
}
|
|
|
|
|
2021-12-31 17:32:49 +00:00
|
|
|
if(furi_hal_rtc_get_fault_data()) {
|
|
|
|
scene_manager_next_scene(desktop->scene_manager, DesktopSceneFault);
|
|
|
|
}
|
|
|
|
|
2021-09-28 09:40:39 +00:00
|
|
|
view_dispatcher_run(desktop->view_dispatcher);
|
|
|
|
desktop_free(desktop);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|