Adding timer-based check for wallet updates #8
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Explanation
Users often express interest in a wallet update that would allow the wallet itself to check for future updates. This pull request adds a rudimentary version checking method that displays a clickable link (to the downloads) on the wallet's overview page if an updated version is detected. Screenshots of the visual changes are shown in the attached screenshots.
This feature is implemented with a Qtimer and what is essentially Qt's curl method. Roughly every 24 hours (and once when the wallet is started), the wallet requests a small text file containing the current version information from a remote server. If it detects that the wallet's current version is lower than the version in the fetched file, it reveals a Qt Label in the wallet's Overview Page stating that there is an update, what the version number is, and makes the label a clickable link to the wallet download page.
Necessary Changes
In order to test this update, I needed to store a version text file on a remote server. I chose to use http://starflakenights.net/crypto/magiversion/version.txt. The version-correct equivalent file should be hosted on the official Magi site or in the GitHub repository for ease of fetching.
The URLs for the above version.txt, the official wallet download link, and the define for the update interval are located in src/qt/updatecheck.h, lines 16-43. These will need to be changed according to the position of the version file and wallet download locations on the web, as well as the desired update interval.
Finally, it is somewhat obvious, but using this method for update checking does require the person who uploads binaries to update the version text file as well. In an ideal scenario, the uploader would update the official wallet downloads, then update the version file after the wallets were uploaded (to prevent premature alerts).
Questions/Comments
I realize this is a fairly big change despite being such a small change in terms of code. Please let me know if I need to make changes or fixes, or if it is not a viable solution at all. I will do my best to fix this up for a merge or close the request if it is undesirable to the team.
Screenshots
When no updates are detected for the wallet, the following image is displayed:
If an updated version is detected, the wallet displays the update label and the link to the official wallet downloads: