Skip to content

Commit e273b29

Browse files
committed
fw/shell/normal: launch 2-Clicks UI from watchface app
Signed-off-by: Paul Chanvin paul@paulchanvin.fr
1 parent 9c78cf0 commit e273b29

2 files changed

Lines changed: 36 additions & 1 deletion

File tree

src/fw/shell/normal/system_app_registry_list.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,11 @@
8686
"enum": "TIMELINE",
8787
"md_fn": "timeline_get_app_info"
8888
},
89+
{
90+
"id": -11,
91+
"enum": "TWO_CLICKS",
92+
"md_fn": "two_clicks_launcher_get_app_info"
93+
},
8994
{
9095
"id": -12,
9196
"enum": "BOUNCING_BOX_DEMO",

src/fw/shell/normal/watchface.c

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include "apps/system/settings/quick_launch_app_menu.h"
1010
#include "apps/system/settings/quick_launch_setup_menu.h"
1111
#include "apps/system/timeline/timeline.h"
12+
#include "apps/system/two_clicks_launcher.h"
1213
#include "apps/watch/low_power/face.h"
1314
#include "kernel/event_loop.h"
1415
#include "kernel/low_power.h"
@@ -104,6 +105,20 @@ static void prv_quick_launch_handler(ClickRecognizerRef recognizer, void *data)
104105
return;
105106
}
106107
AppInstallId app_id = quick_launch_get_app(button);
108+
//check if quick launch app is 2-clicks
109+
if (app_id == APP_ID_TWO_CLICKS) {
110+
static TwoClicksArgs s_twoclicks_args = {
111+
.is_tap = false,
112+
.vibe_on_start = true
113+
};
114+
s_twoclicks_args.first_button = button;
115+
prv_launch_app_via_button(&(AppLaunchEventConfig) {
116+
.id = APP_ID_TWO_CLICKS,
117+
.common.reason = APP_LAUNCH_QUICK_LAUNCH,
118+
.common.args = &s_twoclicks_args,
119+
}, recognizer);
120+
return;
121+
}
107122
if (app_id == INSTALL_ID_INVALID) {
108123
app_id = app_install_get_id_for_uuid(&quick_launch_setup_get_app_info()->uuid);
109124
}
@@ -122,6 +137,21 @@ static void prv_launch_up_down(ClickRecognizerRef recognizer, void *data) {
122137
}
123138

124139
if (!quick_launch_single_click_is_enabled(button)) return;
140+
141+
//check if quick launch app is 2-clicks
142+
if (quick_launch_single_click_get_app(button) == APP_ID_TWO_CLICKS) {
143+
static TwoClicksArgs s_twoclicks_args = {
144+
.is_tap = true,
145+
.vibe_on_start = false,
146+
};
147+
s_twoclicks_args.first_button = button;
148+
prv_launch_app_via_button(&(AppLaunchEventConfig) {
149+
.id = APP_ID_TWO_CLICKS,
150+
.common.reason = APP_LAUNCH_QUICK_LAUNCH,
151+
.common.args = &s_twoclicks_args,
152+
}, recognizer);
153+
return;
154+
}
125155
//check if quick launch app is not timeline
126156
if (quick_launch_single_click_get_app(button) != APP_ID_TIMELINE) {
127157
//launch other quick launch apps
@@ -133,7 +163,7 @@ static void prv_launch_up_down(ClickRecognizerRef recognizer, void *data) {
133163
}
134164

135165
static TimelineArgs s_timeline_args;
136-
const bool is_up = (click_recognizer_get_button_id(recognizer) == BUTTON_ID_UP);
166+
const bool is_up = (button == BUTTON_ID_UP);
137167
if (is_up) {
138168
PBL_LOG_DBG("Launching timeline in past mode.");
139169
s_timeline_args.direction = TimelineIterDirectionPast;

0 commit comments

Comments
 (0)