Skip to content
nmn-programmerPublic

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Prelude

A standalone-branded native Android app (Kotlin + Jetpack Compose) — its own name, icon, and dawn-toned color palette, distinct from Lumina's — that reads your Lumina segments straight from Firestore and automatically arms a real alarm-clock alarm 5 minutes before each one starts — no manual alarm-setting required.

This is the MVP: the automatic-alarm engine only. Manual alarms, timers, stopwatch, world clock, etc. (the "full default-clock replacement" features) are intentionally left out for now, per your priority — they slot into this same project structure later without needing a rewrite.

How it works

  • Signs in with the same Google account you use on Lumina (Firebase Auth).
  • Reads users/{uid}/dailyHabits/{date} for today and tomorrow — same documents, same fields, same security rules as the web app. Read-only, never writes anything back.
  • Every segment becomes a candidate alarm at startTime − offset (default 5 min, adjustable in Settings). By your call: all segments get an alarm, including the default Sleep block. isLogged (past quick-log) entries are skipped by default since those describe the past, not something upcoming — flip "Include quick-logged entries" in Settings if you want those too.
  • Alarms are real OS alarms (AlarmManager.setAlarmClock), so they show the little alarm-clock icon in your status bar/lock screen just like the stock Clock app, survive Doze mode, and re-arm automatically after a reboot.
  • A background sync job re-checks Firestore every ~15 minutes (Android's minimum for periodic background work) plus immediately on app open, after sign-in, after reboot, and via the manual refresh button — so edits you make in Lumina (add/move/delete a segment) get picked up and the corresponding alarm is rescheduled or cancelled automatically.
  • When an alarm fires: full-screen ringing UI over the lock screen, looping alarm sound + vibration, Snooze/Dismiss — same interaction model as the stock clock.

One-time setup (you'll need to do this before it builds)

  1. Install Android Studio (Ladybug or newer) if you don't have it.
  2. Register the Android app in Firebase — see app/google-services.json.template for the exact steps (package name, getting your debug SHA-1, downloading the real google-services.json). Put the real file at app/google-services.json.
  3. Open this folder (Prelude/) in Android Studio → let it sync Gradle (first sync downloads the Gradle wrapper + all dependencies, needs internet) → Run ▶ on a device or emulator.
  4. On first launch: sign in, then grant the two prompts it'll ask for — notifications, and "Allow exact alarms" (Android takes you to a system settings toggle for this one; without it alarms can fire a few minutes late). On Android 14+ you may also want to enable "Full-screen notifications" for the app in system Settings if the ring screen doesn't pop over the lock screen — most devices auto-grant this on install.

Project layout

app/src/main/java/com/prelude/clock/
  MainActivity.kt              Nav host (login/home/settings)
  PreludeApp.kt            Application: boots Firebase + periodic sync
  auth/AuthRepository.kt       Google Sign-In -> Firebase Auth
  data/LuminaRepository.kt     Reads dailyHabits/{date} from Firestore
  data/model/Segment.kt        Mirrors the web app's TimeSegment
  alarm/AlarmPlanner.kt        Pure fn: segments+settings -> alarm times
  alarm/AlarmScheduler.kt      Diff-syncs AlarmManager against the plan
  alarm/AlarmReceiver.kt       Fires when an alarm's time hits
  alarm/AlarmPlaybackService.kt  Rings, vibrates, posts full-screen notif
  alarm/AlarmRingActivity.kt   The full-screen Snooze/Dismiss screen
  alarm/BootReceiver.kt        Re-arms alarms after reboot
  sync/SyncWorker.kt           WorkManager job: fetch + reconcile
  settings/SettingsDataStore.kt  Offset/snooze/toggles, DataStore-backed
  ui/screens/                  Compose screens (Login, Home, Settings)

Known limitations (by design, for this MVP)

  • Android has no formal "default alarm clock app" system role the way it does for dialer/browser/home — so this coexists with the stock Clock app rather than replacing it at the OS level. It behaves like a real alarm (status bar icon, lock-screen ring, survives reboot) either way.
  • Background sync is capped at every ~15 minutes by Android's WorkManager (a hard OS minimum for periodic work) — segment edits show up within that window, plus instantly whenever you open the app.
  • No manual "add your own alarm" UI yet, no timer/stopwatch — next phase.

Extending later

Since manual alarms/timer/stopwatch are next: alarm/AlarmScheduler already generalizes to "any future trigger + a request code," so a manual-alarm screen mostly means a new small data source feeding into the same scheduleOne path, not new alarm-firing plumbing.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages