diff --git a/apps/hardalarm/metadata.json b/apps/hardalarm/metadata.json index df287b426..dd07eaada 100644 --- a/apps/hardalarm/metadata.json +++ b/apps/hardalarm/metadata.json @@ -6,7 +6,7 @@ "description": "Make sure you wake up! Count to the right number to turn off the alarm", "icon": "app.png", "tags": "tool,alarm,widget", - "supports": ["BANGLEJS"], + "supports": ["BANGLEJS", "BANGLEJS2"], "storage": [ {"name":"hardalarm.app.js","url":"app.js"}, {"name":"hardalarm.boot.js","url":"boot.js"}, diff --git a/apps/twentyeightbysix/app.js b/apps/twentyeightbysix/app.js index d56e10f2c..99300ce4f 100644 --- a/apps/twentyeightbysix/app.js +++ b/apps/twentyeightbysix/app.js @@ -1,3 +1,5 @@ +const HARDWARE_VERSION = process.env.HWVERSION; + const timeWidth = 42; const screenWidth = 239; const screenHeight = 239; @@ -627,41 +629,82 @@ function lookCurrent() { lookBack = true; } -setWatch(() => { - var timeAhead = 3600000 * 12; - if(quoteId >= quotes.length - 1) { - quoteId = 0; - } else { - quoteId = quoteId + 1; - } - if(!lookingDate) { - lookingDate = new Date(); - } - lookingDate = new Date(lookingDate.getTime() + timeAhead); - printTime(lookingDate, false); - if(timeout) { - clearTimeout(timeout); - } - timeout = setTimeout(()=>lookCurrent(), 3000); -}, BTN1, { repeat: true, edge: "falling" }); +if (HARDWARE_VERSION == 1) { + setWatch(() => { -setWatch(() => { + var timeBehind = 3600000 * 12; + if(quoteId <= 0) { + quoteId = quotes.length - 1; + } else { + quoteId = quoteId - 1; + } + if(!lookingDate) { + lookingDate = new Date(); + } + lookingDate = new Date(lookingDate.getTime() - timeBehind); + printTime(lookingDate, false); + if(timeout) { + clearTimeout(timeout); + } + timeout = setTimeout(()=>lookCurrent(), 6000); + }, BTN2, { repeat: true, edge: "falling" }); - var timeBehind = 3600000 * 12; - if(quoteId <= 0) { - quoteId = quotes.length - 1; - } else { - quoteId = quoteId - 1; - } - if(!lookingDate) { - lookingDate = new Date(); - } - lookingDate = new Date(lookingDate.getTime() - timeBehind); - printTime(lookingDate, false); - if(timeout) { - clearTimeout(timeout); - } - timeout = setTimeout(()=>lookCurrent(), 3000); -}, BTN3, { repeat: true, edge: "falling" }); + setWatch(() => { + var timeAhead = 3600000 * 12; + if(quoteId >= quotes.length - 1) { + quoteId = 0; + } else { + quoteId = quoteId + 1; + } + if(!lookingDate) { + lookingDate = new Date(); + } + lookingDate = new Date(lookingDate.getTime() + timeAhead); + printTime(lookingDate, false); + if(timeout) { + clearTimeout(timeout); + } + timeout = setTimeout(()=>lookCurrent(), 6000); + }, BTN3, { repeat: true, edge: "falling" }); +} -setWatch(Bangle.showLauncher, BTN2, { repeat: false, edge: "falling" }); +let onSwipe = (x, y) => { + if (x == -1) { + var timeBehind = 3600000 * 1; + if(quoteId <= 0) { + quoteId = quotes.length - 1; + } else { + quoteId = quoteId - 1; + } + if(!lookingDate) { + lookingDate = new Date(); + } + lookingDate = new Date(lookingDate.getTime() - timeBehind); + printTime(lookingDate, false); + if(timeout) { + clearTimeout(timeout); + } + timeout = setTimeout(()=>lookCurrent(), 6000); + } + else if (x == 1) { + var timeAhead = 3600000 * 1; + if(quoteId >= quotes.length - 1) { + quoteId = 0; + } else { + quoteId = quoteId + 1; + } + if(!lookingDate) { + lookingDate = new Date(); + } + lookingDate = new Date(lookingDate.getTime() + timeAhead); + printTime(lookingDate, false); + if(timeout) { + clearTimeout(timeout); + } + timeout = setTimeout(()=>lookCurrent(), 6000); + + } +} +Bangle.on("swipe", onSwipe); + +setWatch(Bangle.showLauncher, BTN, { repeat: false, edge: "falling" }); diff --git a/apps/twentyeightbysix/metadata.json b/apps/twentyeightbysix/metadata.json index ea5d648a3..ad4276565 100644 --- a/apps/twentyeightbysix/metadata.json +++ b/apps/twentyeightbysix/metadata.json @@ -10,5 +10,5 @@ {"name":"twentyeightbysix.app.js","url":"app.js"}, {"name":"twentyeightbysix.img","url":"app-icon.js","evaluate":true} ], - "supports": ["BANGLEJS"] + "supports": ["BANGLEJS", "BANGLEJS2"] } \ No newline at end of file