feat: expand profile presets with icons, homescreen indicator, adjustments tab, and charts#30
Conversation
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>
475cabd to
bd18207
Compare
ab5c3ec to
30221b9
Compare
|
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? |
|
@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>
Fixed in |
|
@copilot /Users/sjoerdbozon/Trio-dev/Trio/Sources/Modules/ProfilePresets/View/ProfilePresetsRootView.swift /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>
Fixed in
|
|
@copilot good, a few edits:
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>
…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>
…ry leak 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>
Agent-Logs-Url: https://github.com/Sjoerd-Bo3/Trio/sessions/7441a9a9-85b9-4136-aff3-e1a681f0bd41 Co-authored-by: Sjoerd-Bo3 <2100083+Sjoerd-Bo3@users.noreply.github.com>
…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>
…ondition 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>
…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>
…e option 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>
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>
refreshProfileDivergence()calls tosettingsDidChange,preferencesDidChange,basalProfileDidChange,bgTargetsDidChange.onMove, following override/temp target pattern