Skip to content

feat: expand profile presets with icons, homescreen indicator, adjustments tab, and charts#30

Draft
Copilot wants to merge 27 commits intocopilot/create-profile-system-planfrom
copilot/expand-profile-switcher-settings
Draft

feat: expand profile presets with icons, homescreen indicator, adjustments tab, and charts#30
Copilot wants to merge 27 commits intocopilot/create-profile-system-planfrom
copilot/expand-profile-switcher-settings

Conversation

Copy link
Copy Markdown

Copilot AI commented Apr 6, 2026

  • Explore codebase to understand current implementation
  • Add tap-to-activate with confirmation for profile presets in Adjustments tab
  • Show active profile banner in Adjustments tab matching overrides/temp targets style
  • Add divergence detection (settingsMatchPreset) and "modified" indicators
  • Improve compare UI with separate picker rows
  • Fix homescreen divergence detection: Added refreshProfileDivergence() calls to settingsDidChange, preferencesDidChange, basalProfileDidChange, bgTargetsDidChange
  • Add "Update Preset to Current" feature: Context menu "Update to Current Settings" on diverged active presets in both views
  • Add reordering of presets in Adjustments tab: Drag-and-drop via .onMove, following override/temp target pattern
  • Run validation - code review passed, CodeQL infra issue only (0 alerts)

Copilot AI and others added 8 commits April 6, 2026 20:39
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>
…tage adjustment

- Add SMBPresetSettings and DynamicPresetSettings sub-structs to ProfilePreset model
- Add scaled(by:name:) method for creating percentage-adjusted profile copies
- Update ProfilePresetStorage to capture and restore SMB/Dynamic settings
- Add save sheet with toggles for including SMB and Dynamic ISF settings
- Add adjustment sheet with stepper, preview, and name input
- Show SMB/Dynamic badges on preset rows
- Update activate confirmation to mention extra settings

Agent-Logs-Url: https://github.com/Sjoerd-Bo3/Trio/sessions/35d6a8d9-9d60-469f-87bb-b68d2e9465f1

Co-authored-by: Sjoerd-Bo3 <2100083+Sjoerd-Bo3@users.noreply.github.com>
…e preferences update

Agent-Logs-Url: https://github.com/Sjoerd-Bo3/Trio/sessions/35d6a8d9-9d60-469f-87bb-b68d2e9465f1

Co-authored-by: Sjoerd-Bo3 <2100083+Sjoerd-Bo3@users.noreply.github.com>
…file comparison view

- Add settings summary showing current basal, ISF, CR, and targets in the save preset sheet
- Add PresetDetailView showing all stored settings for a preset (basal schedule, ISF, CR, targets, SMB, Dynamic ISF)
- Add ComparisonView for side-by-side comparison of two presets or preset vs current profile
- Add loadCurrentProfile() to provider/storage for fetching active settings
- Add Compare Presets section with picker for selecting two presets to compare
- Add View Details and Compare with Current buttons on each preset row

Agent-Logs-Url: https://github.com/Sjoerd-Bo3/Trio/sessions/43c3cb44-d27f-4e58-be7b-eb074b08936b

Co-authored-by: Sjoerd-Bo3 <2100083+Sjoerd-Bo3@users.noreply.github.com>
- Extract loadCurrentTherapySettings(), currentSMBSettings(), currentDynamicSettings() in storage
- Add defaultComparisonPresetA/B computed properties to StateModel
- Remove duplicated picker binding logic in RootView

Agent-Logs-Url: https://github.com/Sjoerd-Bo3/Trio/sessions/43c3cb44-d27f-4e58-be7b-eb074b08936b

Co-authored-by: Sjoerd-Bo3 <2100083+Sjoerd-Bo3@users.noreply.github.com>
@Sjoerd-Bo3 Sjoerd-Bo3 force-pushed the copilot/expand-profile-switcher-settings branch from 475cabd to bd18207 Compare April 6, 2026 18:40
@Sjoerd-Bo3 Sjoerd-Bo3 force-pushed the copilot/create-profile-system-plan branch from ab5c3ec to 30221b9 Compare April 6, 2026 18:45
@Sjoerd-Bo3
Copy link
Copy Markdown
Owner

Build input file cannot be found: '/Users/sjoerdbozon/Trio-dev/ProfilePresetStorage.swift'. Did you forget to declare this file as an output of a script phase or custom build rule which produces it?

@Sjoerd-Bo3
Copy link
Copy Markdown
Owner

@copilot Build input file cannot be found: '/Users/sjoerdbozon/Trio-dev/ProfilePresetStorage.swift'. Did you forget to declare this file as an output of a script phase or custom build rule which produces it?

The file had PBXFileReference and PBXBuildFile entries but was missing
from its parent PBXGroup, causing Xcode to fail resolving its path.

Agent-Logs-Url: https://github.com/Sjoerd-Bo3/Trio/sessions/0b7013ac-4bd3-4199-89ad-021f2d52f040

Co-authored-by: Sjoerd-Bo3 <2100083+Sjoerd-Bo3@users.noreply.github.com>
Copy link
Copy Markdown
Author

Copilot AI commented Apr 6, 2026

@copilot Build input file cannot be found: '/Users/sjoerdbozon/Trio-dev/ProfilePresetStorage.swift'. Did you forget to declare this file as an output of a script phase or custom build ...

Fixed in 7ce26fe. The ProfilePresetStorage.swift file had PBXFileReference and PBXBuildFile entries in the project but was missing from the Storage PBXGroup's children list. Xcode couldn't resolve the relative path without the group membership. Added it to the Storage group alongside the other storage files.

@Sjoerd-Bo3
Copy link
Copy Markdown
Owner

@copilot /Users/sjoerdbozon/Trio-dev/Trio/Sources/Modules/ProfilePresets/View/ProfilePresetsRootView.swift
/Users/sjoerdbozon/Trio-dev/Trio/Sources/Modules/ProfilePresets/View/ProfilePresetsRootView.swift:392:33 Cannot convert value of type 'String' to expected argument type 'LocalizedStringKey'

/Users/sjoerdbozon/Trio-dev/Trio/Sources/Modules/ProfilePresets/View/ProfilePresetsRootView.swift:703:17 Generic struct 'Picker' requires that 'ProfilePreset' conform to 'Hashable'

/Users/sjoerdbozon/Trio-dev/Trio/Sources/Modules/ProfilePresets/View/ProfilePresetsRootView.swift:703:17 Initializer 'init(_:selection:content:)' requires that 'ProfilePreset' conform to 'Hashable'

/Users/sjoerdbozon/Trio-dev/Trio/Sources/Modules/ProfilePresets/View/ProfilePresetsRootView.swift:711:43 Referencing instance method 'tag(_:includeOptional:)' on 'Optional' requires that 'ProfilePreset' conform to 'Hashable'

- Add Hashable conformance with hash(into:) using id, required by
  SwiftUI Picker/tag in comparison view
- Use Text(string) instead of Text(string, comment:) for already-
  localized adjustmentDescription string

Agent-Logs-Url: https://github.com/Sjoerd-Bo3/Trio/sessions/675554ef-2b3e-4744-9e3c-de5c44108af0

Co-authored-by: Sjoerd-Bo3 <2100083+Sjoerd-Bo3@users.noreply.github.com>
Copy link
Copy Markdown
Author

Copilot AI commented Apr 6, 2026

@copilot /Users/sjoerdbozon/Trio-dev/Trio/Sources/Modules/ProfilePresets/View/ProfilePresetsRootView.swift
/Users/sjoerdbozon/Trio-dev/Trio/Sources/Modules/ProfilePresets/View/ProfilePresetsRootView....

Fixed in e58ff6c. Two changes:

  • Added Hashable conformance to ProfilePreset (with hash(into:) using id), which is required by the SwiftUI Picker and .tag() in the comparison view.
  • Changed Text(adjustmentDescription, comment:) to Text(adjustmentDescription) since the string is already localized via String(localized:) and the two-argument Text initializer expects LocalizedStringKey, not String.

@Sjoerd-Bo3
Copy link
Copy Markdown
Owner

@copilot good, a few edits:

  • I would like to see on the homescreen (under the glucose bobble and above the IOB/COB/basalrate row) what profile is selected Icon + name (also we need to be able to set an icon for a profile preset.
  • And would be nice if profile preset selection also lived under the adjustments tab as a new tab besides temp targets. (but only setting?)
  • Also in the preset profile editor we need to use the same layout for the daily basal, ISF, CR and targets as the setting pages with the charts but not editable ofc. Also those pages should be under the Save profile popup as tabs. With a summary on the last page and always a confirm on saving, overriding and activating of the preset presets.

also make sure everywhere ISF and CR are also displayed for mmol (use the helper what we use everywhere)

…sRootView

Agent-Logs-Url: https://github.com/Sjoerd-Bo3/Trio/sessions/9f9f5e10-00e5-4dd9-a270-1e18310f27b8

Co-authored-by: Sjoerd-Bo3 <2100083+Sjoerd-Bo3@users.noreply.github.com>
Copilot AI and others added 3 commits April 6, 2026 21:22
…o-detail navigation

Agent-Logs-Url: https://github.com/Sjoerd-Bo3/Trio/sessions/14fa85ec-a3c0-4813-ab5e-355ebcb92d0d

Co-authored-by: Sjoerd-Bo3 <2100083+Sjoerd-Bo3@users.noreply.github.com>
…ary pills

Agent-Logs-Url: https://github.com/Sjoerd-Bo3/Trio/sessions/14fa85ec-a3c0-4813-ab5e-355ebcb92d0d

Co-authored-by: Sjoerd-Bo3 <2100083+Sjoerd-Bo3@users.noreply.github.com>
…olve type conflict

Agent-Logs-Url: https://github.com/Sjoerd-Bo3/Trio/sessions/f01cd944-bdea-4ee2-b45b-f4f4362126f0

Co-authored-by: Sjoerd-Bo3 <2100083+Sjoerd-Bo3@users.noreply.github.com>
Copilot AI and others added 2 commits April 6, 2026 21:45
…e, tabbed detail view

Agent-Logs-Url: https://github.com/Sjoerd-Bo3/Trio/sessions/8edb7a73-a333-475a-8c8e-ac99786e3de1

Co-authored-by: Sjoerd-Bo3 <2100083+Sjoerd-Bo3@users.noreply.github.com>
Copilot AI and others added 4 commits April 6, 2026 22:04
…rofile presets in Adjustments tab

Agent-Logs-Url: https://github.com/Sjoerd-Bo3/Trio/sessions/e584d394-2b94-4bb5-b604-ba3d84ff007c

Co-authored-by: Sjoerd-Bo3 <2100083+Sjoerd-Bo3@users.noreply.github.com>
… settings differ from active preset

Agent-Logs-Url: https://github.com/Sjoerd-Bo3/Trio/sessions/e584d394-2b94-4bb5-b604-ba3d84ff007c

Co-authored-by: Sjoerd-Bo3 <2100083+Sjoerd-Bo3@users.noreply.github.com>
…nt, add reordering

Agent-Logs-Url: https://github.com/Sjoerd-Bo3/Trio/sessions/8eb0db64-9f95-41a3-bd8b-5f8fa3a15bc8

Co-authored-by: Sjoerd-Bo3 <2100083+Sjoerd-Bo3@users.noreply.github.com>
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