mirror of
https://github.com/atom/atom.git
synced 2026-02-18 10:31:54 -05:00
Disable the updates shim on Win32, include our own JS version
This commit is contained in:
committed by
Kevin Sawicki
parent
a9ee6e5d43
commit
379bd852d2
@@ -20,10 +20,10 @@ class AutoUpdateManager
|
||||
process.nextTick => @setupAutoUpdater()
|
||||
|
||||
setupAutoUpdater: ->
|
||||
autoUpdater = require 'auto-updater'
|
||||
|
||||
if process.platform is 'win32'
|
||||
autoUpdater.checkForUpdates = => @checkForUpdatesShim()
|
||||
autoUpdater = require 'auto-updater-win32'
|
||||
else
|
||||
autoUpdater = require 'auto-updater'
|
||||
|
||||
autoUpdater.setFeedUrl @feedUrl
|
||||
|
||||
@@ -48,24 +48,6 @@ class AutoUpdateManager
|
||||
unless /\w{7}/.test(@version)
|
||||
@check(hidePopups: true)
|
||||
|
||||
# Windows doesn't have an auto-updater, so use this method to shim the events.
|
||||
checkForUpdatesShim: ->
|
||||
autoUpdater.emit 'checking-for-update'
|
||||
|
||||
https = require 'https'
|
||||
request = https.get @feedUrl, (response) ->
|
||||
if response.statusCode == 200
|
||||
body = ""
|
||||
response.on 'data', (chunk) -> body += chunk
|
||||
response.on 'end', ->
|
||||
{notes, name} = JSON.parse(body)
|
||||
autoUpdater.emit 'update-downloaded', null, notes, name
|
||||
else
|
||||
autoUpdater.emit 'update-not-available'
|
||||
|
||||
request.on 'error', (error) ->
|
||||
autoUpdater.emit 'error', null, error.message
|
||||
|
||||
emitUpdateAvailableEvent: (windows...) ->
|
||||
return unless @releaseVersion? and @releaseNotes
|
||||
for atomWindow in windows
|
||||
|
||||
15
src/browser/auto-updater-win32.coffee
Normal file
15
src/browser/auto-updater-win32.coffee
Normal file
@@ -0,0 +1,15 @@
|
||||
_ = require 'underscore-plus'
|
||||
{EventEmitter} = require 'events'
|
||||
|
||||
module.exports =
|
||||
class AutoUpdater
|
||||
_.extend @prototype, EventEmitter.prototype
|
||||
|
||||
setFeedUrl: ->
|
||||
console.log 'setFeedUrl'
|
||||
|
||||
quitAndInstall: ->
|
||||
console.log 'quitAndInstall'
|
||||
|
||||
checkForUpdates: ->
|
||||
console.log 'checkForUpdates'
|
||||
Reference in New Issue
Block a user