Skip to content

feat: sentry event detection & notification#182

Merged
vide merged 2 commits intomainfrom
feat/sentry-event-detection
Feb 25, 2026
Merged

feat: sentry event detection & notification#182
vide merged 2 commits intomainfrom
feat/sentry-event-detection

Conversation

@vide
Copy link
Owner

@vide vide commented Feb 24, 2026

Summary

  • Detect sentry mode alert events (center_display_state == "7") via the existing ChargingNotificationWorker (30s polling) — no dedicated foreground service needed
  • Fire heads-up notifications on a dedicated IMPORTANCE_HIGH "Sentry Alerts" channel with 65s debounce on alerting (matches the 1-minute screen-on duration per real event)
  • Show a running event counter next to the sentry red dot on both the dashboard and the home screen widget
  • Counter resets automatically when sentry mode turns off
  • Notification channel created eagerly at app startup so users can configure it in Android settings before any event fires
  • Debug builds include a "Simulate Sentry Event" button in Settings

New files

  • SentryStateDataStore — Preferences DataStore for per-car event persistence
  • SentryStateRepository — Business logic (65s notification debounce, session lifecycle, event counting)
  • SentryNotificationManager — IMPORTANCE_HIGH channel, heads-up alerts with silent counter updates

Modified files

  • CarModels.kt — Added centerDisplayState field + isSentryAlerted accessor
  • ChargingNotificationWorker.kt — Sentry detection in per-car check loop, polling unified to 30s
  • MateDroidApp.kt — Eager sentry channel creation at startup
  • DashboardViewModel/Screen — Sentry event count in UI state + red count text next to dot
  • CarWidget/DisplayData/UpdateWorker — Sentry count in widget preferences + drawn next to dot
  • SettingsViewModel/Screen — Debug "Simulate Sentry Event" button
  • AndroidManifest.xml — No new services (sentry runs in existing worker)
  • String resources in all 4 locales (en, it, es, ca)
  • Both ViewModel test files updated for new dependencies

Test plan

  • ./gradlew testDebugUnitTest — passes
  • ./gradlew lintDebug — no hardcoded strings
  • ./gradlew assembleDebug — builds successfully
  • Manual: debug simulate button fires notification and increments counter
  • Manual: tested with real car — sentry events detected and notified
  • Manual: verify counter resets when sentry mode turns off

🤖 Generated with Claude Code

…counter

Detect sentry mode alert events (center_display_state == "7") by
checking car status in the existing ChargingNotificationWorker (30s
polling). When the sentry warning screen is detected:

- Increment a per-car event counter (persisted in Preferences DataStore)
- Fire a heads-up notification on a dedicated IMPORTANCE_HIGH "Sentry
  Alerts" channel (65s debounce on alerting to match the 1-minute
  screen-on duration per real event)
- Show the running event counter next to the sentry red dot on both
  the dashboard and the home screen widget

Counter resets automatically when sentry mode turns off. Notification
channel is created eagerly at app startup so users can configure it
in Android settings before any event fires.

Debug builds include a "Simulate Sentry Event" button in Settings
that bypasses debounce for manual testing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@vide vide force-pushed the feat/sentry-event-detection branch from 2ffa421 to b5c80a5 Compare February 24, 2026 16:52
- setOnlyAlertOnce only suppresses re-alerting while the notification
  is still visible; if dismissed it alerts again. Use setSilent(true)
  instead for counter-only updates within the debounce window.
- Embed git short SHA in BuildConfig via providers.exec and display
  it next to the version in settings (e.g. "v1.1.0 (abc1234)").

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@vide vide merged commit c839edc into main Feb 25, 2026
1 check passed
@vide vide deleted the feat/sentry-event-detection branch February 25, 2026 11:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant