Commit graph

8 commits

Author SHA1 Message Date
ac2d2ad0ff fix: rewrite health-sync.js for Scripting app API
- fetch() instead of new Request() + req.loadJSON() (Scriptable API)
- Notification.schedule({title, body}) instead of new Notification() + n.schedule()
- allowInsecureRequest: true for HTTP (Scripting app blocks HTTP by default)
- This was the real reason 'nothing happened' — Scriptable API doesn't exist in Scripting app
2026-08-22 22:51:28 +01:00
067bf7a769 fix: health-sync.js HealthUnit method names + serve as inline text
- HealthUnit.gram(prefix) → HealthUnit.gramUnit(prefix) (Scripting app API)
- HealthUnit.millimeterOfMercury() → HealthUnit.fromString('mmHg')
- Updated header: Scriptable → Scripting app
- content-disposition: inline instead of attachment (fixes download issue)
2026-08-22 22:43:16 +01:00
51b864438b fix: use Scripting app API (Health.queryQuantitySamples + HealthUnit) 2026-08-21 00:19:27 +01:00
e01c0b92e3 debug: add console.log at every step to trace execution 2026-08-21 00:14:41 +01:00
aa05c9c8d4 fix: await Notification.schedule() so notification fires before script exits 2026-08-21 00:10:45 +01:00
2b5751d50e fix: remove Script.done() — not a function in Scriptable 2026-08-21 00:08:31 +01:00
c65affc66c fix: use Scriptable Health API (new Health with string units) 2026-08-21 00:05:56 +01:00
191f5f473b fix: rewrite health-sync.js for current Scripting API
Old script used deprecated Health.read() with Health.Types.* and .quantity
— every read silently failed in try/catch, so no samples were ever collected.

Rewrote to use Health.queryQuantitySamples() with string type identifiers
and .quantityValue(unit) per current Scripting app docs. Added proper units
(kg, mmHg, count/min, count, percent) for each metric type.

Also adds /scriptable/health-sync.js endpoint to serve the script directly.
2026-08-20 23:54:08 +01:00