Skip to content

feat: Add Profile Presets for switching between therapy settings#28

Draft
Copilot wants to merge 4 commits intodevfrom
copilot/create-profile-system-plan
Draft

feat: Add Profile Presets for switching between therapy settings#28
Copilot wants to merge 4 commits intodevfrom
copilot/create-profile-system-plan

Conversation

Copy link
Copy Markdown

Copilot AI commented Apr 6, 2026

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, with totalDailyBasal computed property
  • ProfilePresetStorage — file-based persistence at freeaps/profile_presets.json using existing FileStorage; validates all schedules are non-empty before save/activate
  • Registered in StorageAssembly

Module (standard pattern)

  • ProfilePresetsDataFlow / Provider / StateModel / RootView
  • Save current profile as named preset, activate with confirmation, swipe-to-delete
  • Error alerts when therapy settings are incomplete

Navigation

  • .profilePresets screen case in Screen.swift
  • "Profile Management" section added to TherapySettingsView
  • Search-indexed in SettingItems under Therapy

Safety

  • Save and activate both guard against empty basal/ISF/CR/target arrays
  • Activation overwrites local JSON files only — basal rates are not synced to pump automatically (noted in UI)
  • Broadcaster notifies BasalProfileObserver and BGTargetsObserver on activate

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
Copilot AI requested a review from Sjoerd-Bo3 April 6, 2026 16:48
Copilot AI and others added 4 commits April 6, 2026 20:44
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>
@Sjoerd-Bo3 Sjoerd-Bo3 force-pushed the copilot/create-profile-system-plan branch from ab5c3ec to 30221b9 Compare April 6, 2026 18:45
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