Added periodic call to forceCalendarSync
parent
9e4d58d215
commit
064b9996e7
|
|
@ -17,6 +17,7 @@
|
||||||
case 1:
|
case 1:
|
||||||
require("Storage").writeJSON("android.calendar.json",[]);
|
require("Storage").writeJSON("android.calendar.json",[]);
|
||||||
CALENDAR = [];
|
CALENDAR = [];
|
||||||
|
/* falls through */
|
||||||
case 2:
|
case 2:
|
||||||
gbSend({t:"force_calendar_sync", ids: CALENDAR.map(e=>e.id)});
|
gbSend({t:"force_calendar_sync", ids: CALENDAR.map(e=>e.id)});
|
||||||
E.showAlert(/*LANG*/"Request sent to the phone").then(()=>E.showMenu(mainmenu));
|
E.showAlert(/*LANG*/"Request sent to the phone").then(()=>E.showMenu(mainmenu));
|
||||||
|
|
|
||||||
|
|
@ -125,6 +125,17 @@
|
||||||
if (!settings.keep)
|
if (!settings.keep)
|
||||||
NRF.on("disconnect", () => require("messages").clearAll()); // remove all messages on disconnect
|
NRF.on("disconnect", () => require("messages").clearAll()); // remove all messages on disconnect
|
||||||
setInterval(sendBattery, 10*60*1000);
|
setInterval(sendBattery, 10*60*1000);
|
||||||
|
// Fix calendar every 2 days (can be done manually too)
|
||||||
|
function forceCalendarSync() {
|
||||||
|
if(NRF.getSecurityStatus().connected) {
|
||||||
|
var cal = require("Storage").readJSON("android.calendar.json",true);
|
||||||
|
if (!cal || !Array.isArray(cal)) cal = [];
|
||||||
|
gbSend({t:"force_calendar_sync", ids: cal.map(e=>e.id)});
|
||||||
|
setTimeout(forceCalendarSync, 2*24*60*60*1000);
|
||||||
|
} else
|
||||||
|
NRF.once("connect", () => setTimeout(forceCalendarSync, 4000));
|
||||||
|
}
|
||||||
|
setTimeout(forceCalendarSync, 2*24*60*60*1000); //schedule the first
|
||||||
// Health tracking
|
// Health tracking
|
||||||
Bangle.on('health', health=>{
|
Bangle.on('health', health=>{
|
||||||
gbSend({ t: "act", stp: health.steps, hrm: health.bpm });
|
gbSend({ t: "act", stp: health.steps, hrm: health.bpm });
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
"id": "android",
|
"id": "android",
|
||||||
"name": "Android Integration",
|
"name": "Android Integration",
|
||||||
"shortName": "Android",
|
"shortName": "Android",
|
||||||
"version": "4.02",
|
"version": "0.11",
|
||||||
"description": "Display notifications/music/etc sent from the Gadgetbridge app on Android. This replaces the old 'Gadgetbridge' Bangle.js widget.",
|
"description": "Display notifications/music/etc sent from the Gadgetbridge app on Android. This replaces the old 'Gadgetbridge' Bangle.js widget.",
|
||||||
"icon": "app.png",
|
"icon": "app.png",
|
||||||
"tags": "tool,system,messages,notifications,gadgetbridge",
|
"tags": "tool,system,messages,notifications,gadgetbridge",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue