Closed qstokkink closed 2 months ago
I was thinking of adding this to Header.tsx
and listen to every time the service comes online. Then, fire off a REST request for a new version and displaying a little toast notification if one is available.
The downside of that approach is that we get a notification when the service comes online, not when Tribler starts.
@egbertbouman do you know of a better way to detect when Tribler started (is there some event we can use)?
It looks like there's already an tribler_new_version
event, but it's not getting fired. Perhaps we can fix this, and then listen for it in Header.tsx
:
triblerService.addEventListener("tribler_new_version", OnNewVersionEvent)
This would also address the issue of only showing the toast when Tribler starts.
Thanks for the input. That sounds reasonable, I guess we could do a check after all other components have been started in the Session
(and then fire the event).
Perhaps it makes more sense to do the check in the VersioningComponent.finalize()
.
Ok, I think we have a solid plan. I'll assign myself and see if I can make it happen.
A problem arose: the version checker posts the tribler_new_version
, the event gets written with a status 200
in the events endpoint BUT the event does not arrive in the (GUI) event listener UNLESS the interface is already running when starting the core.
Perhaps the event listener is not hooked up early enough? I'll try adding it directly after creating the EventSource
in the tribler service. EDIT: even that is not fast enough.
I played with this for a few hours now. I don't think that we can ever sanely* guarantee that tribler_new_version
will not be sent before the GUI sets up its listener, without having the GUI signal that it is ready to receive. We would need some new message to perform the signaling.
At this point, I think it's better to just send a request to the core for a new version using the normal API instead of using an event.
*My best (and only) reliably working implementation uses a sleep of 2 seconds before posting the event.
Currently, a user has to go to the version settings to discover that a new Tribler version exists. We can provide a small popup after starting, when a new version is available.