feat: sentry event detection & notification#182
Merged
Conversation
…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>
2ffa421 to
b5c80a5
Compare
- 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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
center_display_state == "7") via the existingChargingNotificationWorker(30s polling) — no dedicated foreground service neededNew files
SentryStateDataStore— Preferences DataStore for per-car event persistenceSentryStateRepository— Business logic (65s notification debounce, session lifecycle, event counting)SentryNotificationManager— IMPORTANCE_HIGH channel, heads-up alerts with silent counter updatesModified files
CarModels.kt— AddedcenterDisplayStatefield +isSentryAlertedaccessorChargingNotificationWorker.kt— Sentry detection in per-car check loop, polling unified to 30sMateDroidApp.kt— Eager sentry channel creation at startupDashboardViewModel/Screen— Sentry event count in UI state + red count text next to dotCarWidget/DisplayData/UpdateWorker— Sentry count in widget preferences + drawn next to dotSettingsViewModel/Screen— Debug "Simulate Sentry Event" buttonAndroidManifest.xml— No new services (sentry runs in existing worker)Test plan
./gradlew testDebugUnitTest— passes./gradlew lintDebug— no hardcoded strings./gradlew assembleDebug— builds successfully🤖 Generated with Claude Code