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

Only store CGM address to user defaults when app is set as "Active CGM", and fix typo in "CGM" #398

Open
wants to merge 5 commits into
base: bjorn
Choose a base branch
from

Conversation

bjornoleh
Copy link
Contributor

No description provided.

@bjornoleh bjornoleh changed the title Fix typo in "CGM" Only store CGM address to user defaults when app is set as "Active CGM", and fix typo in "CGM" Nov 24, 2022
@bjornoleh
Copy link
Contributor Author

bjornoleh commented Nov 24, 2022

The intention with this commit is to avoid having the app set as "inactive CGM" (setActiveCGM = off) to store the wrong CGM transmitter address to shared user defaults, which will break the Heartbeat mechanism for FreeAPS X. This is in the context of using two instances of xdrip4iOS when running overlapping sensor sessions with Anubis G6.

I am not sure if this will work as intended, but at least it builds.

@JohanDegraeve
Copy link
Owner

there is already an option "Suppress Loop Share" in the developer settings,
that suppress also setting the cgm transmitter address
see

if !UserDefaults.standard.suppressLoopShare {

@bjornoleh
Copy link
Contributor Author

there is already an option "Suppress Loop Share" in the developer settings, that suppress also setting the cgm transmitter address see

if !UserDefaults.standard.suppressLoopShare {

Oh, I didn’t realise, thanks! Then this should probably be tied to the “Set as active CGM” setting then. Suppress loop share = off when active CGM is on, suppress loop share = on when active CGM is off?

@JohanDegraeve
Copy link
Owner

there is already an option "Suppress Loop Share" in the developer settings, that suppress also setting the cgm transmitter address see

if !UserDefaults.standard.suppressLoopShare {

Oh, I didn’t realise, thanks! Then this should probably be tied to the “Set as active CGM” setting then. Suppress loop share = off when active CGM is on, suppress loop share = on when active CGM is off?

yes it would be better to set suppressLoopShare accordingly

…lts if the app is set as Active CGM"

This reverts commit 87d56c3.
case .setActiveCGM:
UserDefaults.standard.suppressLoopShare = !isOn
@bjornoleh
Copy link
Contributor Author

@JohanDegraeve , I think I have set suppressLooppShare correctly now, please see bjornoleh@951a454

@bjornoleh
Copy link
Contributor Author

This change removes the risk of accidentally breaking the heartbeat mechanism by opening the wrong app. But it is still required to force close and reopen the app to guarantee that the transmitter address is written to shared user defaults ( the last opened app will write its transmitter address upon start). Would it be possible to force the current app to write the transmitter address when we switch on SetActiveCGM, without a restar of the app?

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