Extract the shared quiet-hours alert dance into one helper#131
Merged
Conversation
sendTemperatureNotification and sendFastDrainNotification were the second and third copies of the same sequence: permission check, channel creation, quiet-hours rerouting to the silent channel, the notification builder boilerplate, and the window-gated alarm sound. A quiet-hours fix (like #111) would have had to be applied to each copy separately. Both now delegate to sendQuietHoursAwareAlert(context, AlertSpec), which is the single home of that behaviour. No functional change: same channels, ids, icons, strings, sound preference and gating as before. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012LC6Qt7Nr8MpJHXuszizNF
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.
What
Review finding #4 from the #121 pass:
sendTemperatureNotificationandsendFastDrainNotificationwere the second and third near-identical copies of the quiet-hours alert sequence — permission check, channel creation, silent-channel rerouting outside the notification window (#111), the builder boilerplate, and the window-gated alarm sound.Both now delegate to a single private
sendQuietHoursAwareAlert(context, AlertSpec); theAlertSpecrecord carries the per-alert channel/id/icon/strings (parameter-count reduction in the style of the existingNotificationConfig).Why
Three copies of the quiet-hours dance meant the next #111-style fix had to be applied three times or alerts would silently diverge in behaviour. Now it has one home.
Behaviour
No functional change — same channels, notification IDs, icons, strings, critical-alert sound preference, and quiet-hours gating as before. Only the log line on missing notification permission is unified (now parameterised by alert name).
Testing
Pure refactor of Android-facing code; covered by the existing suite (
NotificationServiceTestexercises the pure quiet-hours helpers that are unchanged). CI'stestDebugUnitTest+ lint validate the build.🤖 Generated with Claude Code
https://claude.ai/code/session_012LC6Qt7Nr8MpJHXuszizNF
Generated by Claude Code