prixe / lindo

Lindo No-Emu allows you to play DOFUS touch on your computer (Windows/Mac/Linux). Fork of the original DTNE by Daniel & Thomas.
https://lindo-app.com
GNU General Public License v3.0
172 stars 97 forks source link

Auto-updater Windows #243

Closed riaddaima closed 2 years ago

riaddaima commented 2 years ago

This PR has only been tested for windows.

This PR resolves the issue #239. I used electron-updater to make this feature.

I had some challenge making this PR, since the whole thing takes a lot of time to test. You have to release and make another release to test it correctly so it wasn't easy to debug. Also I wasted a lot of time trying to log what was happening until I understood that I needed to specify the logger for autoUpdater.

I faced another issue regarding the assets where the nsis generates a Lindo Setup vX.X.exe with spaces in its name, and latest.yml refers to this generated setup with - instead of spaces. But when doing a release, the github action replaces the spaces with dots. So I had to specify the artifactName explicitly in electron-builder.json to match the correct setup to download.

The latest.yml generated during the build is the one responsible for knowing which release it should download. So when it runs the app, it checks the most recent latest.yml I believe and download the most up-to-date version of Lindo.

Updating is not mandatory for the players for now, autoUpdater.autoDownload = false. I prefer to give the choice, but they will have the popup message appear as long as there is an update available.