Optimize app message in/outbox sizes; truncate lastWatched before sending to watch (if needed)
This commit is contained in:
@@ -375,7 +375,7 @@ static void init() {
|
|||||||
|
|
||||||
// initialize pkjs
|
// initialize pkjs
|
||||||
app_message_register_inbox_received(inbox_received_handler);
|
app_message_register_inbox_received(inbox_received_handler);
|
||||||
app_message_open(1024, 1536);
|
app_message_open(1536, 64);
|
||||||
|
|
||||||
// get sleep time (UNIX timestamp)
|
// get sleep time (UNIX timestamp)
|
||||||
time_t end = time(NULL);
|
time_t end = time(NULL);
|
||||||
|
|||||||
@@ -129,7 +129,11 @@ function callAPI(fullURL, apiKey, isJellyfin, trackedUser, sleepTimestamp) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (lastWatched != "") {
|
if (lastWatched != "") {
|
||||||
|
if (lastWatched.length <= 1536) {
|
||||||
Pebble.sendAppMessage({ PKJS_LAST_WATCHED: lastWatched });
|
Pebble.sendAppMessage({ PKJS_LAST_WATCHED: lastWatched });
|
||||||
|
} else {
|
||||||
|
Pebble.sendAppMessage({ PKJS_LAST_WATCHED: lastWatched.slice(0, 1536) });
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
Pebble.sendAppMessage({ PKJS_LAST_WATCHED: "NO WATCH HISTORY FOUND FOR USER " + trackedUser });
|
Pebble.sendAppMessage({ PKJS_LAST_WATCHED: "NO WATCH HISTORY FOUND FOR USER " + trackedUser });
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user