diff --git a/CalendarWatch.wgt b/CalendarWatch.wgt index e5ee681..d9fad5d 100644 Binary files a/CalendarWatch.wgt and b/CalendarWatch.wgt differ diff --git a/js/app.js b/js/app.js index 92d67d0..a26a4a2 100644 --- a/js/app.js +++ b/js/app.js @@ -226,8 +226,8 @@ var eventsTimeStamp = 0; function deleteCallback() { console.log("done"); console.log("getting new calendar events"); - getFileFromServer("userinfo/" + deviceFingerprint.deviceId + "/calendarevents.json", readJSON); - } + getFileFromServer("device/" + deviceFingerprint.deviceName + "/calendarevents.json", readJSON); + } console.log("deleting calendarevents"); deleteFile("calendarevents", deleteCallback); @@ -480,14 +480,20 @@ var eventsTimeStamp = 0; if(events == null) return; + /* if device not on server anymore */ + if(events.kind == "not found") { + deviceFingerprint = null; + events = null; + deleteFile("devicefingerprint", function() {}); + wait_time = SHORT_WAIT; + return; + } /* if device not registered */ if(events.kind == "unregistered") { wait_time = SHORT_WAIT; if(deviceFingerprint === null) { - console.log("no fingerprint to render"); } else { - console.log("rendering text"); - renderText(ctxContent, deviceFingerprint.deviceId, center.x, center.y, 20, "FF0000"); + renderText(ctxContent, deviceFingerprint.deviceName, center.x, center.y, 20, "FF0000"); } return; }