diff --git a/package.json b/package.json index 28f8b7274..7a24765fd 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "bugs": { "url": "https://github.com/nylas/N1/issues" }, - "electronVersion": "0.36.2", + "electronVersion": "0.35.4", "dependencies": { "async": "^0.9", "atom-keymap": "^6.1.1", diff --git a/script/bootstrap b/script/bootstrap index 11bf19469..8d045b7d4 100755 --- a/script/bootstrap +++ b/script/bootstrap @@ -48,7 +48,7 @@ function makeSqlite3Command() { // Use our local version of npm (npm 3x) to build sqlite var npmPath = '"' + path.resolve(__dirname, '..', 'build', 'node_modules', '.bin', 'npm') + '"'; - return npmPath + " install https://github.com/bengotow/node-sqlite3/archive/bengotow/usleep.tar.gz --ignore-scripts && cd node_modules/sqlite3 && "+nodeGypPath+" configure rebuild --target="+targetElectronVersion+" --arch="+targetArch+" --target_platform="+targetPlatform+" --dist-url=https://atom.io/download/atom-shell --module_name=node_sqlite3 --module_path=../lib/binding/node-v47-"+targetPlatform+"-"+targetArch + return npmPath + " install https://github.com/bengotow/node-sqlite3/archive/bengotow/usleep.tar.gz --ignore-scripts && cd node_modules/sqlite3 && "+nodeGypPath+" configure rebuild --target="+targetElectronVersion+" --arch="+targetArch+" --target_platform="+targetPlatform+" --dist-url=https://atom.io/download/atom-shell --module_name=node_sqlite3 --module_path=../lib/binding/node-v46-"+targetPlatform+"-"+targetArch } function bootstrap() { diff --git a/spec/spec-bootstrap.coffee b/spec/spec-bootstrap.coffee index a5821399a..4ccccee80 100644 --- a/spec/spec-bootstrap.coffee +++ b/spec/spec-bootstrap.coffee @@ -1,5 +1,5 @@ # Start the crash reporter before anything else. -# require('crash-reporter').start(productName: 'N1', companyName: 'Nylas') +require('crash-reporter').start(productName: 'N1', companyName: 'Nylas') path = require 'path' diff --git a/src/browser/window-manager.coffee b/src/browser/window-manager.coffee index 8b03ff428..8948cfe26 100644 --- a/src/browser/window-manager.coffee +++ b/src/browser/window-manager.coffee @@ -85,7 +85,6 @@ class WindowManager center: true width: 640 height: 396 - minHeight: 396 resizable: false ### diff --git a/src/nylas-env.coffee b/src/nylas-env.coffee index 05ebb673f..68b86da8f 100644 --- a/src/nylas-env.coffee +++ b/src/nylas-env.coffee @@ -654,16 +654,18 @@ class NylasEnvConstructor extends Model @deserializeSheetContainer() @packages.activate() @keymaps.loadUserKeymap() + @requireUserInitScript() unless safeMode @menu.update() - @getCurrentWindow().hide() + @showRootWindow() + + ipcRenderer.send('window-command', 'window:loaded') + + showRootWindow: -> document.getElementById("application-loading-cover").remove() document.body.classList.add("window-loaded") - window.requestAnimationFrame => - window.requestAnimationFrame => - @restoreWindowDimensions() - @getCurrentWindow().show() - ipcRenderer.send('window-command', 'window:loaded') + @restoreWindowDimensions() + @getCurrentWindow().setMinimumSize(875, 500) registerCommands: -> {resourcePath} = @getLoadSettings() @@ -865,6 +867,17 @@ class NylasEnvConstructor extends Model crashRenderProcess: -> process.crash() + getUserInitScriptPath: -> + initScriptPath = fs.resolve(@getConfigDirPath(), 'init', ['js', 'coffee']) + initScriptPath ? path.join(@getConfigDirPath(), 'init.coffee') + + requireUserInitScript: -> + if userInitScriptPath = @getUserInitScriptPath() + try + require(userInitScriptPath) if fs.isFileSync(userInitScriptPath) + catch error + console.log(error) + # Require the module with the given globals. # # The globals will be set on the `window` object and removed after the diff --git a/static/index.html b/static/index.html index ba85af211..6e53a881c 100644 --- a/static/index.html +++ b/static/index.html @@ -3,7 +3,7 @@ - + diff --git a/static/index.js b/static/index.js index ef8241149..70cd59d4d 100644 --- a/static/index.js +++ b/static/index.js @@ -49,13 +49,13 @@ function setupWindow (loadSettings) { ModuleCache.add(loadSettings.resourcePath) // Start the crash reporter before anything else. - // require('crash-reporter').start({ - // productName: 'N1', - // companyName: 'Nylas', - // // By explicitly passing the app version here, we could save the call - // // of "require('remote').require('app').getVersion()". - // extra: {_version: loadSettings.appVersion} - // }) + require('crash-reporter').start({ + productName: 'N1', + companyName: 'Nylas', + // By explicitly passing the app version here, we could save the call + // of "require('remote').require('app').getVersion()". + extra: {_version: loadSettings.appVersion} + }) setupVmCompatibility() setupCsonCache(CompileCache.getCacheDirectory()) @@ -77,39 +77,33 @@ function setupVmCompatibility () { window.onload = function() { - // wait for first frame, which will be blank - window.requestAnimationFrame(function() { - // wait for second frame, which is correct - window.requestAnimationFrame(function() { - try { - var startTime = Date.now(); + try { + var startTime = Date.now(); - var fs = require('fs'); - var path = require('path'); + var fs = require('fs'); + var path = require('path'); - // Skip "?loadSettings=". - var rawLoadSettings = decodeURIComponent(location.search.substr(14)); - var loadSettings; - try { - loadSettings = JSON.parse(rawLoadSettings); - } catch (error) { - console.error("Failed to parse load settings: " + rawLoadSettings); - throw error; - } + // Skip "?loadSettings=". + var rawLoadSettings = decodeURIComponent(location.search.substr(14)); + var loadSettings; + try { + loadSettings = JSON.parse(rawLoadSettings); + } catch (error) { + console.error("Failed to parse load settings: " + rawLoadSettings); + throw error; + } - if (loadSettings.loadingMessage) { - document.getElementById("application-loading-text-supplement").innerHTML = loadSettings.loadingMessage - } + 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); + // Normalize to make sure drive letter case is consistent on Windows + process.resourcesPath = path.normalize(process.resourcesPath); - setupWindow(loadSettings) - setLoadTime(Date.now() - startTime) - } - catch (error) { - handleSetupError(error) - } - }); - }); + setupWindow(loadSettings) + setLoadTime(Date.now() - startTime) + } + catch (error) { + handleSetupError(error) + } }