diff --git a/boilerplate/App/Config/ReactotronConfig.js b/boilerplate/App/Config/ReactotronConfig.js index e305de4..dbc88b6 100644 --- a/boilerplate/App/Config/ReactotronConfig.js +++ b/boilerplate/App/Config/ReactotronConfig.js @@ -1,48 +1,16 @@ -import { StartupTypes } from '../Redux/StartupRedux' import Config from '../Config/DebugConfig' import Immutable from 'seamless-immutable' -import Reactotron, { overlay, trackGlobalErrors } from 'reactotron-react-native' -import apisaucePlugin from 'reactotron-apisauce' -import { reactotronRedux } from 'reactotron-redux' +import Reactotron from 'reactotron-react-native' +import { reactotronRedux as reduxPlugin } from 'reactotron-redux' import sagaPlugin from 'reactotron-redux-saga' if (Config.useReactotron) { + // https://github.com/infinitered/reactotron for more options! Reactotron - .configure({ - // host: '10.0.3.2' // default is localhost (on android don't forget to `adb reverse tcp:9090 tcp:9090`) - name: 'Ignite App' // would you like to see your app's name? - }) - - // forward all errors to Reactotron - .use(trackGlobalErrors({ - // ignore all error frames from react-native (for example) - veto: (frame) => - frame.fileName.indexOf('/node_modules/react-native/') >= 0 - })) - - // register apisauce so we can install a monitor later - .use(apisaucePlugin()) - - // add overlay ability for graphics - .use(overlay()) - - // setup the redux integration with Reactotron - .use(reactotronRedux({ - // you can flag some of your actions as important by returning true here - isActionImportant: action => action.type === StartupTypes.STARTUP, - - // you can flag to exclude certain types too... especially the chatty ones - // except: ['EFFECT_TRIGGERED', 'EFFECT_RESOLVED', 'EFFECT_REJECTED', 'persist/REHYDRATE'], - - // Fires when Reactotron uploads a new copy of the state tree. Since our reducers are - // immutable with `seamless-immutable`, we ensure we convert to that format. - onRestore: state => Immutable(state) - })) - - // register the redux-saga plugin so we can use the monitor in CreateStore.js + .configure({ name: 'Ignite App' }) + .useReactNative() + .use(reduxPlugin({ onRestore: Immutable })) .use(sagaPlugin()) - - // let's connect! .connect() // Let's clear Reactotron on every time we load the app @@ -51,13 +19,4 @@ if (Config.useReactotron) { // Totally hacky, but this allows you to not both importing reactotron-react-native // on every file. This is just DEV mode, so no big deal. console.tron = Reactotron -} else { - // a mock version should you decide to leave console.tron in your codebase - console.tron = { - log: () => false, - warn: () => false, - error: () => false, - display: () => false, - image: () => false - } } diff --git a/boilerplate/App/Containers/App.js b/boilerplate/App/Containers/App.js index 5f0586c..a123eee 100644 --- a/boilerplate/App/Containers/App.js +++ b/boilerplate/App/Containers/App.js @@ -1,4 +1,5 @@ import '../Config' +import DebugConfig from '../Config/DebugConfig' import React, { Component } from 'react' import { Provider } from 'react-redux' import RootContainer from './RootContainer' @@ -26,7 +27,7 @@ class App extends Component { } } -// allow reactotron overlay for fast design -const AppWithBenefits = console.tron.overlay(App) - -export default AppWithBenefits +// allow reactotron overlay for fast design in dev mode +export default DebugConfig.useReactotron + ? console.tron.overlay(App) + : App diff --git a/boilerplate/App/Redux/CreateStore.js b/boilerplate/App/Redux/CreateStore.js index 83a6f76..79bceb0 100644 --- a/boilerplate/App/Redux/CreateStore.js +++ b/boilerplate/App/Redux/CreateStore.js @@ -14,7 +14,7 @@ export default (rootReducer, rootSaga) => { /* ------------- Saga Middleware ------------- */ - const sagaMonitor = __DEV__ ? console.tron.createSagaMonitor() : null + const sagaMonitor = Config.useReactotron ? console.tron.createSagaMonitor() : null const sagaMiddleware = createSagaMiddleware({ sagaMonitor }) middleware.push(sagaMiddleware) diff --git a/boilerplate/App/Services/Api.js b/boilerplate/App/Services/Api.js index df3f60a..fab9a49 100644 --- a/boilerplate/App/Services/Api.js +++ b/boilerplate/App/Services/Api.js @@ -20,13 +20,6 @@ const create = (baseURL = 'https://api.github.com/') => { timeout: 10000 }) - // Wrap api's addMonitor to allow the calling code to attach - // additional monitors in the future. But only in __DEV__ and only - // if we've attached Reactotron to console (it isn't during unit tests). - if (__DEV__ && console.tron) { - api.addMonitor(console.tron.apisauce) - } - // ------ // STEP 2 // ------ diff --git a/boilerplate/App/Services/RehydrationServices.js b/boilerplate/App/Services/RehydrationServices.js index f0937f3..db2698d 100644 --- a/boilerplate/App/Services/RehydrationServices.js +++ b/boilerplate/App/Services/RehydrationServices.js @@ -2,6 +2,7 @@ import ReduxPersist from '../Config/ReduxPersist' import { AsyncStorage } from 'react-native' import { persistStore } from 'redux-persist' import StartupActions from '../Redux/StartupRedux' +import DebugConfig from '../Config/DebugConfig' const updateReducers = (store: Object) => { const reducerVersion = ReduxPersist.reducerVersion @@ -11,15 +12,17 @@ const updateReducers = (store: Object) => { // Check to ensure latest reducer version AsyncStorage.getItem('reducerVersion').then((localVersion) => { if (localVersion !== reducerVersion) { - console.tron.display({ - name: 'PURGE', - value: { - 'Old Version:': localVersion, - 'New Version:': reducerVersion - }, - preview: 'Reducer Version Change Detected', - important: true - }) + if (DebugConfig.useReactotron) { + console.tron.display({ + name: 'PURGE', + value: { + 'Old Version:': localVersion, + 'New Version:': reducerVersion + }, + preview: 'Reducer Version Change Detected', + important: true + }) + } // Purge store persistStore(store, config, startup).purge() AsyncStorage.setItem('reducerVersion', reducerVersion) diff --git a/boilerplate/package.json.ejs b/boilerplate/package.json.ejs index 6098980..3efdd64 100644 --- a/boilerplate/package.json.ejs +++ b/boilerplate/package.json.ejs @@ -41,10 +41,9 @@ "husky": "^0.13.1", "react-addons-test-utils": "^15.3.1", "react-dom": "^15.4.0", - "reactotron-apisauce": "^1.7.0", - "reactotron-react-native": "^1.7.0", - "reactotron-redux": "^1.7.0", - "reactotron-redux-saga": "^1.7.0" + "reactotron-react-native": "^1.11.1", + "reactotron-redux": "^1.11.1", + "reactotron-redux-saga": "^1.11.1" }, "jest": { "testMatch": [