committed by
GitHub
6 changed files with 78 additions and 79 deletions
@ -0,0 +1,7 @@ |
|||||
|
const { SENTRY_URL } = process.env |
||||
|
|
||||
|
if (__PROD__ && SENTRY_URL) { |
||||
|
const Raven = require('raven') |
||||
|
const ravenConfig = { captureUnhandledRejections: true } |
||||
|
Raven.config(SENTRY_URL, ravenConfig).install() |
||||
|
} |
@ -1,18 +1,10 @@ |
|||||
// @flow
|
// @flow
|
||||
|
|
||||
require('env') |
|
||||
|
|
||||
const { SENTRY_URL } = process.env |
|
||||
|
|
||||
if (__PROD__ && SENTRY_URL) { |
|
||||
const Raven = require('raven') // eslint-disable-line global-require
|
|
||||
const ravenConfig = { captureUnhandledRejections: true } |
|
||||
Raven.config(SENTRY_URL, ravenConfig).install() |
|
||||
} |
|
||||
|
|
||||
process.setMaxListeners(0) |
process.setMaxListeners(0) |
||||
|
|
||||
|
require('../env') |
||||
require('../globals') |
require('../globals') |
||||
|
require('../init-sentry') |
||||
require('./app') |
require('./app') |
||||
|
|
||||
setImmediate(() => require('./bridge')) // eslint-disable-line global-require
|
setImmediate(() => require('./bridge')) |
||||
|
@ -0,0 +1,59 @@ |
|||||
|
// @flow
|
||||
|
|
||||
|
import React from 'react' |
||||
|
import { remote } from 'electron' |
||||
|
import { render } from 'react-dom' |
||||
|
import { AppContainer } from 'react-hot-loader' |
||||
|
import createHistory from 'history/createHashHistory' |
||||
|
|
||||
|
import createStore from 'renderer/createStore' |
||||
|
import events from 'renderer/events' |
||||
|
|
||||
|
import { fetchAccounts } from 'actions/accounts' |
||||
|
import { fetchSettings } from 'actions/settings' |
||||
|
import { isLocked } from 'reducers/application' |
||||
|
import { getLanguage } from 'reducers/settings' |
||||
|
|
||||
|
import db from 'helpers/db' |
||||
|
|
||||
|
import App from 'components/App' |
||||
|
|
||||
|
import 'styles/global' |
||||
|
|
||||
|
// init db with defaults if needed
|
||||
|
db.init('accounts', []) |
||||
|
db.init('settings', {}) |
||||
|
|
||||
|
const history = createHistory() |
||||
|
const store = createStore(history) |
||||
|
const rootNode = document.getElementById('app') |
||||
|
|
||||
|
store.dispatch(fetchSettings()) |
||||
|
|
||||
|
const state = store.getState() || {} |
||||
|
const language = getLanguage(state) |
||||
|
const locked = isLocked(state) |
||||
|
|
||||
|
if (!locked) { |
||||
|
store.dispatch(fetchAccounts()) |
||||
|
} |
||||
|
|
||||
|
function r(Comp) { |
||||
|
if (rootNode) { |
||||
|
render(<AppContainer>{Comp}</AppContainer>, rootNode) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
r(<App store={store} history={history} language={language} />) |
||||
|
|
||||
|
// Only init events on MainWindow
|
||||
|
if (remote.getCurrentWindow().name === 'MainWindow') { |
||||
|
events({ store, locked }) |
||||
|
} |
||||
|
|
||||
|
if (module.hot) { |
||||
|
module.hot.accept('../components/App', () => { |
||||
|
const NewApp = require('../components/App').default |
||||
|
r(<NewApp store={store} history={history} language={language} />) |
||||
|
}) |
||||
|
} |
Loading…
Reference in new issue