Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Commit

Permalink
Init things later that use user dir
Browse files Browse the repository at this point in the history
Auditors: @bridiver
  • Loading branch information
bbondy committed May 5, 2016
1 parent 395769a commit 04ade02
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 deletions.
24 changes: 13 additions & 11 deletions app/cmdLine.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,19 +63,21 @@ if (!isDarwin) {
}
}

if (process.env.NODE_ENV !== 'development' && process.env.NODE_ENV !== 'test') {
const appAlreadyStartedShouldQuit = app.makeSingleInstance((argv, workingDirectory) => {
// Someone tried to run a second instance, we should focus our window.
if (isDarwin) {
focusOrOpenWindow()
} else {
focusOrOpenWindow(getUrlFromCommandLine(argv))
app.on('ready', () => {
if (process.env.NODE_ENV !== 'development' && process.env.NODE_ENV !== 'test') {
const appAlreadyStartedShouldQuit = app.makeSingleInstance((argv, workingDirectory) => {
// Someone tried to run a second instance, we should focus our window.
if (isDarwin) {
focusOrOpenWindow()
} else {
focusOrOpenWindow(getUrlFromCommandLine(argv))
}
})
if (appAlreadyStartedShouldQuit) {
app.exit(0)
}
})
if (appAlreadyStartedShouldQuit) {
app.exit(0)
}
}
})

app.on('will-finish-launching', () => {
app.on('activate', () => {
Expand Down
8 changes: 4 additions & 4 deletions app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,6 @@ const keytar = require('keytar')
const settings = require('../js/constants/settings')
const siteSettings = require('../js/state/siteSettings')

let loadAppStatePromise = SessionStore.loadAppState().catch(() => {
return SessionStore.defaultAppState()
})

// Used to collect the per window state when shutting down the application
let perWindowState = []
let sessionStateStoreCompleteOnQuit = false
Expand Down Expand Up @@ -171,6 +167,10 @@ const initiateSessionStateSave = debounce(() => {
}, 5 * 60 * 1000)

app.on('ready', () => {
let loadAppStatePromise = SessionStore.loadAppState().catch(() => {
return SessionStore.defaultAppState()
})

app.on('certificate-error', (e, webContents, url, error, cert, cb) => {
let host = urlParse(url).host
if (host && acceptCertDomains[host] === true) {
Expand Down

0 comments on commit 04ade02

Please sign in to comment.