Skip to content
This repository was archived by the owner on Mar 3, 2023. It is now read-only.

Expose application updater lifecycle events to packages - #10675

Merged
benogle merged 49 commits into
masterfrom
dh-expose-updates
Mar 1, 2016
Merged

benogle merged 49 commits into
masterfrom
dh-expose-updates

Conversation

@thedaniel

Copy link
Copy Markdown
Contributor

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 AutoUpdateManager which 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 at atom.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-available and a update-not-available event. 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 was update-available via atom.onUpdateAvailable. We needed more granularity for atom/about#12, so now there are more events.

This change adds a renderer process AutoUpdateManager which is hanging off of atom.autoUpdater. The events it supports are:

onDidBeginCheckingForUpdate(callback)
onDidBeginDownloadingUpdate(callback)
onDidCompleteDownloadingUpdate(callback)
onUpdateNotAvailable(callback)

This is probably an 80% point to something cleanish regarding update code. The underlying AutoUpdateManager still emits update-available events 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 and atom.onUpdateAvailable deprecated in favor of events on atom.autoUpdater.

@kuychaco

Copy link
Copy Markdown
Contributor

@atom/core Ready to merge this. Feedback welcome!

@benogle

benogle commented Feb 24, 2016

Copy link
Copy Markdown
Contributor

Mind if I do some renaming? Update seems like a weird name for a class. AutoUpdateManager would be more appropriate, even though there is already one in the main process.

@benogle

benogle commented Feb 24, 2016

Copy link
Copy Markdown
Contributor

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

Comment thread .gitignore
docs/output
docs/includes
spec/fixtures/evil-files/
out/

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@thedaniel what was this for?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nevermind, I suppose I have an out folder as well. Maybe that's what the build does now?

@benogle

benogle commented Mar 1, 2016

Copy link
Copy Markdown
Contributor

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'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@nathansobo

Copy link
Copy Markdown
Contributor

Cool. It will be great to have these details available in the render process. The basics look good. I made some structural suggestions.

@benogle
benogle force-pushed the dh-expose-updates branch from e3942a8 to 492e89c Compare March 1, 2016 23:09
@benogle

benogle commented Mar 1, 2016

Copy link
Copy Markdown
Contributor

Alright, when the specs pass, I'm merging this.

@nathansobo

Copy link
Copy Markdown
Contributor

Thanks for making those adjustments.

@benogle

benogle commented Mar 1, 2016

Copy link
Copy Markdown
Contributor

Thanks for making those adjustments.

👍

benogle added a commit that referenced this pull request Mar 1, 2016
Expose application updater lifecycle events to packages
@benogle
benogle merged commit b14da46 into master Mar 1, 2016
@benogle

benogle commented Mar 1, 2016

Copy link
Copy Markdown
Contributor

Thanks @thedaniel and @kuychaco for getting this started

@ghost

ghost commented Jun 15, 2016

Copy link
Copy Markdown

What is the status of this? When can we expect it in a release?

@iolsen

iolsen commented Jun 15, 2016

Copy link
Copy Markdown
Contributor

@kunkinkan this shipped on stable in 1.7.0 in April. 😎

@ghost

ghost commented Jun 15, 2016

Copy link
Copy Markdown

@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?

@iolsen

iolsen commented Jun 15, 2016

Copy link
Copy Markdown
Contributor

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants