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

Force reload from UserDefaults #2279

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

motinis
Copy link

@motinis motinis commented Jan 6, 2025

Purpose: this fix a display issue whereby changing an Algorithm Experiment then backing out from Algorithm experiments section and back in (without closing settings) results in the data being displayed as it initially appeared. This issue is mentioned in this comment (#2267 (comment)) - note that issue 2267 (which also has similar behavior in terms of a view not being updated despite the underlying data being saved) is however unrelated and thus this PR doesn't address it.

This is caused by the view being discarded from the render tree and then being restored as it was initialized.

This fix addresses this and cleans up the code as well by using AppStorage - the selection views themselves then only work with the Bindings and not directly with UserDefaults.

@marionbarker
Copy link
Contributor

Summary

This fixes a display glitch:

With an iOS 18 phone, there was a display glitch where changes to Algorithm Experiments (AE) settings were made but not consistently displayed:

  • In the AE screen, modify one or more selection
  • Return to Settings and then back to AE screen: old values are displayed
  • If the app is taken to a different screen (for example Predicted Glucose), an IRC change is clearly visible in the display
  • Return again to the AE screen, the new selection is displayed
  • Same behavior was seen when app was quit and restarted; the new selection was properly displayed in the AE screen

This PR fixes this.

Note there are similar display glitches to other screens but they are not addressed with this PR.

Test

Test phone: SE running iOS 18.2.1
Build: Loop 3.4.4
Apply this PR to build.

Test changes to AE settings

Test phone started with GBPA on and IRC off.
Modified settings to GBPA off and IRC on.
Return to the AE screen and selected changes are displayed.

Tap on Predicted Glucose and the IRC component now visible
Next Loop cycle, the debug log shows GBPA is off (effectiveBolusApplicationFactor: 0.40)

Test more changes to AE settings

Repeat the test by enabling GPBA and disabling IRC and the settings are displayed correctly and have the expected effect.

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