Repository navigation
Expose application updater lifecycle events to packages - #10675
Conversation
|
@atom/core Ready to merge this. Feedback welcome! |
|
Mind if I do some renaming? |
b416114 to
e44b57d
Compare
|
This would be more complete if we had something in electron to report a new version, but without auto-downloading. I've opened an electron issue: electron/electron#4587 |
14421cc to
5340c91
Compare
| docs/output | ||
| docs/includes | ||
| spec/fixtures/evil-files/ | ||
| out/ |
There was a problem hiding this comment.
Nevermind, I suppose I have an out folder as well. Maybe that's what the build does now?
|
Ok I think this is ready. @nathansobo want to give this a once over? |
| # TODO: Yes, this is strange that `onUpdateAvailable` is listening for | ||
| # `did-begin-downloading-update`. We currently have no mechanism to know | ||
| # if there is an update, so begin of downloading is a good proxy. | ||
| callback(detail) if message is 'did-begin-downloading-update' |
There was a problem hiding this comment.
Note that this is changing the semantics of onUpdateAvailable(). It used to indicate that the update is downloaded and ready to be installed. Now, it will indicate that there is an update available, but before download and all that.
|
Cool. It will be great to have these details available in the render process. The basics look good. I made some structural suggestions. |
We can expose just a few event subscription methods on atom.update to take care of what most packages (e.g. About) would be interested in. Of course the updater runs on the main thread so we’re proxying them through IPC. It’s fine.
…maybe rebase this away…
e3942a8 to
492e89c
Compare
|
Alright, when the specs pass, I'm merging this. |
|
Thanks for making those adjustments. |
👍 |
Expose application updater lifecycle events to packages
|
Thanks @thedaniel and @kuychaco for getting this started |
|
What is the status of this? When can we expect it in a release? |
|
@kunkinkan this shipped on stable in 1.7.0 in April. 😎 |
|
@iolsen will this be made available for electron also? I don't believe they have all the events listed above? I thought atom was built on electron? |
|
This change simply exposes the underlying Electron autoUpdater events to Atom packages. So either I'm misunderstanding or the functionality you're looking for is already available in Electron. |
This is WIP, I'm not sure the best way to write specs for this. There'll be a corresponding PR in atom/about for the UI.
The general idea is that the
AutoUpdateManagerwhich runs on the main thread will pass on events from the auto updater in Electron (or whatever needs to manage update checking in the future) corresponding with the update lifecycle - checking, available, not available, downloading, downloaded - to the renderer over IPC, the app delegate will proxy them, and then the Update wrapper (available atatom.update) will bind to the delegate and proxy them for clients (such as the about package)Edit from @benogle:
Previously there was just an
update-availableand aupdate-not-availableevent. Respectively, these meant "there is an update, it's been downloaded and it's ready to install", and "atom is up to date". The only one exposed wasupdate-availableviaatom.onUpdateAvailable. We needed more granularity for atom/about#12, so now there are more events.This change adds a renderer process
AutoUpdateManagerwhich is hanging off ofatom.autoUpdater. The events it supports are:This is probably an 80% point to something cleanish regarding update code. The underlying AutoUpdateManager still emits
update-availableevents when the entire update has been downloaded. I was worried about breaking things, so that work can be done as a separate effort. These event names should be changed andatom.onUpdateAvailabledeprecated in favor of events onatom.autoUpdater.