dns66 icon indicating copy to clipboard operation
dns66 copied to clipboard

Store and apply new settings (only) when leaving (stopping) the app?

Open julian-klode opened this issue 8 years ago • 3 comments

I recently thought about how to improve the app experience when changing settings. Currently,

  1. changing a setting automatically stores the new settings; but:
  2. a manual service restart is required after changing settings

Storing the settings automatically makes a lot of sense, in some way. But let's talk about the service restarting first: Optimally, all setting changes would apply automatically; but certain settings, like DNS servers, or the app whitelist require the VPN connection to be restarted, making them relatively expensive operations (especially because other apps receive a connectivity changed request and might do other stuff then).

My suggestion is to apply them automatically when we leave the app (that is, when the activity enters it's stopped state). The reason for that is simple: DNS66 is not affected by the configuration, so applying changes while DNS66 is the active app is pointless. When a user switches from DNS66 to another app, the user might want to use an app that is affected by DNS66, so applying the changes at that point is a good idea.

This also allows us to simplify the code a bit: Instead of storing settings whenever they are changed, we only store them when pausing. There should not be any noticeable difference to a user from that change, but it avoids having to add/keep setting writing lines in every change listener, which is a good thing; and it also reduces the number of writes to the file system.

julian-klode avatar Mar 19 '17 00:03 julian-klode

The question with Android 7 and multi-window is: Do we want to apply settings automatically while DNS66 is still visible in a multi-window scenario, or not?

So for example, you have DNS66 and the browser open. You do stuff in the browser, Android thus pauses DNS66. Should we create a background task to write the settings and restart the service as needed here, or should we not care about this case?

julian-klode avatar Mar 19 '17 00:03 julian-klode

Oh, and we should of course store settings before a manual (re)start of the service.

julian-klode avatar Mar 19 '17 00:03 julian-klode

We also do not want to apply settings when just starting another activity, like the item editor or the about activity. That would be stupid.

julian-klode avatar Apr 15 '17 22:04 julian-klode