Whether the user approved (true) or not (false) or did not decide (unset optional).
The following rules apply:
If the developer says no, it rules out all following decisions (even if the user specified –version-check true). No cookie is ever written.
If the environment variable SHARG_NO_VERSION_CHECK is set no version check is done (rules out all following). No cookie is written.
If the user explicitly uses the –version-check option (user_approval is set) it rules out all following decisions. No cookie is written.
If none of the above apply, version check was not explicitly handled so cookie content is checked:
NEVER: Do not perform the version check and do not change the cookie.
ALWAYS: Do perform the version check once a day and do not change the cookie.
ASK: Ask the user or default the decision once a day.
If the cookie content is "ASK" and the timestamp is older than a day we ask the user, if possible, what he wants to do, set the according cookie for the next time and continue. If we cannot ask the user, the default kicks in (do the check).
If a timestamp file already exists, the following behaviour can be expected depending on the file contents:
content "NEVER": No server call is performed and no update information is printed.
content "ALWAYS": A server call is performed and update information is printed if a version file exists.
content is a timestamp: The "time-of-last-version-check" is read from file. The function only continues if the last version check is more than a day old.
If a version file exists, the app version and Sharg version are compared to the current ones and the the following message may be printed: Debug mode (directed at the developer of the application)
If the app is unregistered (no version information is available at the server) the developer will be notified that he has the possibility of registering his application with us (see sharg::version_checker::message_unregistered_app).
If the current Sharg version is smaller than the one returned by the server call, the developer is notified that he may update to the newest Sharg version (see sharg::version_checker::message_sharg_update).
If the current app version is greater than the one returned by the server call, we assume that the developer has released a new version and is notified to send us the new version (see sharg::version_checker::message_registered_app_update). Release mode (directed at the user of the application):
If the current app version is lower than the one returned by the server call, the user is notified that a newer version exists.