Files
vela-salah/README.md
T

79 lines
3.1 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# SALAH — prayer times for Casablanca (Xiaomi Watch S4)
Offline prayer-time companion: shows today's six times (FAJR, SHURUK, DHUHR,
ASR, MAGHRIB, ISHA) with the next prayer highlighted and a countdown banner.
**Status: VERIFIED MATH (matches AlAdhan on 3 reference dates); on-watch render
pending user confirmation.**
## Method
Morocco (Ministry of Habous), matching AlAdhan `method=21`:
- Fajr 19°, Isha 17° (twilight angles)
- Standard Asr (shadow factor 1× — Maliki default in Morocco)
- Dhuhr = solar noon + 5 min; Maghrib = sunset + 5 min (AlAdhan's baked offsets)
- Location hardcoded: Casablanca 33.5731, −7.5898 · fixed TZ = UTC+1.
Ramadan clock changes are not handled by this version.
All computation happens **on the watch** — no GPS, no network. Pure solar math
(same Meeus approach as the sundial) lives in `src/common/prayer.js`.
## Screen (v0.5)
- Pure #000000 AMOLED background, large 50px clock, no swipe hint
- Prayer names above their times, in fixed 104px native list rows
- After scrolling stops, the nearest-center prayer gets a 60px time and 28px
label; other rows use 30px times and 20px labels
- No font resizing or row-array replacement during gesture/inertial scrolling
- Duplicate stop notifications do not repaint unchanged focus; periodic refresh
defers while scrolling and resumes normally after hiding/showing the app
- Scroll viewport 320×264 at x73/y101 (center y233); 80px end spacers
- Fixed countdown below the list; lavender next-prayer highlight
- Normal system back exits; calculation logic unchanged
User reported watch lag in v0.4. A 500-event VM replay measured 500 row-array
replacements in v0.4 versus zero during scrolling in v0.5. This verifies reduced
update work, NOT device frame rate. All automated tests and release build pass;
on-watch smoothness still needs confirmation. `preview-0.4.png` remains an
illustrative static layout mock; the settled appearance is unchanged.
## Project layout
```text
src/
├── app.ux, manifest.json # com.ilias.salah, watch, designWidth 466
├── common/
│ ├── prayer.js # times/format/nextPrayer/formatCountdown — pure, unit-tested
│ └── icon.png # 192×192 circular icon (user-supplied mosque art)
└── pages/index/index.ux # layout + update loop
tests/
├── prayer.cjs # 10 tests vs AlAdhan reference times (3 dates)
├── page.cjs # 11 wiring/layout tests (incl. chord-fit assertions)
├── make_icon.py # icon conversion pipeline (disc detect → round mask → 192²)
└── check-rpk.py # verifies icon/manifest inside the built .rpk
```
## Build & test
```bash
npm ci
npm run release
node tests/prayer.cjs
node tests/page.cjs
node tests/amoled.cjs
node tests/focus.cjs
node tests/scroll-performance.cjs
```
## Install
Side-load `dist/com.ilias.salah.release.*.rpk` via AstroBox.
Releases: https://gitea.oimcloud.myaddr.tools/codex-bot/vela-salah
## Accuracy note
Verified against AlAdhan API (method 21) for 2026-09-09, 2026-01-15, 2026-07-01 —
all six times within 2 minutes on every date. Tolerance covers the low-precision
solar vector (±0.01°) plus rounding.