Skip to content

[Part 1 of 3] refactor: add cgm lifecycle progress and support new alerting system - #42

Open
ETolboom wants to merge 4 commits into
LoopKit:mainfrom
ETolboom:feat/cgm-lifecycle+alerts
Open

[Part 1 of 3] refactor: add cgm lifecycle progress and support new alerting system#42
ETolboom wants to merge 4 commits into
LoopKit:mainfrom
ETolboom:feat/cgm-lifecycle+alerts

Conversation

@ETolboom

@ETolboom ETolboom commented Aug 18, 2026

Copy link
Copy Markdown

Replaces the plugin's legacy UNUserNotificationCenter-based alerting (NotificationHelper, glucose schedules, snooze/critical-alarm UI) with LoopKit's native Alert framework, and adds CGMManagerUI sensor lifecycle surfaces (expiring/signal-loss/failed/unactivated), mirroring SyaiKit's and LibreLoop's alerting pattern. Glucose-threshold alerting is now owned by the app, not the plugin.

Part 1 of 3 related PRs (independent of the other two, but they build on top of this one in my fork):

  1. This PR
  2. [Part 2 of 3] fix: disable redundant glucose smoothing #43 — fix: disable redundant glucose smoothing
  3. [Part 3 of 3] refactor: rework CGM settings screen and persist sensor state across launches #44 — feat/settings view rework

Copilot AI lite review requested due to automatic review settings August 18, 2026 09:16
@ETolboom ETolboom changed the title refactor: add cgm lifecycle progress and support new alerting system [Part 1 of 3] refactor: add cgm lifecycle progress and support new alerting system Aug 18, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors LibreTransmitter’s user-facing alerting away from the legacy UNUserNotificationCenter/custom glucose-schedule system and toward LoopKit’s native Alert framework, while also adding CGM lifecycle UI surfaces (CGMManagerUI) for sensor status (warmup/expiring/signal-loss/failed/unactivated).

Changes:

  • Replaced legacy notification helper + glucose-schedule/snooze/critical-alarm UI with LoopKit Alert issuance/retraction for lifecycle conditions.
  • Added LibreSensorLifecycle model and surfaced lifecycle status via cgmStatusHighlight, cgmStatusBadge, and cgmLifecycleProgress.
  • Removed now-obsolete settings screens and persistence types related to glucose-threshold alerting/notification toggles.

Reviewed changes

Copilot reviewed 25 out of 26 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
LibreTransmitterUI/Views/Setup/Libre2DirectSetup.swift Removes calibration/setup completion local notifications.
LibreTransmitterUI/Views/Setup/BluetoothSelection.swift Stops requesting notification permissions during BT selection.
LibreTransmitterUI/Views/Settings/SnoozeView.swift Removed legacy snooze UI for glucose schedule alarms.
LibreTransmitterUI/Views/Settings/SettingsView.swift Removes alarm/notification-related settings navigation and state.
LibreTransmitterUI/Views/Settings/NotificationSettingsView.swift Removed legacy notification toggles UI.
LibreTransmitterUI/Views/Settings/AlarmSettings/CustomDataPickerView.swift Removed legacy alarm schedule time picker UI.
LibreTransmitterUI/Views/Settings/AlarmSettings/CriticalAlarmsVolumeView.swift Removed critical alarm volume UI tied to legacy notifications.
LibreTransmitterUI/Views/Settings/AlarmSettings/AlarmSettingsView.swift Removed legacy glucose-threshold alarm schedule editor.
LibreTransmitterUI/LibreTransmitterManager+UI.swift Adds LoopKit CGM lifecycle progress/highlight/badge based on sensorLifecycle.
LibreTransmitter/Observables/AlarmStatus.swift Removed observable state used by legacy schedule alarms UI.
LibreTransmitter/NotificationHelperOverride.swift Removed legacy critical-alert override toggle file.
LibreTransmitter/NotificationHelper.swift Removed legacy UNNotification-based alerting implementation.
LibreTransmitter/LibreTransmitterManagerV3.swift Adds lifecycle-tracking state and uses it for status + alert evaluation.
LibreTransmitter/LibreTransmitterManager+Transmitters.swift Stops issuing legacy notifications; records lifecycle faults/state instead.
LibreTransmitter/LibreTransmitterManager+Libre2EU.swift Removes legacy “sensor expiring” notification path for Libre2 BLE.
LibreTransmitter/Alerting/LibreTransmitterManagerV3+Alerts.swift New: issues/retracts LoopKit Alerts based on lifecycle condition diffs.
LibreTransmitter/Alerting/LibreSensorLifecycle.swift New: unified lifecycle computation across classic and Libre2 direct-BLE paths.
LibreTransmitter/Alerting/LibreAlertCondition.swift New: maps lifecycle conditions to LoopKit Alert content + severity.
LibreTransmitter/.gitignore Removes ignore rule for deleted NotificationHelperOverride file.
LibreTransmitter.xcodeproj/project.pbxproj Removes legacy sources; adds new alerting/lifecycle sources/groups.
Features.swift Removes legacy vibration feature flag tied to glucose alarms.
Common/Settings/UserDefaults+Bluetooth.swift Adds dangerModeActivated persistence (migrated from removed alarm settings file).
Common/Settings/UserDefaults+Alarmsettings.swift Removed legacy alarm/notification/glucose-schedule defaults storage.
Common/Settings/GlucoseSchedules.swift Removed legacy glucose schedule + snooze model.
build.md Removes build steps related to legacy vibration/critical-alerts notifications.
.gitignore Removes ignore rule for deleted NotificationHelperOverride file.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread LibreTransmitter/Alerting/LibreTransmitterManagerV3+Alerts.swift Outdated
Comment thread LibreTransmitter/LibreTransmitterManager+Transmitters.swift
Comment thread LibreTransmitterUI/LibreTransmitterManager+UI.swift
@dabear

dabear commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the contribution. However, please rebase on top of the next-dev branch and submit a new PR against that branch directly, or much of the code refactors there would get merge conflicts

@dabear

dabear commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator

Also, smaller PRs are much welcome, makes them easier to review and test locally. Ideally I test everything individually for a week locally before merging, even applies to my own commits. Would be great to have lifecycle progress in a separate PR for example

@ETolboom

Copy link
Copy Markdown
Author

Hi dabear,

Thanks for taking a look. Ill make sure to create a new PR rebased on your work in dev-next. Looking at the branch I think we indeed have quite some overlap so I'll try to base it on your changes.

As for your second comment: I will split this current PR to make it more manageable.

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.

3 participants