Skip to content

libpebble3: add calendar reminder vibration override#193

Open
kchinnasamy wants to merge 1 commit into
coredevices:masterfrom
kchinnasamy:upstream/vibration-override
Open

libpebble3: add calendar reminder vibration override#193
kchinnasamy wants to merge 1 commit into
coredevices:masterfrom
kchinnasamy:upstream/vibration-override

Conversation

@kchinnasamy
Copy link
Copy Markdown

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.kttoTimelineReminder 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 params all default to null; callers that don't set overrideCalendarVibePattern or pass vibePattern see no behavior change.

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

## 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.
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented May 16, 2026

CLA assistant check
All committers have signed the CLA.

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.

2 participants