From 6ff61b917e688e35ebe78c9dfe9d3a72edfbde56 Mon Sep 17 00:00:00 2001 From: Gordon Williams Date: Thu, 14 Sep 2023 12:43:25 +0100 Subject: [PATCH] Add saveFile function, and ensure it uses data: URI not blobs (because they don't work in Gadgetbridge) Reduce duplication to make custom/interface use .saveFile where possible (avoiding Blob) --- apps/gpsrec/interface.html | 24 ++----------------- apps/hrmaccevents/README.md | 4 ++++ apps/hrmaccevents/custom.html | 33 ++++++++------------------ apps/medicalinfo/interface.html | 12 +--------- apps/presentation_timer/interface.html | 12 +--------- apps/recorder/interface.html | 24 ++----------------- apps/swatch/interface.html | 2 +- apps/tempmonitor/interface.html | 4 ++-- apps/todolist/interface.html | 12 +--------- core | 2 +- 10 files changed, 25 insertions(+), 104 deletions(-) diff --git a/apps/gpsrec/interface.html b/apps/gpsrec/interface.html index 4c7270f0a..9f2211332 100644 --- a/apps/gpsrec/interface.html +++ b/apps/gpsrec/interface.html @@ -23,17 +23,7 @@ function saveKML(track,title) { `; - var a = document.createElement("a"), - file = new Blob([kml], {type: "application/vnd.google-earth.kml+xml"}); - var url = URL.createObjectURL(file); - a.href = url; - a.download = title+".kml"; - document.body.appendChild(a); - a.click(); - setTimeout(function() { - document.body.removeChild(a); - window.URL.revokeObjectURL(url); - }, 0); + Util.saveFile(title+".kml", "application/vnd.google-earth.kml+xml", kml); } function saveGPX(track, title) { @@ -56,17 +46,7 @@ function saveGPX(track, title) { `; - var a = document.createElement("a"), - file = new Blob([gpx], {type: "application/gpx+xml"}); - var url = URL.createObjectURL(file); - a.href = url; - a.download = title+".gpx"; - document.body.appendChild(a); - a.click(); - setTimeout(function() { - document.body.removeChild(a); - window.URL.revokeObjectURL(url); - }, 0); + Util.saveFile(title+".gpx", "application/gpx+xml", gpx); } function trackLineToObject(l, hasTrackNumber) { diff --git a/apps/hrmaccevents/README.md b/apps/hrmaccevents/README.md index ecd619152..57cf944c7 100644 --- a/apps/hrmaccevents/README.md +++ b/apps/hrmaccevents/README.md @@ -28,6 +28,10 @@ The CSV data contains the following columns: * PPG_o - `e.vcPPGoffs` from the `Bangle.on("HRM-raw"` event. This is the PPG offset used to map `e.vcPPG` to `e.raw` so there are no glitches when the exposure values in the sensor change. * BTHRM - BPM figure from external Bluetooth HRM device (this is our reference BPM) +## FIXME + +The `custom.html` for the app uses the Puck.js lib directly when it should just use `customize.js` - it won't work well under Gadgetbridge and may fail on other platforms too + ## Creator [halemmerich](https://github.com/halemmerich) diff --git a/apps/hrmaccevents/custom.html b/apps/hrmaccevents/custom.html index a5bf9796f..97cc7e0ab 100644 --- a/apps/hrmaccevents/custom.html +++ b/apps/hrmaccevents/custom.html @@ -4,6 +4,7 @@ +

@@ -23,20 +24,6 @@