Desktop: dummy mode improvements. Fixes: correct scrolling text, correct AM/PM in Clock. (#2160)

* Show passport instead of app if SD/app is missing 
* Desktop: cleanup dummy mode code and add more apps
* Gui: fix incorrect trimming in scrollable text

Signed-off-by: Kowalski Dragon (kowalski7cc) <kowalski7cc@users.noreply.github.com>
Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
Kowalski Dragon
2022-12-20 14:57:58 +01:00
committed by GitHub
parent 797eab8924
commit a9c2b4d6a0
5 changed files with 38 additions and 14 deletions

View File

@@ -12,6 +12,10 @@
#define TAG "DesktopSrv"
#define MUSIC_PLAYER_APP EXT_PATH("/apps/Misc/music_player.fap")
#define SNAKE_GAME_APP EXT_PATH("/apps/Games/snake_game.fap")
#define CLOCK_APP EXT_PATH("/apps/Tools/clock.fap")
static void desktop_scene_main_new_idle_animation_callback(void* context) {
furi_assert(context);
Desktop* desktop = context;
@@ -60,6 +64,19 @@ static void desktop_switch_to_app(Desktop* desktop, const FlipperApplication* fl
}
#endif
static void desktop_scene_main_open_app_or_profile(Desktop* desktop, const char* path) {
do {
LoaderStatus status = loader_start(desktop->loader, FAP_LOADER_APP_NAME, path);
if(status == LoaderStatusOk) break;
FURI_LOG_E(TAG, "loader_start failed: %d", status);
status = loader_start(desktop->loader, "Passport", NULL);
if(status != LoaderStatusOk) {
FURI_LOG_E(TAG, "loader_start failed: %d", status);
}
} while(false);
}
void desktop_scene_main_callback(DesktopEvent event, void* context) {
Desktop* desktop = (Desktop*)context;
view_dispatcher_send_custom_event(desktop->view_dispatcher, event);
@@ -181,12 +198,16 @@ bool desktop_scene_main_on_event(void* context, SceneManagerEvent event) {
}
break;
}
case DesktopMainEventOpenGameMenu: {
LoaderStatus status = loader_start(
desktop->loader, FAP_LOADER_APP_NAME, EXT_PATH("/apps/Games/snake_game.fap"));
if(status != LoaderStatusOk) {
FURI_LOG_E(TAG, "loader_start failed: %d", status);
}
case DesktopMainEventOpenGame: {
desktop_scene_main_open_app_or_profile(desktop, SNAKE_GAME_APP);
break;
}
case DesktopMainEventOpenClock: {
desktop_scene_main_open_app_or_profile(desktop, CLOCK_APP);
break;
}
case DesktopMainEventOpenMusicPlayer: {
desktop_scene_main_open_app_or_profile(desktop, MUSIC_PLAYER_APP);
break;
}
case DesktopLockedEventUpdate: