Add helptext for unconfigured app

This commit is contained in:
2026-04-26 14:53:31 -04:00
parent 3d0abe4b57
commit 3058d4f968

View File

@@ -3,11 +3,13 @@
#include <string.h> #include <string.h>
// declare settings-derived statics // declare settings-derived statics
static uint8_t s_is_jellyfin;
static GColor s_color_primary = GColorWhite; static GColor s_color_primary = GColorWhite;
static GColor s_color_secondary = GColorWhite; static GColor s_color_secondary = GColorWhite;
// declare window statics // declare window statics
static Window *s_main_window; static Window *s_main_window;
static TextLayer *s_config_app_layer;
static TextLayer *s_sleep_time_layer; static TextLayer *s_sleep_time_layer;
static TextLayer *s_last_watched_layer; static TextLayer *s_last_watched_layer;
static Layer *s_button_bar_layer; static Layer *s_button_bar_layer;
@@ -146,7 +148,20 @@ static void main_window_load(Window *window) {
// sleep bar and icon // sleep bar and icon
s_sleep_bar_layer = layer_create(s_sleep_bar_start); s_sleep_bar_layer = layer_create(s_sleep_bar_start);
s_sleep_icon_layer = layer_create(s_sleep_icon_start); s_sleep_icon_layer = layer_create(s_sleep_icon_start);
if (s_is_jellyfin > 0) { // display help instead of sleep icon if app is unconfigured
layer_set_update_proc(s_sleep_icon_layer, sleep_icon_update_proc); layer_set_update_proc(s_sleep_icon_layer, sleep_icon_update_proc);
} else {
#if PBL_DISPLAY_WIDTH >= 200
s_config_app_layer = text_layer_create(GRect(4, (PBL_DISPLAY_HEIGHT / 2) - PBL_IF_ROUND_ELSE(33, 49), PBL_DISPLAY_WIDTH - 8, PBL_DISPLAY_HEIGHT));
text_layer_set_font(s_config_app_layer, fonts_get_system_font(FONT_KEY_GOTHIC_28_BOLD));
#else
s_config_app_layer = text_layer_create(GRect(4, (PBL_DISPLAY_HEIGHT / 2) - PBL_IF_ROUND_ELSE(43, 32), PBL_DISPLAY_WIDTH - 8, PBL_DISPLAY_HEIGHT));
text_layer_set_font(s_config_app_layer, fonts_get_system_font(PBL_IF_ROUND_ELSE(FONT_KEY_GOTHIC_24_BOLD, FONT_KEY_GOTHIC_18_BOLD)));
#endif
text_layer_set_text(s_config_app_layer, "Please configure the app's settings from your phone");
text_layer_set_text_alignment(s_config_app_layer, GTextAlignmentCenter);
}
// pin icon // pin icon
s_pin_icon_layer = layer_create(GRect(PBL_DISPLAY_WIDTH - PBL_IF_ROUND_ELSE(27, 25), (PBL_DISPLAY_HEIGHT / 2) - 13, 25, 25)); s_pin_icon_layer = layer_create(GRect(PBL_DISPLAY_WIDTH - PBL_IF_ROUND_ELSE(27, 25), (PBL_DISPLAY_HEIGHT / 2) - 13, 25, 25));
@@ -205,6 +220,9 @@ static void main_window_load(Window *window) {
layer_add_child(window_layer, s_sleep_bar_layer); layer_add_child(window_layer, s_sleep_bar_layer);
layer_add_child(window_layer, s_sleep_icon_layer); layer_add_child(window_layer, s_sleep_icon_layer);
layer_add_child(window_layer, text_layer_get_layer(s_sleep_time_layer)); layer_add_child(window_layer, text_layer_get_layer(s_sleep_time_layer));
if (s_is_jellyfin == 0) {
layer_add_child(window_layer, text_layer_get_layer(s_config_app_layer));
}
} }
static void main_window_unload(Window *window) { static void main_window_unload(Window *window) {
@@ -226,10 +244,8 @@ static void init() {
// set colors if is_jellyfin is locally set; // set colors if is_jellyfin is locally set;
// if it has not yet been set, it will be once // if it has not yet been set, it will be once
// the user saves their settings // the user saves their settings
// TODO check if it is unset (0) and prompt user s_is_jellyfin = persist_read_int(0);
// to configure the app!! switch (s_is_jellyfin) {
uint8_t is_jellyfin = persist_read_int(0);
switch (is_jellyfin) {
case 1: case 1:
s_color_primary = GColorVividViolet; s_color_primary = GColorVividViolet;
s_color_secondary = GColorPictonBlue; s_color_secondary = GColorPictonBlue;