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

Sensing settings reset when switching to a new channel #12

Open
shankari opened this issue Aug 29, 2017 · 6 comments
Open

Sensing settings reset when switching to a new channel #12

shankari opened this issue Aug 29, 2017 · 6 comments

Comments

@shankari
Copy link
Contributor

I ran into this issue while testing #9.
Both android4 and iphone4 eventually went to continuous (non-duty cycled) data collection with no further user interaction.

Note from #9 (comment)
that the other settings are put into the database on plugin initialize.

The problem is that when we switch to a different channel while clearing out the usercache, the other settings are cleared too. So if we don't force-kill the app, which we typically don't, there is no entry in the database. And then when we sync, if there is an overridden entry on the server, then we end up with an overridden entry on the phone.

@shankari
Copy link
Contributor Author

One potential solution is to turn off the rw document code that pulls settings from the usercache. We are not using the option of pushing new settings from the server anyway.

The problem with that is that it is completely untested, and I want to release this today.

@shankari
Copy link
Contributor Author

This may not be an issue with clients that, unlike the test phones, don't have any overridden settings. Eventually the app will restart and then save the entries in the database again.

The problem is that I am not sure how best to test this. The values are in the usercache and are doing to be pulled down. Unless I manually remove them just for the test phones.

@shankari
Copy link
Contributor Author

One workaround for now, since cci client users can't actually change their data collection settings, we can add code for that channel alone to store default settings into the database on startup (just like the connection settings). This will ensure that after switching to the other channel, we will have current settings in the database again.

@shankari
Copy link
Contributor Author

Another option is to just set clear_usercache to False. The problem with that is that if somebody does go through the entire onboarding process before they click on the second link, it won't remove any IntroDone object, which will lead to inconsistencies.

@shankari
Copy link
Contributor Author

ok so going with #12 (comment)

@shankari
Copy link
Contributor Author

To ensure that the hardcoded defaults in javascript are the same as the ones in native code, we compare them on startup and alert if they are different. Then, when we run the app from the cci branch, the two of them are expected to match.

We can't use this on the real channel because the whole point is that we plan to replace the deleted config with this one. So we will comment it out before checking in.

If we want to change this code before we have a more principled fix, we need to switch to the cci branch, re-enabled the alerts and test.

shankari added a commit to shankari/e-mission-phone that referenced this issue Aug 30, 2017
This is a workaround for server config overwriting existing values, since
prior settings are deleted as part of applying the new client channel.
See also: e-mission/cordova-connection-settings#12 (comment)

This can be reverted after a more long-term solution is deployed.
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

No branches or pull requests

1 participant