| ... | ... |
@@ -35,7 +35,10 @@ function enqueue(key, line) {
|
| 35 | 35 |
to_send.push(key + ";" + line); |
| 36 | 36 |
localStorage.setItem("toSend", to_send.join("|"));
|
| 37 | 37 |
localStorage.setItem("lastSent", key);
|
| 38 |
- if (to_send.length === 1) sendHead(); |
|
| 38 |
+ if (to_send.length === 1) {
|
|
| 39 |
+ Pebble.sendAppMessage({ "uploadStart": parseInt(key, 10) });
|
|
| 40 |
+ sendHead(); |
|
| 41 |
+ } |
|
| 39 | 42 |
} |
| 40 | 43 |
|
| 41 | 44 |
function uploadDone() {
|
| ... | ... |
@@ -61,14 +64,20 @@ Pebble.addEventListener("ready", function() {
|
| 61 | 64 |
cfg_endpoint = localStorage.getItem("cfgEndpoint");
|
| 62 | 65 |
cfg_data_field = localStorage.getItem("cfgDataField");
|
| 63 | 66 |
|
| 67 |
+ var msg = {};
|
|
| 68 |
+ |
|
| 64 | 69 |
if (cfg_endpoint && cfg_data_field) {
|
| 65 |
- Pebble.sendAppMessage({
|
|
| 66 |
- "lastSent": parseInt(localStorage.getItem("lastSent") || "0", 10)
|
|
| 67 |
- }); |
|
| 70 |
+ msg.lastSent = parseInt(localStorage.getItem("lastSent") || "0", 10);
|
|
| 68 | 71 |
} else {
|
| 69 |
- Pebble.sendAppMessage({ "modalMessage": "Not configured" });
|
|
| 72 |
+ msg.modalMessage = "Not configured"; |
|
| 70 | 73 |
} |
| 71 | 74 |
|
| 75 |
+ if (to_send.length >= 1) {
|
|
| 76 |
+ msg.uploadStart = parseInt(to_send[0].split(";")[0]);
|
|
| 77 |
+ } |
|
| 78 |
+ |
|
| 79 |
+ Pebble.sendAppMessage(msg); |
|
| 80 |
+ |
|
| 72 | 81 |
if (to_send.length >= 1) {
|
| 73 | 82 |
sendHead(); |
| 74 | 83 |
} |
| ... | ... |
@@ -23,6 +23,7 @@ |
| 23 | 23 |
#define MSG_KEY_LAST_SENT 110 |
| 24 | 24 |
#define MSG_KEY_MODAL_MESSAGE 120 |
| 25 | 25 |
#define MSG_KEY_UPLOAD_DONE 130 |
| 26 |
+#define MSG_KEY_UPLOAD_START 140 |
|
| 26 | 27 |
#define MSG_KEY_DATA_KEY 210 |
| 27 | 28 |
#define MSG_KEY_DATA_LINE 220 |
| 28 | 29 |
|
| ... | ... |
@@ -419,6 +420,12 @@ inbox_received_handler(DictionaryIterator *iterator, void *context) {
|
| 419 | 420 |
if (!web.first_key) web.first_key = web.current_key; |
| 420 | 421 |
update_progress(); |
| 421 | 422 |
} |
| 423 |
+ |
|
| 424 |
+ tuple = dict_find(iterator, MSG_KEY_UPLOAD_START); |
|
| 425 |
+ if (tuple) {
|
|
| 426 |
+ web.first_key = tuple_uint(tuple); |
|
| 427 |
+ web.start_time = time(0); |
|
| 428 |
+ } |
|
| 422 | 429 |
} |
| 423 | 430 |
|
| 424 | 431 |
static void |