diff --git a/src/atom.coffee b/src/atom.coffee index 4e4142982..b4facdca3 100644 --- a/src/atom.coffee +++ b/src/atom.coffee @@ -634,53 +634,53 @@ class Atom extends Model # Call this method when establishing a real application window. startRootWindow: -> - {resourcePath, safeMode, windowType} = @getLoadSettings() + @displayWindow() + {safeMode, windowType} = @getLoadSettings() + @registerCommands() + @loadConfig() + @keymaps.loadBundledKeymaps() + @themes.loadBaseStylesheets() + @packages.loadPackages(windowType) + @deserializeRootWindow() + @packages.activate() + @keymaps.loadUserKeymap() + @requireUserInitScript() unless safeMode + @menu.update() + + @showRootWindow() + + ipc.sendChannel('window-command', 'window:main-window-content-loaded') + + showRootWindow: -> + dimensions = @restoreWindowDimensions() + @getCurrentWindow().setMinimumSize(875, 500) + maximize = dimensions?.maximized and process.platform isnt 'darwin' + @maximize() if maximize + @center() + cover = document.getElementById("application-loading-cover") + cover.classList.add('visible') + + registerCommands: -> + {resourcePath} = @getLoadSettings() CommandInstaller = require './command-installer' CommandInstaller.installAtomCommand resourcePath, false, (error) -> console.warn error.message if error? CommandInstaller.installApmCommand resourcePath, false, (error) -> console.warn error.message if error? + @commands.add 'atom-workspace', + 'atom-workspace:add-account': @onAddAccount - dimensions = @restoreWindowDimensions() - maximize = dimensions?.maximized and process.platform isnt 'darwin' - @displayWindow({maximize}) - - cover = document.getElementById("application-loading-cover") - wait = (time, fn) -> setTimeout(fn, time) - - wait 1, => - cover.classList.add("showing") - - wait 220, => - @loadConfig() - @keymaps.loadBundledKeymaps() - @themes.loadBaseStylesheets() - @packages.loadPackages(windowType) - @deserializeRootWindow() - @packages.activate() - @keymaps.loadUserKeymap() - @requireUserInitScript() unless safeMode - @menu.update() - - - @commands.add 'atom-workspace', - 'atom-workspace:add-account': => - @newWindow - title: 'Add an Account' - width: 340 - height: 550 - toolbar: false - resizable: false - windowType: 'onboarding' - windowProps: - page: 'add-account' - - # Make sure we can't be made so small that the interface looks like crap - @getCurrentWindow().setMinimumSize(875, 500) - wait 20, => - ipc.sendChannel('window-command', 'window:main-window-content-loaded') - cover.classList.add('visible') + onAddAccount: => + @newWindow + title: 'Add an Account' + width: 340 + height: 550 + toolbar: false + resizable: false + windowType: 'onboarding' + windowProps: + page: 'add-account' # Call this method when establishing a secondary application window # displaying a specific set of packages. diff --git a/src/browser/application.coffee b/src/browser/application.coffee index dc61b95cf..bea423dcf 100644 --- a/src/browser/application.coffee +++ b/src/browser/application.coffee @@ -153,10 +153,10 @@ class Application setupJavaScriptArguments: -> app.commandLine.appendSwitch 'js-flags', '--harmony' - openWindowsForTokenState: => + openWindowsForTokenState: (loadingMessage) => hasToken = @config.get('tokens')?.length > 0 if hasToken - @windowManager.showMainWindow() + @windowManager.showMainWindow(loadingMessage) @windowManager.ensureWorkWindow() else @windowManager.newOnboardingWindow() @@ -201,18 +201,10 @@ class Application @setDatabasePhase('close') @windowManager.closeAllWindows() - # Return immediately so that the client window which called this - # method via remote is not blocked. - _.defer => - dialog.showMessageBox - type: 'info' - message: 'Upgrading Nylas' - detail: 'Welcome back to Nylas! We need to rebuild your mailbox to support new features. Please wait a few moments while we re-sync your mail.' - buttons: ['OK'] - - @_deleteDatabase => - @setDatabasePhase('setup') - @openWindowsForTokenState() + loadingMessage = "We need to rebuild your mailbox to support new features.
Please wait a few moments while we re-sync your mail." + @_deleteDatabase => + @setDatabasePhase('setup') + @openWindowsForTokenState(loadingMessage) # Registers basic application commands, non-idempotent. # Note: If these events are triggered while an application window is open, the window diff --git a/src/browser/atom-window.coffee b/src/browser/atom-window.coffee index ee24a9642..b6c8d4f59 100644 --- a/src/browser/atom-window.coffee +++ b/src/browser/atom-window.coffee @@ -105,6 +105,7 @@ class AtomWindow @browserWindow.once 'window:main-window-content-loaded', => @emit 'window:main-window-content-loaded' @mainWindowContentLoaded = true + @browserWindow.setResizable(true) if @browserWindow.loadSettingsChangedSinceGetURL @browserWindow.webContents.send('load-settings-changed', @browserWindow.loadSettings) diff --git a/src/browser/window-manager.coffee b/src/browser/window-manager.coffee index c9601226d..b3e18420f 100644 --- a/src/browser/window-manager.coffee +++ b/src/browser/window-manager.coffee @@ -55,7 +55,7 @@ class WindowManager @_mainWindow.close() @_mainWindow = null - showMainWindow: -> + showMainWindow: (loadingMessage) -> if @_mainWindow if @_mainWindow.isMinimized() @_mainWindow.restore() @@ -72,12 +72,20 @@ class WindowManager resourcePath ?= @resourcePath @_mainWindow = new AtomWindow + loadingMessage: loadingMessage bootstrapScript: bootstrapScript resourcePath: resourcePath devMode: @devMode safeMode: @safeMode neverClose: true mainWindow: true + # The position and resizable bit gets reset when the window + # finishes loading. This represents the state of our "loading" + # window. + center: true + width: 640 + height: 396 + resizable: false ### Work Window diff --git a/static/index.html b/static/index.html index 47c022cca..783467100 100644 --- a/static/index.html +++ b/static/index.html @@ -17,55 +17,40 @@ bottom:0; z-index:100000; opacity: 1; - background-color:rgba(238,240,242,1); - transform: scale3d(1,1,1); - -webkit-transition:all 0.3s ease-in; - text-align:center; + background-image: linear-gradient(to bottom, rgba(236,236,236,0) 0%, rgba(236,236,236,1) 88%), linear-gradient(to right, rgba(213,224,0,0.47) 0%,rgba(88,182,63,0.47) 50%,rgba(12,162,163,0.47) 100%); + text-align: center; + color: rgba(0,0,0,0.5); + font-family: Helvetica, sans-serif; } - .application-loading-cover .application-loading-cover-centered { - opacity:0; - position: absolute; - left:50%; - top: 50%; - transform: translate(-50%, -50%) scale3d(0.5, 0.5, 0.5); - -webkit-transition:all 0.2s cubic-bezier(0, 1.32, 0.63, 1); - } - .application-loading-cover.showing .application-loading-cover-centered { - opacity:1; - transform: translate(-50%, -50%) scale3d(1,1,1); + .application-loading-cover img { + opacity: 0.6; + margin-top: 90px; } .application-loading-cover.visible { - opacity:0; - transform: scale3d(1.1,1.1,1.1); + opacity: 0; pointer-events: none; } - @-webkit-keyframes stripes { - 66%, 100% { - background-position: -200% 0; - } + .application-loading-text { + text-align: center; + font-size: 28px; + font-weight: 300; + margin-top: 2.0em; } - .application-loading-text { - background-image: linear-gradient(100deg, rgba(0,0,0,0.5) 0%, rgba(0,0,0,0.5) 33%, rgba(0,0,0,1) 66%, rgba(0,0,0,0.5) 100%); - background-position: 0 0; - background-size: 200% 100%; - -webkit-text-fill-color: transparent; - -webkit-background-clip: text; - -webkit-animation: stripes 2s linear infinite; - animation: stripes 2s linear infinite; - font-family: sans-serif; + #application-loading-text-supplement { text-align: center; - font-size:24px; - font-weight:300; - margin:auto; + margin-top: 1em; + font-size: 18px; + line-height: 1.4; }
- -
Loading Nylas Mail...
+ +
Loading Nylas Mail…
+
diff --git a/static/index.js b/static/index.js index f1e18025d..7ef3395f5 100644 --- a/static/index.js +++ b/static/index.js @@ -36,6 +36,10 @@ window.onload = function() { throw error; } + if (loadSettings.loadingMessage) { + document.getElementById("application-loading-text-supplement").innerHTML = loadSettings.loadingMessage + } + // Normalize to make sure drive letter case is consistent on Windows process.resourcesPath = path.normalize(process.resourcesPath);