diff --git a/app/ReactotronConfig.js b/app/ReactotronConfig.js index 3a4b6b00..c6d66e7a 100644 --- a/app/ReactotronConfig.js +++ b/app/ReactotronConfig.js @@ -1,20 +1,13 @@ /* eslint-disable */ -import Reactotron, { asyncStorage, networking, openInEditor } from 'reactotron-react-native'; -import { NativeModules } from 'react-native'; - +import Reactotron from 'reactotron-react-native'; import { reactotronRedux } from 'reactotron-redux'; +import sagaPlugin from 'reactotron-redux-saga' -// uncomment the following lines to test on a device -// let scriptHostname; -// if (__DEV__) { -// const scriptURL = NativeModules.SourceCode.scriptURL; -// scriptHostname = scriptURL.split('://')[1].split(':')[0]; -// } - -Reactotron.configure(/*{ host: scriptHostname }*/) // controls connection & communication settings - .useReactNative() // add all built-in react native plugins - .use(reactotronRedux()) - .use(asyncStorage()) - .use(networking()) - .use(openInEditor()) - .connect(); +if (__DEV__) { + Reactotron + .configure() + .useReactNative() + .use(reactotronRedux()) + .use(sagaPlugin()) + .connect(); +} diff --git a/app/containers/MessageBox/index.js b/app/containers/MessageBox/index.js index 93678f99..313e7740 100644 --- a/app/containers/MessageBox/index.js +++ b/app/containers/MessageBox/index.js @@ -146,6 +146,7 @@ export default class MessageBox extends React.PureComponent { icons.push( this.recordAudioMessage()} diff --git a/app/lib/createStore.js b/app/lib/createStore.js index 27f75b92..288b64a3 100644 --- a/app/lib/createStore.js +++ b/app/lib/createStore.js @@ -1,40 +1,37 @@ -import { createStore, applyMiddleware, compose } from 'redux'; +import { createStore as reduxCreateStore, applyMiddleware, compose } from 'redux'; import createSagaMiddleware from 'redux-saga'; import logger from 'redux-logger'; -import { composeWithDevTools } from 'remote-redux-devtools'; import applyAppStateListener from 'redux-enhancer-react-native-appstate'; +import Reactotron from 'reactotron-react-native'; // eslint-disable-line import reducers from '../reducers'; import sagas from '../sagas'; -const sagaMiddleware = createSagaMiddleware(); -let enhacers; +const createStore = __DEV__ ? Reactotron.createStore : reduxCreateStore; +let sagaMiddleware; +let enhancers; if (__DEV__) { /* eslint-disable global-require */ const reduxImmutableStateInvariant = require('redux-immutable-state-invariant').default(); + sagaMiddleware = createSagaMiddleware({ + sagaMonitor: Reactotron.createSagaMonitor() + }); - const devComposer = composeWithDevTools({ hostname: 'localhost', port: 8000 }); - enhacers = devComposer( + enhancers = compose( applyAppStateListener(), applyMiddleware(reduxImmutableStateInvariant), applyMiddleware(sagaMiddleware), applyMiddleware(logger) ); } else { - enhacers = compose( + sagaMiddleware = createSagaMiddleware(); + enhancers = compose( applyAppStateListener(), applyMiddleware(sagaMiddleware) ); } -// uncomment the following lines to integrate reactotron with redux -// const store = Reactotron.createStore( -// reducers, -// enhacers(createStore)(reducers), -// ); - - -const store = enhacers(createStore)(reducers); +const store = createStore(reducers, enhancers); sagaMiddleware.run(sagas); if (module.hot && typeof module.hot.accept === 'function') { diff --git a/index.android.js b/index.android.js index f258d0e1..87ef488b 100644 --- a/index.android.js +++ b/index.android.js @@ -2,13 +2,10 @@ import 'babel-polyfill'; import 'regenerator-runtime/runtime'; import { AppRegistry, UIManager } from 'react-native'; +import './app/ReactotronConfig'; import './app/push'; import RocketChat from './app/index'; UIManager.setLayoutAnimationEnabledExperimental(true); -// import './app/ReactotronConfig'; -// import { AppRegistry } from 'react-native'; -// import Routes from './app/routes'; -// AppRegistry.registerComponent('RocketChatRN', () => RocketChat); diff --git a/index.ios.js b/index.ios.js index bbe64aa5..cad115bd 100644 --- a/index.ios.js +++ b/index.ios.js @@ -2,11 +2,8 @@ import 'babel-polyfill'; import 'regenerator-runtime/runtime'; import { AppRegistry } from 'react-native'; - +import './app/ReactotronConfig'; import './app/push'; import RocketChat from './app/index'; -// import { AppRegistry } from 'react-native'; -// import Routes from './app/routes'; -// import './app/ReactotronConfig'; -// + AppRegistry.registerComponent('RocketChatRN', () => RocketChat); diff --git a/package.json b/package.json index 7aab8db1..da87961a 100644 --- a/package.json +++ b/package.json @@ -75,7 +75,6 @@ "redux-logger": "^3.0.6", "redux-saga": "^0.16.0", "regenerator-runtime": "^0.11.1", - "remote-redux-devtools": "^0.5.12", "simple-markdown": "^0.3.1", "snyk": "^1.61.1", "strip-ansi": "^4.0.0" @@ -99,7 +98,9 @@ "jest-cli": "^22.0.3", "react-dom": "^16.2.0", "react-test-renderer": "^16.2.0", - "reactotron-react-native": "^1.14.0" + "reactotron-react-native": "^1.14.0", + "reactotron-redux": "^1.13.0", + "reactotron-redux-saga": "^1.13.0" }, "jest": { "preset": "react-native", diff --git a/yarn.lock b/yarn.lock index b3535950..95c937ea 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2566,10 +2566,6 @@ clone-stats@^0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/clone-stats/-/clone-stats-0.0.1.tgz#b88f94a82cf38b8791d58046ea4029ad88ca99d1" -clone@2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/clone/-/clone-2.1.1.tgz#d217d1e961118e3ac9a4b8bba3285553bf647cdb" - clone@^1.0.0, clone@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/clone/-/clone-1.0.2.tgz#260b7a99ebb1edfe247538175f783243cb19d149" @@ -2698,10 +2694,6 @@ component-emitter@1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/component-emitter/-/component-emitter-1.1.2.tgz#296594f2753daa63996d2af08d15a95116c9aec3" -component-emitter@1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/component-emitter/-/component-emitter-1.2.0.tgz#ccd113a86388d06482d03de3fc7df98526ba8efe" - component-emitter@1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/component-emitter/-/component-emitter-1.2.1.tgz#137918d6d78283f7df7a6b7c5a63e140e69425e6" @@ -4322,10 +4314,6 @@ get-caller-file@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-1.0.2.tgz#f702e63127e7e231c160a80c1554acb70d5047e5" -get-params@^0.1.2: - version "0.1.2" - resolved "https://registry.yarnpkg.com/get-params/-/get-params-0.1.2.tgz#bae0dfaba588a0c60d7834c0d8dc2ff60eeef2fe" - get-stream@^2.2.0: version "2.3.1" resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-2.3.1.tgz#5f38f93f346009666ee0150a054167f91bdd95de" @@ -5565,10 +5553,6 @@ js-yaml@~3.7.0: argparse "^1.0.7" esprima "^2.6.0" -jsan@^3.1.0, jsan@^3.1.5: - version "3.1.9" - resolved "https://registry.yarnpkg.com/jsan/-/jsan-3.1.9.tgz#2705676c1058f0a7d9ac266ad036a5769cfa7c96" - jsbn@~0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513" @@ -5776,10 +5760,6 @@ levn@^0.3.0, levn@~0.3.0: prelude-ls "~1.1.2" type-check "~0.3.2" -linked-list@0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/linked-list/-/linked-list-0.1.0.tgz#798b0ff97d1b92a4fd08480f55aea4e9d49d37bf" - load-json-file@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-1.1.0.tgz#956905708d58b4bab4c2261b04f59f31c99374c0" @@ -8032,6 +8012,25 @@ reactotron-react-native@^1.14.0: rn-host-detect "^1.1.3" socket.io-client "~1.7.3" +reactotron-redux-saga@^1.13.0: + version "1.13.0" + resolved "https://registry.yarnpkg.com/reactotron-redux-saga/-/reactotron-redux-saga-1.13.0.tgz#f6bb75c16806f2cc09be97e4973743f41a157a18" + dependencies: + ramda "^0.24.1" + ramdasauce "^2.0.0" + reactotron-core-client "^1.13.0" + redux "^3.7.1" + redux-saga "^0.15.3" + +reactotron-redux@^1.13.0: + version "1.13.0" + resolved "https://registry.yarnpkg.com/reactotron-redux/-/reactotron-redux-1.13.0.tgz#20f8ce98cbb5e310e041dc85fc4dc4f904aa5dcc" + dependencies: + ramda "^0.24.1" + ramdasauce "^2.0.0" + reactotron-core-client "^1.13.0" + redux "^3.7.1" + read-all-stream@^3.0.0: version "3.1.0" resolved "https://registry.yarnpkg.com/read-all-stream/-/read-all-stream-3.1.0.tgz#35c3e177f2078ef789ee4bfafa4373074eaef4fa" @@ -8185,13 +8184,6 @@ reduce-function-call@^1.0.1: dependencies: balanced-match "^0.4.2" -redux-devtools-instrument@^1.3.3: - version "1.8.2" - resolved "https://registry.yarnpkg.com/redux-devtools-instrument/-/redux-devtools-instrument-1.8.2.tgz#5e91cfe402e790dae3fd2f0d235f7b7d84b09ffe" - dependencies: - lodash "^4.2.0" - symbol-observable "^1.0.2" - redux-enhancer-react-native-appstate@^0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/redux-enhancer-react-native-appstate/-/redux-enhancer-react-native-appstate-0.3.0.tgz#fb917093758ce09f432cd0b2b563d1361e8f576f" @@ -8209,11 +8201,15 @@ redux-logger@^3.0.6: dependencies: deep-diff "^0.3.5" +redux-saga@^0.15.3: + version "0.15.6" + resolved "https://registry.yarnpkg.com/redux-saga/-/redux-saga-0.15.6.tgz#8638dc522de6c6c0a496fe8b2b5466287ac2dc4d" + redux-saga@^0.16.0: version "0.16.0" resolved "https://registry.yarnpkg.com/redux-saga/-/redux-saga-0.16.0.tgz#0a231db0a1489301dd980f6f2f88d8ced418f724" -redux@^3.7.2: +redux@^3.7.1, redux@^3.7.2: version "3.7.2" resolved "https://registry.yarnpkg.com/redux/-/redux-3.7.2.tgz#06b73123215901d25d065be342eb026bc1c8537b" dependencies: @@ -8302,33 +8298,6 @@ relateurl@0.2.x: version "0.2.7" resolved "https://registry.yarnpkg.com/relateurl/-/relateurl-0.2.7.tgz#54dbf377e51440aca90a4cd274600d3ff2d888a9" -remote-redux-devtools@^0.5.12: - version "0.5.12" - resolved "https://registry.yarnpkg.com/remote-redux-devtools/-/remote-redux-devtools-0.5.12.tgz#42cb95dfa9e54c1d9671317c5e7bba41e68caec2" - dependencies: - jsan "^3.1.5" - querystring "^0.2.0" - redux-devtools-instrument "^1.3.3" - remotedev-utils "^0.1.1" - rn-host-detect "^1.0.1" - socketcluster-client "^5.3.1" - -remotedev-serialize@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/remotedev-serialize/-/remotedev-serialize-0.1.0.tgz#074768e98cb7aa806f45994eeb0c8af95120ee32" - dependencies: - jsan "^3.1.0" - -remotedev-utils@^0.1.1: - version "0.1.4" - resolved "https://registry.yarnpkg.com/remotedev-utils/-/remotedev-utils-0.1.4.tgz#643700819a943678073c75eb185e81d96620b348" - dependencies: - get-params "^0.1.2" - jsan "^3.1.5" - lodash "^4.0.0" - remotedev-serialize "^0.1.0" - shortid "^2.2.6" - remove-trailing-separator@^1.0.1: version "1.1.0" resolved "https://registry.yarnpkg.com/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz#c24bce2a283adad5bc3f58e0d48249b92379d8ef" @@ -8531,7 +8500,7 @@ ripemd160@^2.0.0, ripemd160@^2.0.1: hash-base "^2.0.0" inherits "^2.0.1" -rn-host-detect@^1.0.1, rn-host-detect@^1.1.3: +rn-host-detect@^1.1.3: version "1.1.3" resolved "https://registry.yarnpkg.com/rn-host-detect/-/rn-host-detect-1.1.3.tgz#242d76e2fa485c48d751416e65b7cce596969e91" @@ -8591,26 +8560,6 @@ sax@~1.1.1: version "1.1.6" resolved "https://registry.yarnpkg.com/sax/-/sax-1.1.6.tgz#5d616be8a5e607d54e114afae55b7eaf2fcc3240" -sc-channel@~1.0.6: - version "1.0.6" - resolved "https://registry.yarnpkg.com/sc-channel/-/sc-channel-1.0.6.tgz#b38bd47a993e78290fbc53467867f6b2a0a08639" - dependencies: - sc-emitter "1.x.x" - -sc-emitter@1.x.x, sc-emitter@~1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/sc-emitter/-/sc-emitter-1.1.0.tgz#ef119d4222f4c64f887b486964ef11116cdd0e75" - dependencies: - component-emitter "1.2.0" - -sc-errors@~1.3.0: - version "1.3.3" - resolved "https://registry.yarnpkg.com/sc-errors/-/sc-errors-1.3.3.tgz#c00bc4c766a970cc8d5937d08cd58e931d7dae05" - -sc-formatter@~3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/sc-formatter/-/sc-formatter-3.0.0.tgz#c91b1fe56c260abd5a6a2e6af98c724bc7998a38" - schema-utils@^0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-0.3.0.tgz#f5877222ce3e931edae039f17eb3716e7137f8cf" @@ -8778,10 +8727,6 @@ shellwords@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/shellwords/-/shellwords-0.1.1.tgz#d6b9181c1a48d397324c84871efbcfc73fc0654b" -shortid@^2.2.6: - version "2.2.8" - resolved "https://registry.yarnpkg.com/shortid/-/shortid-2.2.8.tgz#033b117d6a2e975804f6f0969dbe7d3d0b355131" - signal-exit@^3.0.0, signal-exit@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d" @@ -9016,20 +8961,6 @@ socket.io-parser@2.3.1: isarray "0.0.1" json3 "3.3.2" -socketcluster-client@^5.3.1: - version "5.5.2" - resolved "https://registry.yarnpkg.com/socketcluster-client/-/socketcluster-client-5.5.2.tgz#9d4369e0e722ff7e55e5422c2d44f5afe1aff128" - dependencies: - base-64 "0.1.0" - clone "2.1.1" - linked-list "0.1.0" - querystring "0.2.0" - sc-channel "~1.0.6" - sc-emitter "~1.1.0" - sc-errors "~1.3.0" - sc-formatter "~3.0.0" - ws "3.0.0" - sort-keys@^1.0.0: version "1.1.2" resolved "https://registry.yarnpkg.com/sort-keys/-/sort-keys-1.1.2.tgz#441b6d4d346798f1b4e49e8920adfba0e543f9ad" @@ -9295,7 +9226,7 @@ svgo@^0.7.0: sax "~1.2.1" whet.extend "~0.9.9" -symbol-observable@^1.0.2, symbol-observable@^1.0.3: +symbol-observable@^1.0.3: version "1.0.4" resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-1.0.4.tgz#29bf615d4aa7121bdd898b22d4b3f9bc4e2aa03d" @@ -10050,13 +9981,6 @@ write@^0.2.1: dependencies: mkdirp "^0.5.1" -ws@3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/ws/-/ws-3.0.0.tgz#98ddb00056c8390cb751e7788788497f99103b6c" - dependencies: - safe-buffer "~5.0.1" - ultron "~1.1.0" - ws@^1.1.0: version "1.1.4" resolved "https://registry.yarnpkg.com/ws/-/ws-1.1.4.tgz#57f40d036832e5f5055662a397c4de76ed66bf61"