diff --git a/apps/chimer/ChangeLog b/apps/chimer/ChangeLog index 51842b5cd..6c6f5312e 100644 --- a/apps/chimer/ChangeLog +++ b/apps/chimer/ChangeLog @@ -1,3 +1,4 @@ 0.01: Initial Creation 0.02: Fixed some sleep bugs. Added a sleep mode toggle 0.03: Reduce busy-loop and code +0.04: Separate buzz-time and sleep-time diff --git a/apps/chimer/metadata.json b/apps/chimer/metadata.json index dfbabf405..cfa0da00f 100644 --- a/apps/chimer/metadata.json +++ b/apps/chimer/metadata.json @@ -1,7 +1,7 @@ { "id": "chimer", "name": "Chimer", - "version": "0.03", + "version": "0.04", "description": "A fork of Hour Chime that adds extra features such as: \n - Buzz or beep on every 60, 30 or 15 minutes. \n - Repeat Chime up to 3 times \n - Set hours to disable chime", "icon": "widget.png", "type": "widget", diff --git a/apps/chimer/widget.js b/apps/chimer/widget.js index a587b61de..3b7de9d7a 100644 --- a/apps/chimer/widget.js +++ b/apps/chimer/widget.js @@ -20,15 +20,16 @@ let count = settings.repeat; const chime1 = () => { + let p; if (settings.type === 1) { - Bangle.buzz(100); + p = Bangle.buzz(100); } else if (settings.type === 2) { - Bangle.beep(); + p = Bangle.beep(); } else { return; } if (--count > 0) - setTimeout(chime1, 150); + p.then(() => setTimeout(chime1, 150)); }; chime1(); diff --git a/apps/gassist/ChangeLog b/apps/gassist/ChangeLog new file mode 100644 index 000000000..5560f00bc --- /dev/null +++ b/apps/gassist/ChangeLog @@ -0,0 +1 @@ +0.01: New App! diff --git a/apps/gassist/app.js b/apps/gassist/app.js new file mode 100644 index 000000000..69e8001e3 --- /dev/null +++ b/apps/gassist/app.js @@ -0,0 +1,11 @@ +Bluetooth.println(""); +Bluetooth.println(JSON.stringify({ + t:"intent", + target:"activity", + action:"android.intent.action.VOICE_COMMAND", + flags:["FLAG_ACTIVITY_NEW_TASK"] +})); + +setTimeout(function() { + Bangle.showClock(); +}, 0); diff --git a/apps/gassist/app.png b/apps/gassist/app.png new file mode 100644 index 000000000..8c190d344 Binary files /dev/null and b/apps/gassist/app.png differ diff --git a/apps/gassist/boot.js b/apps/gassist/boot.js new file mode 100644 index 000000000..eb2155796 --- /dev/null +++ b/apps/gassist/boot.js @@ -0,0 +1,21 @@ +// load settings +var settings = Object.assign({ + enableTap: true +}, require("Storage").readJSON("gassist.json", true) || {}); + +if (settings.enableTap) { + Bangle.on("tap", function(e) { + if (e.dir=="front" && e.double) { + Bluetooth.println(""); + Bluetooth.println(JSON.stringify({ + t:"intent", + target:"activity", + action:"android.intent.action.VOICE_COMMAND", + flags:["FLAG_ACTIVITY_NEW_TASK"] + })); + } + }); +} + +// clear variable +settings = undefined; \ No newline at end of file diff --git a/apps/gassist/icon.js b/apps/gassist/icon.js new file mode 100644 index 000000000..9e84990e3 --- /dev/null +++ b/apps/gassist/icon.js @@ -0,0 +1 @@ +require("heatshrink").decompress(atob("mEwxH+AH4A/AH4ALiAAFFtoxmFpQxjFxwwfFyAwdFyQwcF9wuUGDQvuFywwYF/4vUnAABF9YuCGBAv/F/6/PGC4bE3QACG5YvdFoYxSLzAvuFw4wjLxbCidhAvVGB4UFF7QxMCZAuaGJIRKF7oATFtoA/AEPMAAQttGNQuHGE4vuFxIwlF/4v/d/4vwGBAumGIwtpAH4A/AEIA==")) \ No newline at end of file diff --git a/apps/gassist/metadata.json b/apps/gassist/metadata.json new file mode 100644 index 000000000..995c44adb --- /dev/null +++ b/apps/gassist/metadata.json @@ -0,0 +1,18 @@ +{ + "id": "gassist", + "name": "Google Assist", + "version": "0.01", + "description": "A simple way to initiate Google Assistant on Android. Intents must be enabled in Gadgetbridge.", + "icon": "app.png", + "type": "app", + "tags": "tool, voice, tasker", + "supports": ["BANGLEJS","BANGLEJS2"], + "allow_emulator": false, + "storage": [ + {"name":"gassist.boot.js","url":"boot.js"}, + {"name":"gassist.app.js","url":"app.js"}, + {"name":"gassist.settings.js","url":"settings.js"}, + {"name":"gassist.img","url":"icon.js","evaluate":true} + ], + "data": [{"name":"gassist.json"}] +} \ No newline at end of file diff --git a/apps/gassist/settings.js b/apps/gassist/settings.js new file mode 100644 index 000000000..987c3fdfc --- /dev/null +++ b/apps/gassist/settings.js @@ -0,0 +1,33 @@ +(function (back) { + let storage = require('Storage'); + let file = "gassist.json"; + + // Load and set default settings + let appSettings = Object.assign({ + enableTap : true + }, storage.readJSON(file, true) || {}); + + // Save settings to storage + function writeSettings() { + storage.writeJSON(file, appSettings); + } + + function showMenu() { + E.showMenu({ + "": { + "title": "Google Assist" + }, + "< Back": () => back(), + 'Front Tap:': { + value: (appSettings.enableTap === true), + format: v => v ? "On" : "Off", + onchange: v => { + appSettings.enableTap = v; + writeSettings(); + } + }, + }); + } + // Initially show the menu + showMenu(); +});