Android: 0.38: Don't rewrite settings file on every boot!

pull/3607/head
Gordon Williams 2024-10-08 11:20:46 +01:00
parent 2e47a13422
commit 3929f98801
3 changed files with 6 additions and 9 deletions

View File

@ -38,3 +38,4 @@
0.36: Move from wrapper function to {} and let - faster execution at boot 0.36: Move from wrapper function to {} and let - faster execution at boot
Allow `calendar-` to take an array of items to remove Allow `calendar-` to take an array of items to remove
0.37: Support Gadgetbridge canned responses 0.37: Support Gadgetbridge canned responses
0.38: Don't rewrite settings file on every boot!

View File

@ -10,19 +10,15 @@
let gpsState = {}; // keep information on GPS via Gadgetbridge let gpsState = {}; // keep information on GPS via Gadgetbridge
// this settings var is deleted after this executes to save memory // this settings var is deleted after this executes to save memory
let settings = require("Storage").readJSON("android.settings.json",1)||{}; let settings = Object.assign({rp:true,as:true,vibrate:".."},
//default alarm settings require("Storage").readJSON("android.settings.json",1)||{}
if (settings.rp == undefined) settings.rp = true; );
if (settings.as == undefined) settings.as = true;
if (settings.vibrate == undefined) settings.vibrate = "..";
require('Storage').writeJSON("android.settings.json", settings);
let _GB = global.GB; let _GB = global.GB;
let fetchRecInterval; let fetchRecInterval;
global.GB = (event) => { global.GB = (event) => {
// feed a copy to other handlers if there were any // feed a copy to other handlers if there were any
if (_GB) setTimeout(_GB,0,Object.assign({},event)); if (_GB) setTimeout(_GB,0,Object.assign({},event));
/* TODO: Call handling, fitness */ /* TODO: Call handling, fitness */
var HANDLERS = { var HANDLERS = {
// {t:"notify",id:int, src,title,subject,body,sender,tel:string} add // {t:"notify",id:int, src,title,subject,body,sender,tel:string} add

View File

@ -2,7 +2,7 @@
"id": "android", "id": "android",
"name": "Android Integration", "name": "Android Integration",
"shortName": "Android", "shortName": "Android",
"version": "0.37", "version": "0.38",
"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",