Implement settings (via Clay)

This commit is contained in:
2026-04-09 20:57:46 -04:00
parent 11f2dc0c94
commit fd9ec48511
5 changed files with 72 additions and 27 deletions

View File

@@ -16,32 +16,28 @@ static TextLayer *s_pin_notice_layer;
// declare time tracking statics
static time_t s_sleep_timestamp;
static void send_to_pkjs() {
static void send_sleep_time_to_pkjs() {
DictionaryIterator *out;
AppMessageResult result = app_message_outbox_begin(&out);
if (result != APP_MSG_OK) {
text_layer_set_text(s_last_episode_layer, "outbox_begin failure");
return;
}
dict_write_uint32(out, MESSAGE_KEY_SLEEP_TIMESTAMP, s_sleep_timestamp);
dict_write_uint8(out, MESSAGE_KEY_API_IS_PLEX, 0);
dict_write_cstring(out, MESSAGE_KEY_API_KEY, "");
dict_write_cstring(out, MESSAGE_KEY_API_HOST, "");
dict_write_uint32(out, MESSAGE_KEY_PKJS_SLEEP_TIMESTAMP, s_sleep_timestamp);
result = app_message_outbox_send();
if (result != APP_MSG_OK) {
text_layer_set_text(s_last_episode_layer, "outbox_send failure ");
text_layer_set_text(s_last_episode_layer, "outbox_send failure");
return;
}
}
static void inbox_received_handler(DictionaryIterator *iter, void *context) {
Tuple *ready_tuple = dict_find(iter, MESSAGE_KEY_JS_READY);
Tuple *ready_tuple = dict_find(iter, MESSAGE_KEY_PKJS_READY);
if (ready_tuple) {
s_js_ready = true;
}
APP_LOG(APP_LOG_LEVEL_INFO, "Received JS_READY, calling PKJS...");
send_to_pkjs();
send_sleep_time_to_pkjs();
}
static void inbox_dropped_handler(AppMessageResult reason, void *context) {