[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>
This commit is contained in:
Albert Kharisov
2022-01-29 13:20:41 +04:00
committed by GitHub
parent 53e7415d12
commit 84410c83b5
366 changed files with 3646 additions and 1566 deletions

View File

@@ -1,17 +1,14 @@
#include "../desktop_i.h"
#include "../views/desktop_main.h"
#include "applications.h"
#include "assets_icons.h"
#include "cmsis_os2.h"
#include "desktop/desktop.h"
#include "desktop/views/desktop_events.h"
#include "dolphin/dolphin.h"
#include "furi/pubsub.h"
#include "furi/record.h"
#include "furi/thread.h"
#include "storage/storage_glue.h"
#include <furi.h>
#include <furi_hal.h>
#include <applications.h>
#include <assets_icons.h>
#include <loader/loader.h>
#include <m-list.h>
#include "desktop/desktop_i.h"
#include "desktop/views/desktop_main.h"
#include "desktop_scene.h"
#include "desktop_scene_i.h"
#define MAIN_VIEW_DEFAULT (0UL)
static void desktop_scene_main_app_started_callback(const void* message, void* context) {
@@ -81,17 +78,31 @@ void desktop_scene_main_on_enter(void* context) {
desktop->animation_manager, desktop_scene_main_check_animation_callback);
animation_manager_set_interact_callback(
desktop->animation_manager, desktop_scene_main_interact_animation_callback);
desktop_locked_set_callback(desktop->locked_view, desktop_scene_main_callback, desktop);
furi_assert(osSemaphoreGetCount(desktop->unload_animation_semaphore) == 0);
Loader* loader = furi_record_open("loader");
desktop->app_start_stop_subscription = furi_pubsub_subscribe(
loader_get_pubsub(), desktop_scene_main_app_started_callback, desktop);
loader_get_pubsub(loader), desktop_scene_main_app_started_callback, desktop);
furi_record_close("loader");
desktop_main_set_callback(main_view, desktop_scene_main_callback, desktop);
view_port_enabled_set(desktop->lock_viewport, false);
if(scene_manager_get_scene_state(desktop->scene_manager, DesktopSceneMain) ==
DesktopMainEventUnlocked) {
desktop_main_unlocked(desktop->main_view);
DesktopMainSceneState state =
scene_manager_get_scene_state(desktop->scene_manager, DesktopSceneMain);
if(state == DesktopMainSceneStateLockedNoPin) {
desktop_locked_lock(desktop->locked_view);
view_port_enabled_set(desktop->lock_viewport, true);
} else if(state == DesktopMainSceneStateLockedWithPin) {
LOAD_DESKTOP_SETTINGS(&desktop->settings);
furi_assert(desktop->settings.pincode.length > 0);
desktop_locked_lock_pincode(desktop->locked_view, desktop->settings.pincode);
view_port_enabled_set(desktop->lock_viewport, true);
furi_hal_rtc_set_flag(FuriHalRtcFlagLock);
furi_hal_usb_disable();
} else {
furi_assert(state == DesktopMainSceneStateUnlocked);
view_port_enabled_set(desktop->lock_viewport, false);
}
view_dispatcher_switch_to_view(desktop->view_dispatcher, DesktopViewMain);
@@ -120,22 +131,22 @@ bool desktop_scene_main_on_event(void* context, SceneManagerEvent event) {
case DesktopMainEventOpenArchive:
#ifdef APP_ARCHIVE
animation_manager_unload_and_stall_animation(desktop->animation_manager);
desktop_switch_to_app(desktop, &FLIPPER_ARCHIVE);
animation_manager_load_and_continue_animation(desktop->animation_manager);
#endif
consumed = true;
break;
case DesktopMainEventOpenFavorite:
LOAD_DESKTOP_SETTINGS(&desktop->settings);
animation_manager_unload_and_stall_animation(desktop->animation_manager);
if(desktop->settings.favorite < FLIPPER_APPS_COUNT) {
desktop_switch_to_app(desktop, &FLIPPER_APPS[desktop->settings.favorite]);
Loader* loader = furi_record_open("loader");
LoaderStatus status =
loader_start(loader, FLIPPER_APPS[desktop->settings.favorite].name, NULL);
furi_check(status == LoaderStatusOk);
furi_record_close("loader");
} else {
FURI_LOG_E("DesktopSrv", "Can't find favorite application");
}
animation_manager_load_and_continue_animation(desktop->animation_manager);
consumed = true;
break;
@@ -160,6 +171,18 @@ bool desktop_scene_main_on_event(void* context, SceneManagerEvent event) {
animation_manager_load_and_continue_animation(desktop->animation_manager);
consumed = true;
break;
case DesktopMainEventUnlocked:
consumed = true;
furi_hal_rtc_reset_flag(FuriHalRtcFlagLock);
furi_hal_usb_enable();
view_port_enabled_set(desktop->lock_viewport, false);
scene_manager_set_scene_state(
desktop->scene_manager, DesktopSceneMain, DesktopMainSceneStateUnlocked);
break;
case DesktopMainEventUpdate:
desktop_locked_update(desktop->locked_view);
consumed = true;
break;
default:
break;
@@ -177,7 +200,9 @@ void desktop_scene_main_on_exit(void* context) {
* is finished, that's why we can be sure there is no task waiting
* for start/stop semaphore
*/
furi_pubsub_unsubscribe(loader_get_pubsub(), desktop->app_start_stop_subscription);
Loader* loader = furi_record_open("loader");
furi_pubsub_unsubscribe(loader_get_pubsub(loader), desktop->app_start_stop_subscription);
furi_record_close("loader");
furi_assert(osSemaphoreGetCount(desktop->unload_animation_semaphore) == 0);
animation_manager_set_new_idle_callback(desktop->animation_manager, NULL);
@@ -185,5 +210,4 @@ void desktop_scene_main_on_exit(void* context) {
animation_manager_set_interact_callback(desktop->animation_manager, NULL);
animation_manager_set_context(desktop->animation_manager, desktop);
scene_manager_set_scene_state(desktop->scene_manager, DesktopSceneMain, MAIN_VIEW_DEFAULT);
desktop_main_reset_hint(desktop->main_view);
}