Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Override watch #239

Draft
wants to merge 57 commits into
base: dev
Choose a base branch
from
Draft

Conversation

avouspierre
Copy link
Contributor

Override on Apple Watch in extension of the PR #238.

Add the capacity to manage override with Apple Watch :

  • allows to select a override preset (or a temp target) in AW
  • allows to cancel a current override preset or specific override (idem for temp target) in AW
  • add a color profil for override profil in AW
  • Fix some minor code in AW
override display override in NS
CleanShot 2024-05-19 at 20 47 23 CleanShot 2024-05-19 at 20 50 17

avouspierre and others added 30 commits May 26, 2024 16:48
The PR includes a large refactoring of the swift part of override/profile functions :
- Override is stored in override core data, including history
- Override preset is stored in overridepreset core data
- Add the display of the override in main graph
- add the upload of override as a exercice in Nightscout - Fix nightscout#145
- improve the management of indefinate override / stop of indefinate override
- modify the code to respect the Ivan’s patterns of the app :
     - Use of swiftInject (dependency injection) with the use of protocol class in the code
     - Use of MVP principes, in particular not use of direct coredata in view class
     - Use of a proxy model class between coredata and the app to manage changes of core data
     - Use of the pattern of observe to refresh data/view/uploads

- add a core data unit tests allowing to add tests for coredata with a in-memory datastore for tests.
- test for overrideStorage available

This PR do NOT change the logic with oref and the interface of override informations in oref. This PR do NOT require a update of trio-oref code.

TODO : Changes the shortcuts after merging with PR nightscout#144  and add watch for overrides.
The PR includes a large refactoring of the swift part of override/profile functions :
- Override is stored in override core data, including history
- Override preset is stored in overridepreset core data
- Add the display of the override in main graph
- add the upload of override as a exercice in Nightscout - Fix nightscout#145
- improve the management of indefinate override / stop of indefinate override
- modify the code to respect the Ivan’s patterns of the app :
     - Use of swiftInject (dependency injection) with the use of protocol class in the code
     - Use of MVP principes, in particular not use of direct coredata in view class
     - Use of a proxy model class between coredata and the app to manage changes of core data
     - Use of the pattern of observe to refresh data/view/uploads

- add a core data unit tests allowing to add tests for coredata with a in-memory datastore for tests.
- test for overrideStorage available

This PR do NOT change the logic with oref and the interface of override informations in oref. This PR do NOT require a update of trio-oref code.

TODO : Changes the shortcuts after merging with PR nightscout#144  and add watch for overrides.
The PR includes a large refactoring of the swift part of override/profile functions :
- Override is stored in override core data, including history
- Override preset is stored in overridepreset core data
- Add the display of the override in main graph
- add the upload of override as a exercice in Nightscout - Fix nightscout#145
- improve the management of indefinate override / stop of indefinate override
- modify the code to respect the Ivan’s patterns of the app :
     - Use of swiftInject (dependency injection) with the use of protocol class in the code
     - Use of MVP principes, in particular not use of direct coredata in view class
     - Use of a proxy model class between coredata and the app to manage changes of core data
     - Use of the pattern of observe to refresh data/view/uploads

- add a core data unit tests allowing to add tests for coredata with a in-memory datastore for tests.
- test for overrideStorage available

This PR do NOT change the logic with oref and the interface of override informations in oref. This PR do NOT require a update of trio-oref code.

TODO : Changes the shortcuts after merging with PR nightscout#144  and add watch for overrides.
fix when preset has no id
use async to update overrideObserver.
Add a (purple) color for override
fix the name of the class
Fix a issue when you want to extend a current preset.
Improve override Observer to avoid to have too many call to core date.
Add the capacity to manage override with Apple Watch :

- allows to select a override preset (or a temp target) in AW
- allows to cancel a current override preset or specific override (idem for temp target) in AW
- add a color profil for override profil in AW
- Fix some minor code in AW
* Extracted the FPU processing logic into a new helper function `processFPU`, which ensures that each carb equivalent is at least 1.0 grams by adjusting the interval if necessary.
* Added logic in new helper function`processFPU` to adjust the interval when the calculated carb equivalent is less than 1.0 grams.
* Adjusted spread over time by computing duration again so total carb equivalents remain consistent
* Refactored the main `storeCarbs` function to be more concise and easier to understand.
* Introduced detailed docstrings to explain the purpose and functionality of the `storeCarbs`, `processFPU`, and `calculateComputedDuration` functions.
…already saved profile overrides - Swipe left to edit or delete - Get list of all settings included in the override when saving a new one or editing an existing one
- presetPopover and editPresetPopover
…en .onDisappear from the editPresetPopover back to root view behave the same way as .onAppear in root view when coming from home screen, that is: - If ongoing override, populate settings with the ongoing override setting. - If no ongoing override, populate settings with user defaults And when entering edit by selecting edit on any override -> populate the settings in edit mode with that selected overrides settings as starting point for the edit

Refactor code based on  input from @avouspierre
- Change Profile Editor Slider Numbering Positioning (reuse @dnzxy old iAPS commit )
- Enable editing Name, Target and Duration for preset temp targets
- Swipe left to edit or delete
- Replaced display of "Low target - High target" in presetView since only low target is used
Sjoerd-Bo3 and others added 24 commits May 31, 2024 21:33
The PR includes a large refactoring of the swift part of override/profile functions :
- Override is stored in override core data, including history
- Override preset is stored in overridepreset core data
- Add the display of the override in main graph
- add the upload of override as a exercice in Nightscout - Fix nightscout#145
- improve the management of indefinate override / stop of indefinate override
- modify the code to respect the Ivan’s patterns of the app :
     - Use of swiftInject (dependency injection) with the use of protocol class in the code
     - Use of MVP principes, in particular not use of direct coredata in view class
     - Use of a proxy model class between coredata and the app to manage changes of core data
     - Use of the pattern of observe to refresh data/view/uploads

- add a core data unit tests allowing to add tests for coredata with a in-memory datastore for tests.
- test for overrideStorage available

This PR do NOT change the logic with oref and the interface of override informations in oref. This PR do NOT require a update of trio-oref code.

TODO : Changes the shortcuts after merging with PR nightscout#144  and add watch for overrides.
Update override profile view with integration of the new editor function.
sort the preset by name in the override storage
<id: preset.id ?? UUID().uuidString,>
Breaking bug fix, provide UUID().uuidString when preset.id is null
•Change "exercice" to "exercise" throughout code - needed for NS to process properly as an exercise event
•Did not modify FR localization files
- Observer update to reduce the call of core data
- manage a id issue between preset and override temp
- remove try? with core date save
- use Profile instead Profil
- manage the store of enabled attribute in regard of current()
- other minor code improvements
- update overrideprofile name
@Sjoerd-Bo3 Sjoerd-Bo3 added enhancement New feature or request Pre 1.0 labels Jun 8, 2024
@Sjoerd-Bo3 Sjoerd-Bo3 added this to the Trio 1.0 release milestone Jun 8, 2024
@Sjoerd-Bo3 Sjoerd-Bo3 removed this from the Trio 0.2.0 release milestone Aug 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Post 1.0
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

7 participants