mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-09-07 21:24:24 +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.
|
||||
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.
|
||||
|
|
|
@ -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.<br/>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
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -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);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue