[Part 1 of 3] refactor: add cgm lifecycle progress and support new alerting system - #42
[Part 1 of 3] refactor: add cgm lifecycle progress and support new alerting system#42ETolboom wants to merge 4 commits into
Conversation
There was a problem hiding this comment.
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
Alertissuance/retraction for lifecycle conditions. - Added
LibreSensorLifecyclemodel and surfaced lifecycle status viacgmStatusHighlight,cgmStatusBadge, andcgmLifecycleProgress. - 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.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
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 |
|
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 |
|
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. |
Replaces the plugin's legacy
UNUserNotificationCenter-based alerting (NotificationHelper, glucose schedules, snooze/critical-alarm UI) with LoopKit's nativeAlertframework, and addsCGMManagerUIsensor 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):