2.7 KiB
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.3)
- Pure #000000 AMOLED background, including the list and prayer rows
- Larger 42px clock, 28px prayer names and 36px times
- Native vertically swipe-scrollable list: 80px rows in a 320×240px viewport
- Top/bottom spacers let the first and last prayers scroll to the center
- Fixed next-prayer countdown; lavender outline/text highlight the next prayer
- Normal system back button exits; no crown support assumed
- 15s refresh; no changes to prayer calculations
Build and automated tests pass; v0.3 scrolling/rendering needs an on-watch check.
preview-0.3.png is a static layout mock with illustrative times, not a watch screenshot.
Project layout
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
npm ci
npm run release
node tests/prayer.cjs
node tests/page.cjs
node tests/amoled.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.