Modern-Apps.git
Publicgit clone https://git.maproj.org/Modern-Apps.gitModern-Apps.git / clock / AGENTS.md
| 1 | # AGENTS.md — clock/ (':clock') |
| 2 | |
| 3 | > Scoped supplement. Global rules in root `AGENTS.md` apply. Stay inside `clock/` + allowed shared modules. Do not root-scan. |
| 4 | |
| 5 | _Install: ./install clock (dev by default)._ |
| 6 | <!-- last-reviewed: 2026-10-16 --> |
| 7 | - Gradle: :clock / dir: clock/ |
| 8 | - Package roots present: ui, data, platform, intents, service, widget |
| 9 | - Entry files: MainActivity.kt, Route.kt, Navigation.kt |
| 10 | - Deps: :library:widgets, :library:room |
| 11 | - Metadata: metadata_data/clock.md (present) |
| 12 | - Rust: no / screenshotTest: yes |
| 13 | |
| 14 | ## Overview |
| 15 | **Purpose:** Offline clock — alarms (exact, survive reboot pre-unlock), timer, stopwatch, world clock, analog widget; answers system alarm/timer intents so assistants can set them. |
| 16 | **Key features:** |
| 17 | - Alarms with full-screen lockscreen surface + sound service; timer + stopwatch controllable from notifications |
| 18 | - World-clock city picker; analog Glance widget + legacy widget provider |
| 19 | - Assistant `intents/` (`SetAlarm` / `SetTimer`) wired to the same schedulers as the UI |
| 20 | **Architecture / data-flow:** `ui/` tab pages → `platform/ClockViewModel` (+ `ClockUiContract`) → `data/ClockRepository` over Room; scheduling via `platform/AlarmScheduler` → `AlarmReceiver` → `AlarmActivity` + `service/AlarmSoundService`, re-armed by `BootReceiver`. Timer/stopwatch actions arrive from notifications via `*ActionReceiver`s. |
| 21 | **Entry points + reading order:** `Route` (alarm/timer/stopwatch/world-clock tabs) → `MainActivity.kt` → `Navigation.kt` → `ui/ClockTabs.kt` → `platform/ClockViewModel.kt` → `platform/AlarmScheduler.kt`. |
| 22 | **Gotchas:** |
| 23 | - Alarm scheduling must work before first unlock — test the boot path, not just in-app |
| 24 | - Notification action receivers and the sound service are the timer/stopwatch control plane; UI pages are views onto the same state |
| 25 | - `TimerReciever.kt` keeps its historical misspelling — do NOT rename (receivers are manifest-registered) |
| 26 | |
| 27 | ## Key files |
| 28 | ### Root — entry + navigation |
| 29 | - com/vayunmathur/clock/MainActivity.kt |
| 30 | - com/vayunmathur/clock/Navigation.kt |
| 31 | - com/vayunmathur/clock/Route.kt |
| 32 | ### data/ — Room store |
| 33 | - com/vayunmathur/clock/data/ClockDatabase.kt |
| 34 | - com/vayunmathur/clock/data/ClockRepository.kt |
| 35 | ### platform/ — ViewModel, schedulers, receivers |
| 36 | - com/vayunmathur/clock/platform/ClockViewModel.kt |
| 37 | - com/vayunmathur/clock/platform/ClockUiContract.kt |
| 38 | - com/vayunmathur/clock/platform/AlarmScheduler.kt |
| 39 | - com/vayunmathur/clock/platform/AlarmReceiver.kt |
| 40 | - com/vayunmathur/clock/platform/AlarmActivity.kt |
| 41 | - com/vayunmathur/clock/platform/BootReceiver.kt — re-arm alarms on boot |
| 42 | - com/vayunmathur/clock/platform/NotificationUtils.kt |
| 43 | - com/vayunmathur/clock/platform/StopwatchActionReceiver.kt |
| 44 | - com/vayunmathur/clock/platform/StopwatchNotificationHelper.kt |
| 45 | - com/vayunmathur/clock/platform/TimerActionReceiver.kt |
| 46 | - com/vayunmathur/clock/platform/TimerReciever.kt — historical misspelling, do not rename |
| 47 | - com/vayunmathur/clock/platform/WorldClockCities.kt |
| 48 | ### service/ — alarm sound |
| 49 | - com/vayunmathur/clock/service/AlarmSoundService.kt |
| 50 | ### ui/ + ui/components/ + ui/dialogs/ — tab pages and controls |
| 51 | - com/vayunmathur/clock/ui/ClockTabs.kt |
| 52 | - com/vayunmathur/clock/ui/ClockPage.kt |
| 53 | - com/vayunmathur/clock/ui/ClockScreen.kt |
| 54 | - com/vayunmathur/clock/ui/AlarmPage.kt |
| 55 | - com/vayunmathur/clock/ui/AlarmScreen.kt |
| 56 | - com/vayunmathur/clock/ui/AlarmSettingsPage.kt |
| 57 | - com/vayunmathur/clock/ui/TimerPage.kt |
| 58 | - com/vayunmathur/clock/ui/TimerScreen.kt |
| 59 | - com/vayunmathur/clock/ui/StopwatchPage.kt |
| 60 | - com/vayunmathur/clock/ui/StopwatchScreen.kt |
| 61 | - com/vayunmathur/clock/ui/InitialPermissionsScreen.kt |
| 62 | - com/vayunmathur/clock/ui/components/AlarmCard.kt |
| 63 | - com/vayunmathur/clock/ui/components/AlarmOptionControls.kt |
| 64 | - com/vayunmathur/clock/ui/components/AlarmRingingScreen.kt |
| 65 | - com/vayunmathur/clock/ui/components/KeypadButton.kt |
| 66 | - com/vayunmathur/clock/ui/components/KeypadRow.kt |
| 67 | - com/vayunmathur/clock/ui/components/LapRow.kt |
| 68 | - com/vayunmathur/clock/ui/components/TimerCard.kt |
| 69 | - com/vayunmathur/clock/ui/components/TimerKeypadContent.kt |
| 70 | - com/vayunmathur/clock/ui/components/TimerNotification.kt |
| 71 | - com/vayunmathur/clock/ui/components/TimeUnitDisplay.kt |
| 72 | - com/vayunmathur/clock/ui/dialogs/NewAlarmDialog.kt |
| 73 | - com/vayunmathur/clock/ui/dialogs/NewTimerDialog.kt |
| 74 | - com/vayunmathur/clock/ui/dialogs/SelectTimeZonesDialog.kt |
| 75 | ### intents/ + widget/ — assistant hooks and widgets |
| 76 | - com/vayunmathur/clock/intents/SetAlarmIntent.kt |
| 77 | - com/vayunmathur/clock/intents/SetTimerIntent.kt |
| 78 | - com/vayunmathur/clock/widget/AnalogClockGlanceWidget.kt |
| 79 | - com/vayunmathur/clock/widget/AnalogClockWidgetProvider.kt |
| 80 | |
| 81 | ## Verify (this module only) |
| 82 | ``` |
| 83 | ./gradlew :clock:compileDevKotlin |
| 84 | ./gradlew :clock:lint |
| 85 | ./gradlew :clock:checkMetadata |
| 86 | ``` |