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

Adding timer-based check for wallet updates #8

Merged
merged 2 commits into from Sep 16, 2015

Conversation

feldenthorne
Copy link
Contributor

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:
Wallet when no updates are detected.

If an updated version is detected, the wallet displays the update label and the link to the official wallet downloads:
Wallet when an updated version has been detected.

A file on a remote server (version.txt for example) that contains
the newest wallet information is retrieved, then the string in
that file is parsed and compared with the internal wallet version,
which is defined in src/version.h. If any integer in the remote
version is larger than the corresponding internal integer, a
clickable label is displayed in the GUI overview page, prompting
the user to download the new wallet version. This check occurs
once per day, as commited.

---
Notes:

The remote version.txt must contain only a string of the form:
MAJOR_VERSION.MINOR_VERSION.REVISION.BUILD (e.g. 1.2.1.2) with no
leading or trailing spaces.

The URLs for the remote version.txt file and the suggested
download location URL are defined in src/qt/updatecheck.h. The
Update time interval is also defined in src/qt/updatecheck.h.

The UpdateCheck class is used in the OverviewPage class
(src/qt/overviewpage.cpp) along with a little extra logic to
achieve this functionality.
This merges changes made to the official source that explicitly
set the BDB version to 4.8.
@bauerj
Copy link

bauerj commented Sep 14, 2015

👍

This should be merged.

@bauerj
Copy link

bauerj commented Sep 14, 2015

@joelao95

magi-project pushed a commit that referenced this pull request Sep 16, 2015
Adding timer-based check for wallet updates
@magi-project magi-project merged commit 622779e into m-pays:master Sep 16, 2015
@magi-project
Copy link

Thanks for the contribution. This is nice. The request has been merged.

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.

None yet

3 participants