feat: Add Profile Presets for switching between therapy settings#28
Draft
feat: Add Profile Presets for switching between therapy settings#28
Conversation
Copilot
AI
changed the title
[WIP] Outline profile system for managing sports schedules
feat: Add Profile Presets for switching between therapy settings
Apr 6, 2026
Implements a profile preset system that allows users to: - Save current therapy settings (Basal, ISF, CR, Glucose Targets) as named presets - View saved presets with summary info (total daily basal, entry counts) - Activate a preset to restore saved settings - Delete presets via swipe-to-delete Components: - ProfilePreset model (JSON-serializable) - ProfilePresetStorage (file-based storage using existing FileStorage) - ProfilePresets module (DataFlow, Provider, StateModel, RootView) - Navigation integration (Screen, SettingItems, TherapySettingsView) - Xcode project references for all new files Agent-Logs-Url: https://github.com/Sjoerd-Bo3/Trio/sessions/366f341c-cce7-40cc-838e-7f9297cb2c2c Co-authored-by: Sjoerd-Bo3 <2100083+Sjoerd-Bo3@users.noreply.github.com>
- Validate that therapy settings are non-empty before saving as preset - Validate preset data before activating to prevent unsafe configurations - Return optionals/booleans from save/activate to propagate validation errors - Add error alerts for save and activate failures - Fix pluralization in preset detail view for better localizability Agent-Logs-Url: https://github.com/Sjoerd-Bo3/Trio/sessions/366f341c-cce7-40cc-838e-7f9297cb2c2c Co-authored-by: Sjoerd-Bo3 <2100083+Sjoerd-Bo3@users.noreply.github.com>
Extract totalDailyBasal as a computed property on ProfilePreset for better code organization and reusability. Agent-Logs-Url: https://github.com/Sjoerd-Bo3/Trio/sessions/366f341c-cce7-40cc-838e-7f9297cb2c2c Co-authored-by: Sjoerd-Bo3 <2100083+Sjoerd-Bo3@users.noreply.github.com>
ab5c3ec to
30221b9
Compare
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.
Adds a profile preset system so users can save and restore complete therapy configurations (Basal, ISF, CR, Glucose Targets) — enabling quick switches for sport days, sick days, etc.
Model & Storage
ProfilePreset— JSON-serializable struct holding all four therapy schedules, withtotalDailyBasalcomputed propertyProfilePresetStorage— file-based persistence atfreeaps/profile_presets.jsonusing existingFileStorage; validates all schedules are non-empty before save/activateStorageAssemblyModule (standard pattern)
ProfilePresetsDataFlow/Provider/StateModel/RootViewNavigation
.profilePresetsscreen case inScreen.swiftTherapySettingsViewSettingItemsunder TherapySafety
BroadcasternotifiesBasalProfileObserverandBGTargetsObserveron activate