libpebble3: add calendar reminder vibration override#193
Open
kchinnasamy wants to merge 1 commit into
Open
Conversation
## Summary
Adds `NotificationConfig.overrideCalendarVibePattern: String?` to mirror the
existing `overrideDefaultVibePattern` (which covers notifications). When set,
the named pattern is applied to every calendar reminder synced to the watch.
Also adds an optional `vibePattern: List<UInt>?` parameter to:
- `CalendarEvent.toTimelineReminder(timestamp, pinUuid, vibePattern = null)`
- `CalendarEvent.toTimelinePin(calendar, supportsRsvpActions, vibePattern = null)`
Both default to `null` — existing callers are unaffected.
## Motivation
The notification path already supports a global vibration-pattern override via
`overrideDefaultVibePattern`. Calendar reminders are the other major surface
where a user might want to enforce a specific vibration style without per-app
or per-event configuration. The symmetric `overrideCalendarVibePattern` field
closes that gap.
`PhoneCalendarSyncer` is the only producer of calendar `TimelinePin` and
`TimelineReminder` items in libpebble3, so the wiring is contained.
## Implementation
Three files change:
- `LibPebbleConfig.kt` — adds one `String?` field to `NotificationConfig`.
- `CalendarEvent.kt` — `toTimelineReminder` and `toTimelinePin` both gain
an optional `vibePattern: List<UInt>?` parameter. When non-null, the
reminder / pin's attribute block appends `vibrationPattern { it }`.
- `PhoneCalendarSyncer.kt` — resolves the name in `overrideCalendarVibePattern`
to the actual pattern bytes via `VibePatternDao` and passes them to both
builders during sync. Also re-triggers a full calendar sync whenever the
config changes, via a `notificationConfigFlow.flow` collector with
`.distinctUntilChanged().drop(1)`, so an in-flight override change
immediately rewrites the existing pins on the watch instead of waiting
for the next event modification.
## Behavior notes
The watch fires the actual vibration from the `TimelineReminder`, not the
`TimelinePin` — but the pattern is set on both for consistency (the pin's
attribute is harmless when unused).
## Backward compatibility
Non-breaking. New field and parameters all default to `null`; callers that
don't set `overrideCalendarVibePattern` or pass `vibePattern` see no behavior
change. Source-compatible: existing call sites in the monorepo (`composeApp`,
`experimental`, etc.) that build calendar pins/reminders compile without
modification. Changes are confined to the `libpebble3/` module.
## Test plan
- [ ] Set `overrideCalendarVibePattern` to a known pattern name → next
calendar reminder on the watch fires with that pattern
- [ ] Unset the override → next reminder reverts to the bundled default
- [ ] Change the override mid-day → existing pins on the watch get rewritten
(validates the reactive re-sync collector)
- [ ] Leave the override null → behavior identical to before this change
## Context
Same change shipped via matejdro#2 and has
been validated through real-world downstream usage. Upstreaming here so it
lives in coredevices/mobileapp directly and downstream forks don't need to
carry the patch locally.
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
Adds
NotificationConfig.overrideCalendarVibePattern: String?to mirror the existingoverrideDefaultVibePattern(which covers notifications). When set, the named pattern is applied to every calendar reminder synced to the watch.Also adds an optional
vibePattern: List<UInt>?parameter to:CalendarEvent.toTimelineReminder(timestamp, pinUuid, vibePattern = null)CalendarEvent.toTimelinePin(calendar, supportsRsvpActions, vibePattern = null)Both default to
null— existing callers are unaffected.Motivation
The notification path already supports a global vibration-pattern override via
overrideDefaultVibePattern. Calendar reminders are the other major surface where a user might want to enforce a specific vibration style without per-app or per-event configuration. The symmetricoverrideCalendarVibePatternfield closes that gap.PhoneCalendarSynceris the only producer of calendarTimelinePinandTimelineReminderitems in libpebble3, so the wiring is contained.Implementation
Three files change:
LibPebbleConfig.kt— adds oneString?field toNotificationConfig.CalendarEvent.kt—toTimelineReminderandtoTimelinePinboth gain an optionalvibePattern: List<UInt>?parameter. When non-null, the reminder / pin's attribute block appendsvibrationPattern { it }.PhoneCalendarSyncer.kt— resolves the name inoverrideCalendarVibePatternto the actual pattern bytes viaVibePatternDaoand passes them to both builders during sync. Also re-triggers a full calendar sync whenever the config changes, via anotificationConfigFlow.flowcollector with.distinctUntilChanged().drop(1), so an in-flight override change immediately rewrites the existing pins on the watch instead of waiting for the next event modification.Behavior notes
The watch fires the actual vibration from the
TimelineReminder, not theTimelinePin— but the pattern is set on both for consistency (the pin's attribute is harmless when unused).Backward compatibility
Non-breaking. New field and params all default to
null; callers that don't setoverrideCalendarVibePatternor passvibePatternsee no behavior change.Test plan
overrideCalendarVibePatternto a known pattern name → next calendar reminder on the watch fires with that pattern