[gassist] - New app for voice control

pull/2848/head
stweedo 2023-06-29 08:43:45 -05:00
parent 2aa3dc5c29
commit 6d58a466b2
8 changed files with 85 additions and 0 deletions

1
apps/gassist/ChangeLog Normal file
View File

@ -0,0 +1 @@
0.01: New App!

11
apps/gassist/app.js Normal file
View File

@ -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);

BIN
apps/gassist/app.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 799 B

21
apps/gassist/boot.js Normal file
View File

@ -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;

View File

@ -0,0 +1 @@
gassist.json

1
apps/gassist/icon.js Normal file
View File

@ -0,0 +1 @@
require("heatshrink").decompress(atob("mEwxH+AH4A/AH4ALiAAFFtoxmFpQxjFxwwfFyAwdFyQwcF9wuUGDQvuFywwYF/4vUnAABF9YuCGBAv/F/6/PGC4bE3QACG5YvdFoYxSLzAvuFw4wjLxbCidhAvVGB4UFF7QxMCZAuaGJIRKF7oATFtoA/AEPMAAQttGNQuHGE4vuFxIwlF/4v/d/4vwGBAumGIwtpAH4A/AEIA=="))

View File

@ -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"}]
}

32
apps/gassist/settings.js Normal file
View File

@ -0,0 +1,32 @@
let storage = require('Storage');
(function (back) {
// Load and set default settings
let appSettings = Object.assign({
enableTap : true
}, storage.readJSON("gassist.json", true) || {});
// Save settings to storage
function writeSettings() {
storage.writeJSON("gassist.json", 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();
});