mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-09-08 21:55:54 +08:00
feat(loading): new loading screen
Summary: New loading screen Test Plan: manual Reviewers: dillon, bengotow Reviewed By: bengotow Differential Revision: https://phab.nylas.com/D2057
This commit is contained in:
parent
f62fe26524
commit
10a875ed1c
6 changed files with 80 additions and 90 deletions
|
@ -634,53 +634,53 @@ class Atom extends Model
|
||||||
|
|
||||||
# Call this method when establishing a real application window.
|
# Call this method when establishing a real application window.
|
||||||
startRootWindow: ->
|
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 = require './command-installer'
|
||||||
CommandInstaller.installAtomCommand resourcePath, false, (error) ->
|
CommandInstaller.installAtomCommand resourcePath, false, (error) ->
|
||||||
console.warn error.message if error?
|
console.warn error.message if error?
|
||||||
CommandInstaller.installApmCommand resourcePath, false, (error) ->
|
CommandInstaller.installApmCommand resourcePath, false, (error) ->
|
||||||
console.warn error.message if error?
|
console.warn error.message if error?
|
||||||
|
@commands.add 'atom-workspace',
|
||||||
|
'atom-workspace:add-account': @onAddAccount
|
||||||
|
|
||||||
dimensions = @restoreWindowDimensions()
|
onAddAccount: =>
|
||||||
maximize = dimensions?.maximized and process.platform isnt 'darwin'
|
@newWindow
|
||||||
@displayWindow({maximize})
|
title: 'Add an Account'
|
||||||
|
width: 340
|
||||||
cover = document.getElementById("application-loading-cover")
|
height: 550
|
||||||
wait = (time, fn) -> setTimeout(fn, time)
|
toolbar: false
|
||||||
|
resizable: false
|
||||||
wait 1, =>
|
windowType: 'onboarding'
|
||||||
cover.classList.add("showing")
|
windowProps:
|
||||||
|
page: 'add-account'
|
||||||
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')
|
|
||||||
|
|
||||||
# Call this method when establishing a secondary application window
|
# Call this method when establishing a secondary application window
|
||||||
# displaying a specific set of packages.
|
# displaying a specific set of packages.
|
||||||
|
|
|
@ -153,10 +153,10 @@ class Application
|
||||||
setupJavaScriptArguments: ->
|
setupJavaScriptArguments: ->
|
||||||
app.commandLine.appendSwitch 'js-flags', '--harmony'
|
app.commandLine.appendSwitch 'js-flags', '--harmony'
|
||||||
|
|
||||||
openWindowsForTokenState: =>
|
openWindowsForTokenState: (loadingMessage) =>
|
||||||
hasToken = @config.get('tokens')?.length > 0
|
hasToken = @config.get('tokens')?.length > 0
|
||||||
if hasToken
|
if hasToken
|
||||||
@windowManager.showMainWindow()
|
@windowManager.showMainWindow(loadingMessage)
|
||||||
@windowManager.ensureWorkWindow()
|
@windowManager.ensureWorkWindow()
|
||||||
else
|
else
|
||||||
@windowManager.newOnboardingWindow()
|
@windowManager.newOnboardingWindow()
|
||||||
|
@ -201,18 +201,10 @@ class Application
|
||||||
@setDatabasePhase('close')
|
@setDatabasePhase('close')
|
||||||
@windowManager.closeAllWindows()
|
@windowManager.closeAllWindows()
|
||||||
|
|
||||||
# Return immediately so that the client window which called this
|
loadingMessage = "We need to rebuild your mailbox to support new features.<br/>Please wait a few moments while we re-sync your mail."
|
||||||
# method via remote is not blocked.
|
@_deleteDatabase =>
|
||||||
_.defer =>
|
@setDatabasePhase('setup')
|
||||||
dialog.showMessageBox
|
@openWindowsForTokenState(loadingMessage)
|
||||||
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()
|
|
||||||
|
|
||||||
# Registers basic application commands, non-idempotent.
|
# Registers basic application commands, non-idempotent.
|
||||||
# Note: If these events are triggered while an application window is open, the window
|
# Note: If these events are triggered while an application window is open, the window
|
||||||
|
|
|
@ -105,6 +105,7 @@ class AtomWindow
|
||||||
@browserWindow.once 'window:main-window-content-loaded', =>
|
@browserWindow.once 'window:main-window-content-loaded', =>
|
||||||
@emit 'window:main-window-content-loaded'
|
@emit 'window:main-window-content-loaded'
|
||||||
@mainWindowContentLoaded = true
|
@mainWindowContentLoaded = true
|
||||||
|
@browserWindow.setResizable(true)
|
||||||
if @browserWindow.loadSettingsChangedSinceGetURL
|
if @browserWindow.loadSettingsChangedSinceGetURL
|
||||||
@browserWindow.webContents.send('load-settings-changed', @browserWindow.loadSettings)
|
@browserWindow.webContents.send('load-settings-changed', @browserWindow.loadSettings)
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,7 @@ class WindowManager
|
||||||
@_mainWindow.close()
|
@_mainWindow.close()
|
||||||
@_mainWindow = null
|
@_mainWindow = null
|
||||||
|
|
||||||
showMainWindow: ->
|
showMainWindow: (loadingMessage) ->
|
||||||
if @_mainWindow
|
if @_mainWindow
|
||||||
if @_mainWindow.isMinimized()
|
if @_mainWindow.isMinimized()
|
||||||
@_mainWindow.restore()
|
@_mainWindow.restore()
|
||||||
|
@ -72,12 +72,20 @@ class WindowManager
|
||||||
resourcePath ?= @resourcePath
|
resourcePath ?= @resourcePath
|
||||||
|
|
||||||
@_mainWindow = new AtomWindow
|
@_mainWindow = new AtomWindow
|
||||||
|
loadingMessage: loadingMessage
|
||||||
bootstrapScript: bootstrapScript
|
bootstrapScript: bootstrapScript
|
||||||
resourcePath: resourcePath
|
resourcePath: resourcePath
|
||||||
devMode: @devMode
|
devMode: @devMode
|
||||||
safeMode: @safeMode
|
safeMode: @safeMode
|
||||||
neverClose: true
|
neverClose: true
|
||||||
mainWindow: 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
|
Work Window
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -36,6 +36,10 @@ window.onload = function() {
|
||||||
throw error;
|
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
|
// Normalize to make sure drive letter case is consistent on Windows
|
||||||
process.resourcesPath = path.normalize(process.resourcesPath);
|
process.resourcesPath = path.normalize(process.resourcesPath);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue