Artificial-Pancreas / iAPS

MIT License
176 stars 720 forks source link

Upload of profile data to NS does not happen when main settings is closed by swipe down, only when tapping "Close" #260

Closed bjornoleh closed 1 year ago

bjornoleh commented 1 year ago

If I make a change to e.g DIA in iAPS Pump Settings, and Save on Pump, then go back to main settings screen and tap "Close" in upper left hand corner, the changed DIA gets uploaded to NS profiles.

However, if I instead after Save on Pump directly close Pump Settings by swiping down, or go to main settings and then swipe down, DIA is not uploaded to NS profiles. If I go back into main settings and tap "Close", the change is uploaded to NS.

The same holds for changes to ISF and CR.

We should check the condition that forces the upload. Obviously, tapping "Close" and swiping down is not the same in this context. Both should do the same, of course.

bjornoleh commented 1 year ago

Settings are uploaded by the function

func hideSettingsModal() {
            nightscoutManager.uploadProfile()
            hideModal()
        }

https://github.com/Artificial-Pancreas/iAPS/blob/a0daab8e9118baecc2ad2173be495d1c2aa6b033/FreeAPS/Sources/Modules/Settings/SettingsStateModel.swift#L49-L57

This is activated by tapping the "Close" button in main settings view:

.navigationBarItems(leading: Button("Close", action: state.hideSettingsModal))

https://github.com/Artificial-Pancreas/iAPS/blob/a0daab8e9118baecc2ad2173be495d1c2aa6b033/FreeAPS/Sources/Modules/Settings/View/SettingsRootView.swift#L127

I suppose we need to make this happen with a swipe down too, or change the logic related to profile uploads.

bjornoleh commented 1 year ago

In dev, the upload and hideSettingsModal function has been changed a bit: https://github.com/Artificial-Pancreas/iAPS/blob/5f4e1a958ef122fc0ab838ed76bdad8d73b8cd6e/FreeAPS/Sources/Modules/Settings/SettingsStateModel.swift#L49-L56

bjornoleh commented 1 year ago

I had a look, but could not get the native swipe down action to upload settings. Will need to hand it over to someone else.

Jon-b-m commented 1 year ago

Fixed in dev!