diff --git a/package.json b/package.json index ad7fa20..f655f19 100644 --- a/package.json +++ b/package.json @@ -44,25 +44,9 @@ "targetPlatforms": [ "basalt", "diorite", + "chalk", "flint", - "emery" - ] - }, - { - "type": "raw", - "name": "PIN_ROUND_JELLYFIN_ICON", - "file": "pin_round_jellyfin.pdc", - "targetPlatforms": [ - "chalk", - "gabbro" - ] - }, - { - "type": "raw", - "name": "PIN_ROUND_PLEX_ICON", - "file": "pin_round_plex.pdc", - "targetPlatforms": [ - "chalk", + "emery", "gabbro" ] } diff --git a/resources/pin_round_jellyfin.pdc b/resources/pin_round_jellyfin.pdc deleted file mode 100644 index b6e4c1f..0000000 Binary files a/resources/pin_round_jellyfin.pdc and /dev/null differ diff --git a/resources/pin_round_plex.pdc b/resources/pin_round_plex.pdc deleted file mode 100644 index f0f67fc..0000000 Binary files a/resources/pin_round_plex.pdc and /dev/null differ diff --git a/src/c/main.c b/src/c/main.c index e879a8c..5d62a90 100644 --- a/src/c/main.c +++ b/src/c/main.c @@ -54,8 +54,30 @@ static void sleep_icon_update_proc(Layer *layer, GContext *ctx) { gdraw_command_image_draw(ctx, s_sleep_icon, GPoint(0, 0)); } +#if PBL_ROUND +static void format_pin_for_round(uint8_t stroke_width) { + GDrawCommandList *command_list = gdraw_command_image_get_command_list(s_pin_icon); + const uint32_t command_count = gdraw_command_list_get_num_commands(command_list); + for (uint32_t i = 0; i < command_count; ++i) { + GDrawCommand *command = gdraw_command_list_get_command(command_list, i); + if (command) { + if (s_is_jellyfin == 1) { + gdraw_command_set_stroke_color(command, GColorPictonBlue); + } else { + gdraw_command_set_stroke_color(command, GColorLightGray); + } + gdraw_command_set_fill_color(command, GColorClear); + gdraw_command_set_stroke_width(command, stroke_width); + } + } +} +#endif + static void pin_icon_update_proc(Layer *layer, GContext *ctx) { graphics_context_set_antialiased(ctx, false); +#if PBL_ROUND + format_pin_for_round(2); +#endif gdraw_command_image_draw(ctx, s_pin_icon, GPoint(0, 0)); } @@ -190,7 +212,6 @@ static void send_pin_to_pkjs() { } static void select_single_click_handler(ClickRecognizerRef recognizer, void *context) { - Window *window = (Window *)context; send_pin_to_pkjs(); } @@ -233,17 +254,11 @@ static void inbox_received_handler(DictionaryIterator *iter, void *context) { persist_write_int(0, 1); s_color_primary = GColorVividViolet; s_color_secondary = GColorPictonBlue; -#if PBL_ROUND - s_pin_icon = gdraw_command_image_create_with_resource(RESOURCE_ID_PIN_ROUND_JELLYFIN_ICON); -#endif } else { s_is_jellyfin = 2; persist_write_int(0, 2); s_color_primary = GColorChromeYellow; s_color_secondary = GColorLightGray; -#if PBL_ROUND - s_pin_icon = gdraw_command_image_create_with_resource(RESOURCE_ID_PIN_ROUND_PLEX_ICON); -#endif } layer_mark_dirty(s_sleep_bar_layer); #if PBL_ROUND @@ -284,21 +299,13 @@ static void init() { case 1: s_color_primary = GColorVividViolet; s_color_secondary = GColorPictonBlue; -#if PBL_ROUND - s_pin_icon = gdraw_command_image_create_with_resource(RESOURCE_ID_PIN_ROUND_JELLYFIN_ICON); -#endif break; case 2: s_color_primary = GColorChromeYellow; s_color_secondary = GColorLightGray; -#if PBL_ROUND - s_pin_icon = gdraw_command_image_create_with_resource(RESOURCE_ID_PIN_ROUND_PLEX_ICON); -#endif break; } -#if PBL_RECT s_pin_icon = gdraw_command_image_create_with_resource(RESOURCE_ID_PIN_ICON); -#endif s_sleep_icon = gdraw_command_image_create_with_resource(RESOURCE_ID_SLEEP_ICON); // initialize pkjs