Merge branch 'espruino:master' into master

master
Spioune 2024-04-12 10:54:44 +08:00 committed by GitHub
commit ce8144d8ab
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 28 additions and 9 deletions

9
CONTRIBUTING.md Normal file
View File

@ -0,0 +1,9 @@
Contributing to BangleApps
==========================
https://github.com/espruino/BangleApps?tab=readme-ov-file#getting-started
has some links to tutorials on developing for Bangle.js.
Please check out the Wiki to get an idea what sort of things
we'd like to see for contributed apps: https://github.com/espruino/BangleApps/wiki/App-Contribution

View File

@ -1,4 +1,5 @@
0.01: New App! 0.01: New App!
0.02: Fix double-button press if you press the next button within 30s (#3243) 0.02: Fix double-button press if you press the next button within 30s (#3243)
0.03: Cope with identical duplicate buttons (fix #3260) 0.03: Cope with identical duplicate buttons (fix #3260)
Set 'n' for buttons in Bangle.btHomeData correctly (avoids adding extra buttons on end of advertising) Set 'n' for buttons in Bangle.btHomeData correctly (avoids adding extra buttons on end of advertising)
0.04: Fix duplicate button on edit->save

View File

@ -1,7 +1,7 @@
{ "id": "bthome", { "id": "bthome",
"name": "BTHome", "name": "BTHome",
"shortName":"BTHome", "shortName":"BTHome",
"version":"0.03", "version":"0.04",
"description": "Allow your Bangle to advertise with BTHome and send events to Home Assistant via Bluetooth", "description": "Allow your Bangle to advertise with BTHome and send events to Home Assistant via Bluetooth",
"icon": "icon.png", "icon": "icon.png",
"type": "app", "type": "app",

View File

@ -1,7 +1,11 @@
(function(back) { (function(back) {
var settings = require("Storage").readJSON("bthome.json",1)||{}; var settings;
if (!(settings.buttons instanceof Array))
settings.buttons = []; function loadSettings() {
settings = require("Storage").readJSON("bthome.json",1)||{};
if (!(settings.buttons instanceof Array))
settings.buttons = [];
}
function saveSettings() { function saveSettings() {
require("Storage").writeJSON("bthome.json",settings) require("Storage").writeJSON("bthome.json",settings)
@ -15,7 +19,10 @@
} }
var actions = ["press","double_press","triple_press","long_press","long_double_press","long_triple_press"]; var actions = ["press","double_press","triple_press","long_press","long_double_press","long_triple_press"];
var menu = { var menu = {
"":{title:isNew ? /*LANG*/"New Button" : /*LANG*/"Edit Button", back:showMenu}, "":{title:isNew ? /*LANG*/"New Button" : /*LANG*/"Edit Button", back: () => {
loadSettings(); // revert changes
showMenu();
}},
/*LANG*/"Icon" : { /*LANG*/"Icon" : {
value : "\0"+require("icons").getIcon(button.icon), value : "\0"+require("icons").getIcon(button.icon),
onchange : () => { onchange : () => {
@ -49,7 +56,7 @@
onchange : v => button.n=v onchange : v => button.n=v
}, },
/*LANG*/"Save" : () => { /*LANG*/"Save" : () => {
settings.buttons.push(button); if (isNew) settings.buttons.push(button);
saveSettings(); saveSettings();
showMenu(); showMenu();
} }
@ -94,5 +101,7 @@
}); });
E.showMenu(menu); E.showMenu(menu);
} }
loadSettings();
showMenu(); showMenu();
}) })

2
core

@ -1 +1 @@
Subproject commit b4224cd348304016dc42d5dda6501e4e95c6b5ce Subproject commit 1deedec58cdb854da978e54f10e7e4755b35302e

@ -1 +1 @@
Subproject commit 3a55438189240c0f40cf280128d663806d04a5be Subproject commit 8150b3617766689ee77ce085c60926cc9040d6fb