diff --git a/src/atom.coffee b/src/atom.coffee index 68d3339c5..bc2330817 100644 --- a/src/atom.coffee +++ b/src/atom.coffee @@ -567,7 +567,6 @@ class Atom extends Model startRootWindow: -> {resourcePath, safeMode} = @getLoadSettings() - console.log ('startRootWindow') CommandInstaller = require './command-installer' CommandInstaller.installAtomCommand resourcePath, false, (error) -> console.warn error.message if error? diff --git a/src/browser/application-menu.coffee b/src/browser/application-menu.coffee index ebaedb362..15157fe39 100644 --- a/src/browser/application-menu.coffee +++ b/src/browser/application-menu.coffee @@ -126,7 +126,7 @@ class ApplicationMenu ] focusedWindow: -> - _.find global.application.windows, (atomWindow) -> atomWindow.isFocused() + global.application.windowManager.focusedWindow() # Combines a menu template with the appropriate keystroke. # diff --git a/src/browser/auto-update-manager.coffee b/src/browser/auto-update-manager.coffee index 001211a41..faba96527 100644 --- a/src/browser/auto-update-manager.coffee +++ b/src/browser/auto-update-manager.coffee @@ -34,10 +34,10 @@ class AutoUpdateManager autoUpdater = require 'auto-updater' autoUpdater.on 'error', (event, message) => - @setState(ErrorState) console.error "Error Downloading Update: #{message}" + @setState(ErrorState) - autoUpdater.setFeedUrl @feedUrl + autoUpdater.setFeedUrl(@feedUrl) autoUpdater.on 'checking-for-update', => @setState(CheckingState) @@ -53,6 +53,9 @@ class AutoUpdateManager @emitUpdateAvailableEvent(@getWindows()...) @check(hidePopups: true) + setInterval => + @check(hidePopups: true) + , (1000 * 60 * 5) switch process.platform when 'win32' @@ -74,10 +77,10 @@ class AutoUpdateManager @state check: ({hidePopups}={}) -> + console.log "Checking for updates..." unless hidePopups autoUpdater.once 'update-not-available', @onUpdateNotAvailable autoUpdater.once 'error', @onUpdateError - autoUpdater.checkForUpdates() install: -> @@ -97,7 +100,7 @@ class AutoUpdateManager icon: @iconURL() message: 'No update available.' title: 'No Update Available' - detail: "Version #{@version} is the latest version." + detail: "You're running the latest version of Nylas Mail (#{@version})." onUpdateError: (event, message) => autoUpdater.removeListener 'update-not-available', @onUpdateNotAvailable @@ -111,4 +114,4 @@ class AutoUpdateManager detail: message getWindows: -> - global.application.windows + global.application.windowManager.windows() diff --git a/src/browser/window-manager.coffee b/src/browser/window-manager.coffee index 201c1fc6b..9f937b63a 100644 --- a/src/browser/window-manager.coffee +++ b/src/browser/window-manager.coffee @@ -165,19 +165,6 @@ class WindowManager # Returns a new AtomWindow # newWindow: (options={}) -> - supportedHotWindowKeys = [ - "title" - "width" - "height" - "windowType" - "windowProps" - ] - - unsupported = _.difference(Object.keys(options), supportedHotWindowKeys) - if unsupported.length > 0 - console.log "WARNING! You are passing in options that can't be hotLoaded into a new window. Please either change the options or pass the `coldStart:true` option to suppress this warning. If it's just data for the window, please put them in the `windowProps` param." - console.log unsupported - if options.coldStart or not @_hotWindows[options.windowType]? return @newColdWindow(options) else @@ -202,7 +189,7 @@ class WindowManager # registerHotWindow: ({windowType, replenishNum, windowPackages}={}) -> if not windowType - throw new Error("please provide a windowType when registering a hot window") + throw new Error("registerHotWindow: please provide a windowType") @_hotWindows ?= {} @_hotWindows[windowType] ?= {} @@ -244,9 +231,27 @@ class WindowManager win = null if not hotWindowParams? - console.log "WARNING! The requested windowType '#{options.windowType}' has not been registered. Be sure to call `registerWindowType` first in your packages setup." + console.log "WindowManager: Warning! The requested windowType '#{options.windowType}' + has not been registered. Be sure to call `registerWindowType` first + in your packages setup." return @newColdWindow(options) + supportedHotWindowKeys = [ + "title" + "width" + "height" + "windowType" + "windowProps" + ] + + unsupported = _.difference(Object.keys(options), supportedHotWindowKeys) + if unsupported.length > 0 + console.log "WindowManager: Nylas will open a new hot window of type #{options.windowType}, + but you are passing options that can't be applied to the preloaded window + (#{JSON.stringify(unsupported)}). Please change the options or pass the + `coldStart:true` option to use a new window instead of a hot window. If + it's just data for the window, please put them in the `windowProps` param." + if hotWindowParams.loadedWindows.length is 0 # No windows ready options.windowPackages = hotWindowParams.windowPackages @@ -304,7 +309,7 @@ class WindowManager @_processingQueue = true if @_replenishQueue.length > 0 options = @_replenishQueue.shift() - console.log "---> Launching new '#{options.windowType}' window" + console.log "WindowManager: Preparing a new '#{options.windowType}' window" newWindow = new AtomWindow(options) @_hotWindows[options.windowType].loadedWindows.push(newWindow) newWindow.once 'window:loaded', => diff --git a/src/error-reporter.js b/src/error-reporter.js index ad7108ac5..9060fdba8 100644 --- a/src/error-reporter.js +++ b/src/error-reporter.js @@ -163,6 +163,22 @@ module.exports = ErrorReporter = (function() { }; ErrorReporter.prototype.shipLogs = function(reason) { + if (!this.shipLogsQueued) { + var timeSinceLogShip = Date.now() - this.shipLogsTime; + if (timeSinceLogShip > 20000) { + this.runShipLogsTask(reason); + } else { + this.shipLogsQueued = true; + var self = this; + setTimeout(function() { + self.runShipLogsTask(reason); + self.shipLogsQueued = false; + }, 20000 - timeSinceLogShip); + } + } + }; + + ErrorReporter.prototype.runShipLogsTask = function(reason) { var self = this; this.shipLogsTime = Date.now(); @@ -179,27 +195,12 @@ module.exports = ErrorReporter = (function() { console.log("ErrorReporter: Shipping Logs. " + reason); - Task = require('./task') + Task = require('./task'); ship = Task.once(fs.absolute('./tasks/ship-logs-task'), tmpPath, logPattern, function() { self.appendLog("ErrorReporter: Shipped Logs."); }); }; - ErrorReporter.prototype.shipLogsThrottled = function(reason) { - if (!this.shipLogsQueued) { - var timeSinceLogShip = Date.now() - this.shipLogsTime; - if (timeSinceLogShip > 5000) { - this.shipLogs(reason); - } else { - this.shipLogsQueued = true; - var self = this; - setTimeout(function() { - self.shipLogs(reason); - self.shipLogsQueued = false; - }, 5000 - timeSinceLogShip); - } - } - }; ErrorReporter.prototype.getVersion = function() { var _ref; @@ -224,7 +225,7 @@ module.exports = ErrorReporter = (function() { }); this.appendLog(err, metadata); - this.shipLogsThrottled('Exception occurred'); + this.shipLogs('Exception occurred'); }; return ErrorReporter; diff --git a/src/flux/stores/database-view.coffee b/src/flux/stores/database-view.coffee index 4975ac9e8..b3f436b37 100644 --- a/src/flux/stores/database-view.coffee +++ b/src/flux/stores/database-view.coffee @@ -223,7 +223,10 @@ class DatabaseView extends ModelView delete page.metadata[id] dirtied = true if dirtied - @log('Invalidated metadata for items with ids: '+JSON.stringify(ids)) + if ids.length < 5 + @log("Invalidated metadata for items with ids: #{JSON.stringify(ids)}") + else + @log("Invalidated metadata for #{ids.length} items") @retrievePageMetadata(idx, page.items) invalidateCount: ->