flybywiresim / installer

FlyByWire Simulations installer
GNU General Public License v3.0
96 stars 85 forks source link

feat: Auto Update Toggle Switch #461

Open derfelix54 opened 6 months ago

derfelix54 commented 6 months ago

Summary of Changes

Screenshots (if necessary)

AutoUpdate

Additional context

First React Feature I am doing so I would appreciate your feedback.

Discord username (if different from GitHub): verolix22

tracernz commented 6 months ago

What happens if MSFS is running?

derfelix54 commented 6 months ago

Good Point! @tracernz I didn't test this. The same if you press update while msfs is running I guess. I use the handleInstall() function. But I should add another check because I assume that it will call this the whole time if auto update is turned on while msfs is running.

tracernz commented 6 months ago

Yeah, it would be super nice to defer the update until the sim is shut down if it’s running. Not sure how difficult that would be code-wise.

FoxtrotSierra6829 commented 6 months ago

As an electron app, the installer is not designed to be left open all the time, which this setting would encourage doing. Unless we build a lightweight helper service for this purpose, I don't think it is the best idea to implement such function. Furthermore, even if we have detection if MSFS is running so to not break the installation, this could still cause other services or games to suddenly have insufficient bandwidth without prior user input or warning. To solve this, we would require resource monitoring so we can throttle the download if required.

derfelix54 commented 6 months ago

What happens if MSFS is running?

First about this. I tested it with the master to see if there was a prevention to update while msfs is running and there is not. At least not in master. I am not sure but I thought the installer had something like that with a corresponding error message. Am I wrong?

derfelix54 commented 6 months ago

As an electron app, the installer is not designed to be left open all the time, which this setting would encourage doing. Unless we build a lightweight helper service for this purpose, I don't think it is the best idea to implement such function. Furthermore, even if we have detection if MSFS is running so to not break the installation, this could still cause other services or games to suddenly have insufficient bandwidth without prior user input or warning. To solve this, we would require resource monitoring so we can throttle the download if required.

Not sure what your point is. This feature is only a convenience function. It should do the same if you press the "Update" button. So if you open the installer it does it automatically. If it is already open then, if switched on, it also updates automatically. The same as pressing the button. So it doesn't do anything new in that sense. I don't think it will encourage the users to leave it open more often. If you don't want that then there needs some other prevention for this. Of course, if the team decides otherwise, I can close this pull request. I just thought it would be a great feature.

2hwk commented 6 months ago

This would lead as well to more usage of our CDN, while it is a good convenient factor for users, we'd also have to consider the impact on our network infrastructure and bandwidth costs.

FoxtrotSierra6829 commented 6 months ago

What happens if MSFS is running?

First about this. I tested it with the master to see if there was a prevention to update while msfs is running and there is not. At least not in master. I am not sure but I thought the installer had something like that with a corresponding error message. Am I wrong?

463 was looking into when it's triggered, and figured it's currently inoperative

FoxtrotSierra6829 commented 6 months ago

As an electron app, the installer is not designed to be left open all the time, which this setting would encourage doing. Unless we build a lightweight helper service for this purpose, I don't think it is the best idea to implement such function. Furthermore, even if we have detection if MSFS is running so to not break the installation, this could still cause other services or games to suddenly have insufficient bandwidth without prior user input or warning. To solve this, we would require resource monitoring so we can throttle the download if required.

Not sure what your point is. This feature is only a convenience function. It should do the same if you press the "Update" button. So if you open the installer it does it automatically. If it is already open then, if switched on, it also updates automatically. The same as pressing the button. So it doesn't do anything new in that sense. I don't think it will encourage the users to leave it open more often. If you don't want that then there needs some other prevention for this. Of course, if the team decides otherwise, I can close this pull request. I just thought it would be a great feature.

Don't get me wrong, it's not a bad idea. I just think it needs a more sophisticated solution if we want to implement it.

derfelix54 commented 6 months ago

@FoxtrotSierra6829 so you would suggest to build a standalone "update.exe" to do this which is called from the installer? Or am I misunderstanding you here?

FoxtrotSierra6829 commented 6 months ago

This could be achieved with two different approaches, one would be to have a helper service check if an addon needs to be updated and then launch the main application (minimized) with a parameter to update the addon, then close the main application again. The other would be to fully transfer all installation and update functions to a helper service and call that service for all these operations from the GUI. That in turn would need some protocol to exchange status information.

At least that's my opinion on this, maybe others here have a different one.

FoxtrotSierra6829 commented 6 months ago

Also, the PR in its current stage only supports auto-updating of the currently selected addon.