mirror of
https://git.wetfence.xyz/RandyTheSilly/jellyPod.git
synced 2026-10-26 23:39:56 -04:00
Add on-watch artist listing
This commit is contained in:
1 parent
03bf39227c
commit
5507ef52ea
3 files changed
+68
-34
No files matched your search
+25
-16
@@ -53,27 +53,31 @@ static void inbox_received_handler(DictionaryIterator *iter, void *context) {
|
||||
Tuple *t_ready = dict_find(iter, MESSAGE_KEY_PKJS_READY);
|
||||
if (t_ready) {
|
||||
s_pkjs_ready = true;
|
||||
APP_LOG(APP_LOG_LEVEL_DEBUG, "PKJS READY RECEIVED");
|
||||
return;
|
||||
}
|
||||
|
||||
// handle incoming menu list items
|
||||
for (uint16_t i = 0; i < MAX_MENU_ITEMS; i++) {
|
||||
Tuple *t_vanity = dict_find(iter, MESSAGE_KEY_IN_VANITY_LIST + i);
|
||||
if (t_vanity) {
|
||||
s_current_menu_vanity[i] = t_vanity->value->cstring;
|
||||
} else {
|
||||
s_menu_items_count = i;
|
||||
break;
|
||||
Tuple *t_new_scope = dict_find(iter, MESSAGE_KEY_BIDIR_MENU_NAV_SCOPE);
|
||||
if (t_new_scope) {
|
||||
for (uint16_t i = 0; i < MAX_MENU_ITEMS; i++) {
|
||||
Tuple *t_vanity = dict_find(iter, MESSAGE_KEY_IN_VANITY_LIST + i);
|
||||
if (t_vanity) {
|
||||
s_current_menu_vanity[i] = t_vanity->value->cstring;
|
||||
} else {
|
||||
s_menu_items_count = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
s_current_menu_scope = t_new_scope->value->uint8;
|
||||
menu_layer_reload_data(s_menu_layer);
|
||||
menu_layer_set_selected_index(s_menu_layer, MenuIndex(0, 0), MenuRowAlignTop, false);
|
||||
return;
|
||||
}
|
||||
s_current_menu_scope = NAV_SCOPE_SEARCH;
|
||||
menu_layer_reload_data(s_menu_layer);
|
||||
menu_layer_set_selected_index(s_menu_layer, MenuIndex(0, 0), MenuRowAlignTop, false);
|
||||
return;
|
||||
}
|
||||
|
||||
// request a new menu scope from the PKJS side
|
||||
static void to_pkjs_scope_change(NavScope scope) {
|
||||
static void to_pkjs_scope_change(NavScope scope, uint16_t *subscope_index) {
|
||||
if (!s_pkjs_ready) {
|
||||
return;
|
||||
}
|
||||
@@ -83,7 +87,10 @@ static void to_pkjs_scope_change(NavScope scope) {
|
||||
if (result != APP_MSG_OK) {
|
||||
return;
|
||||
}
|
||||
dict_write_uint8(out, MESSAGE_KEY_OUT_MENU_NAV_SCOPE, scope);
|
||||
if (subscope_index) {
|
||||
dict_write_cstring(out, MESSAGE_KEY_OUT_MENU_NAV_SUBSCOPE, s_current_menu_vanity[*subscope_index]);
|
||||
}
|
||||
dict_write_uint8(out, MESSAGE_KEY_BIDIR_MENU_NAV_SCOPE, scope);
|
||||
|
||||
result = app_message_outbox_send();
|
||||
if (result != APP_MSG_OK) {
|
||||
@@ -119,13 +126,15 @@ static void menu_select_click(struct MenuLayer *menu_layer, MenuIndex *clicked_i
|
||||
case 1:
|
||||
break;
|
||||
case 2:
|
||||
to_pkjs_scope_change(NAV_SCOPE_ARTISTS);
|
||||
to_pkjs_scope_change(NAV_SCOPE_ARTISTS, NULL);
|
||||
break;
|
||||
default:
|
||||
to_pkjs_scope_change(NAV_SCOPE_SEARCH);
|
||||
to_pkjs_scope_change(NAV_SCOPE_SEARCH, NULL);
|
||||
}
|
||||
return;
|
||||
case NAV_SCOPE_SEARCH:
|
||||
to_pkjs_scope_change(NAV_SCOPE_ARTISTS, &clicked_index->row);
|
||||
break;
|
||||
case NAV_SCOPE_ARTISTS:
|
||||
case NAV_SCOPE_ALBUMS:
|
||||
case NAV_SCOPE_ALBUM_TRACKS:
|
||||
@@ -179,7 +188,7 @@ static void init() {
|
||||
// initialize pkjs
|
||||
app_message_register_inbox_received(inbox_received_handler);
|
||||
app_message_register_outbox_failed(outbox_failed_handler);
|
||||
app_message_open(app_message_inbox_size_maximum(), 512);
|
||||
app_message_open(app_message_inbox_size_maximum(), 255);
|
||||
|
||||
// load font
|
||||
s_font_chicago = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_CHICAGO_16));
|
||||
|
||||
Reference in new issue
Block a user