Gaëtan Renaudeau
7 years ago
committed by
GitHub
18 changed files with 129 additions and 33 deletions
@ -0,0 +1,19 @@ |
|||
// @flow
|
|||
|
|||
import React from 'react' |
|||
import styled from 'styled-components' |
|||
|
|||
const TopGradientBox = styled.div` |
|||
width: 100%; |
|||
height: 80px; |
|||
position: absolute; |
|||
top: 0; |
|||
left: 0; |
|||
background: linear-gradient(#ffffff 40%, rgba(255, 255, 255, 0)); |
|||
z-index: 2; |
|||
pointer-events: none; |
|||
` |
|||
|
|||
const el = <TopGradientBox /> |
|||
|
|||
export default () => el |
@ -0,0 +1,15 @@ |
|||
// @flow
|
|||
|
|||
import db from 'helpers/db' |
|||
import uuid from 'uuid/v4' |
|||
|
|||
// a user is an anonymous way to identify a same instance of the app
|
|||
|
|||
export default () => { |
|||
let user = db.get('user') |
|||
if (!user) { |
|||
user = { id: uuid() } |
|||
db.set('user', user) |
|||
} |
|||
return user |
|||
} |
@ -1,7 +0,0 @@ |
|||
const { SENTRY_URL } = process.env |
|||
|
|||
if (__PROD__ && SENTRY_URL) { |
|||
const Raven = require('raven') |
|||
const ravenConfig = { captureUnhandledRejections: true } |
|||
Raven.config(SENTRY_URL, ravenConfig).install() |
|||
} |
@ -0,0 +1,14 @@ |
|||
import { ipcRenderer } from 'electron' |
|||
import { sentryLogsBooleanSelector } from 'reducers/settings' |
|||
|
|||
let isSentryInstalled = false |
|||
|
|||
export default store => next => action => { |
|||
next(action) |
|||
const state = store.getState() |
|||
const sentryLogs = sentryLogsBooleanSelector(state) |
|||
if (sentryLogs !== isSentryInstalled) { |
|||
isSentryInstalled = sentryLogs |
|||
ipcRenderer.send('sentryLogsChanged', { value: sentryLogs }) |
|||
} |
|||
} |
@ -1,14 +1,3 @@ |
|||
require('@babel/polyfill') |
|||
|
|||
const Raven = require('raven-js') |
|||
|
|||
require('../env') |
|||
|
|||
const { SENTRY_URL } = process.env |
|||
|
|||
if (__PROD__ && SENTRY_URL) { |
|||
Raven.config(SENTRY_URL, { allowSecretKey: true }).install() |
|||
window.addEventListener('unhandledrejection', event => Raven.captureException(event.reason)) |
|||
} |
|||
|
|||
require('./init') |
|||
|
@ -0,0 +1,9 @@ |
|||
// @flow
|
|||
|
|||
import Raven from 'raven-js' |
|||
import user from 'helpers/user' |
|||
import install from './install' |
|||
|
|||
export default (shouldSendCallback: () => boolean) => { |
|||
install(Raven, shouldSendCallback, user().id) |
|||
} |
@ -0,0 +1,24 @@ |
|||
// @flow
|
|||
|
|||
require('../env') |
|||
|
|||
export default (Raven: any, shouldSendCallback: () => boolean, userId: string) => { |
|||
if (!__SENTRY_URL__) return |
|||
let r = Raven.config(__SENTRY_URL__, { |
|||
captureUnhandledRejections: true, |
|||
allowSecretKey: true, |
|||
release: __APP_VERSION__, |
|||
environment: __DEV__ ? 'development' : 'production', |
|||
shouldSendCallback, |
|||
}) |
|||
const user = { |
|||
ip_address: null, |
|||
id: userId, |
|||
} |
|||
if (r.setUserContext) { |
|||
r = r.setUserContext(user) |
|||
} else if (r.setContext) { |
|||
r = r.setContext({ user }) |
|||
} |
|||
r.install() |
|||
} |
@ -0,0 +1,8 @@ |
|||
// @flow
|
|||
|
|||
import Raven from 'raven' |
|||
import install from './install' |
|||
|
|||
export default (shouldSendCallback: () => boolean, userId: string) => { |
|||
install(Raven, shouldSendCallback, userId) |
|||
} |
Loading…
Reference in new issue