Merge pull request #105 from lbryio/reactotron
add reactotron. fix batch resolve functionality for search results.
This commit is contained in:
commit
b5abddb69a
9 changed files with 84 additions and 17 deletions
4
index.js
4
index.js
|
@ -1,3 +1,7 @@
|
||||||
|
if (__DEV__) {
|
||||||
|
import('./reactotron').then(() => console.log('Reactotron Configured'));
|
||||||
|
}
|
||||||
|
|
||||||
import LBRYApp from './src/index';
|
import LBRYApp from './src/index';
|
||||||
|
|
||||||
export default LBRYApp;
|
export default LBRYApp;
|
||||||
|
|
53
package-lock.json
generated
53
package-lock.json
generated
|
@ -7047,8 +7047,8 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"lbry-redux": {
|
"lbry-redux": {
|
||||||
"version": "github:lbryio/lbry-redux#abe90e0665cfad3fb8853501ec058c5d1f0d9cc8",
|
"version": "github:lbryio/lbry-redux#2c569a729bb40d45249ca38150b00922162b7ce3",
|
||||||
"from": "github:lbryio/lbry-redux#abe90e0665cfad3fb8853501ec058c5d1f0d9cc8",
|
"from": "github:lbryio/lbry-redux#2c569a729bb40d45249ca38150b00922162b7ce3",
|
||||||
"requires": {
|
"requires": {
|
||||||
"proxy-polyfill": "0.1.6",
|
"proxy-polyfill": "0.1.6",
|
||||||
"reselect": "^3.0.0",
|
"reselect": "^3.0.0",
|
||||||
|
@ -8569,6 +8569,12 @@
|
||||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
|
||||||
"integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ="
|
"integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ="
|
||||||
},
|
},
|
||||||
|
"mitt": {
|
||||||
|
"version": "1.1.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/mitt/-/mitt-1.1.3.tgz",
|
||||||
|
"integrity": "sha512-mUDCnVNsAi+eD6qA0HkRkwYczbLHJ49z17BGe2PYRhZL4wpZUFZGJHU7/5tmvohoma+Hdn0Vh/oJTiPEmgSruA==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"mixin-deep": {
|
"mixin-deep": {
|
||||||
"version": "1.3.2",
|
"version": "1.3.2",
|
||||||
"resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.2.tgz",
|
"resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.2.tgz",
|
||||||
|
@ -10181,6 +10187,43 @@
|
||||||
"integrity": "sha512-kv5QlFFSZWo7OlJFNYbxRtY66JImuP2LcrFgyJfQaf85gSP+byzG21UbDQEYjU7f//ny8rwiEkO6py2Y+fEgAQ==",
|
"integrity": "sha512-kv5QlFFSZWo7OlJFNYbxRtY66JImuP2LcrFgyJfQaf85gSP+byzG21UbDQEYjU7f//ny8rwiEkO6py2Y+fEgAQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"reactotron-core-client": {
|
||||||
|
"version": "2.8.6",
|
||||||
|
"resolved": "https://registry.npmjs.org/reactotron-core-client/-/reactotron-core-client-2.8.6.tgz",
|
||||||
|
"integrity": "sha512-xgg6dusfgQHC98f4iRH/Zak/PNvA46znupEd2U7DSCmmhZbfCpSSveKUsYok0OW0HiSCSvi41tNELj+QU6pRVQ==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"reactotron-react-native": {
|
||||||
|
"version": "4.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/reactotron-react-native/-/reactotron-react-native-4.0.2.tgz",
|
||||||
|
"integrity": "sha512-zY5m0TV9y52h31/Vvd/Zs3jneEKYWbJ6vGrBeZ/d6Z2gVvwI3su+7B2qh8s00KHStIF4MTg0MrKc0FYRFWmmoQ==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"mitt": "1.1.3",
|
||||||
|
"query-string": "6.8.1",
|
||||||
|
"reactotron-core-client": "2.8.6",
|
||||||
|
"rn-host-detect": "1.1.5"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"query-string": {
|
||||||
|
"version": "6.8.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/query-string/-/query-string-6.8.1.tgz",
|
||||||
|
"integrity": "sha512-g6y0Lbq10a5pPQpjlFuojfMfV1Pd2Jw9h75ypiYPPia3Gcq2rgkKiIwbkS6JxH7c5f5u/B/sB+d13PU+g1eu4Q==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"decode-uri-component": "^0.2.0",
|
||||||
|
"split-on-first": "^1.0.0",
|
||||||
|
"strict-uri-encode": "^2.0.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"reactotron-redux": {
|
||||||
|
"version": "3.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/reactotron-redux/-/reactotron-redux-3.1.2.tgz",
|
||||||
|
"integrity": "sha512-2ScTmE2+kxjKPc7+vsYuw+igkhd4tjoftn4ouugVudQCO7B5vXVyQwLkNv/feaFfFoPlCQSVeJVg7PdzDFOsEQ==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"read-pkg": {
|
"read-pkg": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-2.0.0.tgz",
|
||||||
|
@ -10543,6 +10586,12 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"rn-host-detect": {
|
||||||
|
"version": "1.1.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/rn-host-detect/-/rn-host-detect-1.1.5.tgz",
|
||||||
|
"integrity": "sha512-ufk2dFT3QeP9HyZ/xTuMtW27KnFy815CYitJMqQm+pgG3ZAtHBsrU8nXizNKkqXGy3bQmhEoloVbrfbvMJMqkg==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"rsvp": {
|
"rsvp": {
|
||||||
"version": "4.8.5",
|
"version": "4.8.5",
|
||||||
"resolved": "https://registry.npmjs.org/rsvp/-/rsvp-4.8.5.tgz",
|
"resolved": "https://registry.npmjs.org/rsvp/-/rsvp-4.8.5.tgz",
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
"base-64": "^0.1.0",
|
"base-64": "^0.1.0",
|
||||||
"@expo/vector-icons": "^8.1.0",
|
"@expo/vector-icons": "^8.1.0",
|
||||||
"gfycat-style-urls": "^1.0.3",
|
"gfycat-style-urls": "^1.0.3",
|
||||||
"lbry-redux": "lbryio/lbry-redux#abe90e0665cfad3fb8853501ec058c5d1f0d9cc8",
|
"lbry-redux": "lbryio/lbry-redux#2c569a729bb40d45249ca38150b00922162b7ce3",
|
||||||
"lbryinc": "lbryio/lbryinc#053ca52f4f7f9bf8eb62a3581b183671a475ad1c",
|
"lbryinc": "lbryio/lbryinc#053ca52f4f7f9bf8eb62a3581b183671a475ad1c",
|
||||||
"lodash": ">=4.17.11",
|
"lodash": ">=4.17.11",
|
||||||
"merge": ">=1.2.1",
|
"merge": ">=1.2.1",
|
||||||
|
@ -70,6 +70,8 @@
|
||||||
"metro-react-native-babel-preset": "^0.56.0",
|
"metro-react-native-babel-preset": "^0.56.0",
|
||||||
"prettier": "^1.11.1",
|
"prettier": "^1.11.1",
|
||||||
"@react-native-community/eslint-config": "^0.0.5",
|
"@react-native-community/eslint-config": "^0.0.5",
|
||||||
"react-devtools": "^3.6.3"
|
"react-devtools": "^3.6.3",
|
||||||
|
"reactotron-react-native": "4.0.2",
|
||||||
|
"reactotron-redux": "3.1.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
8
reactotron.js
Normal file
8
reactotron.js
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
import AsyncStorage from '@react-native-community/async-storage';
|
||||||
|
import Reactotron from 'reactotron-react-native'
|
||||||
|
|
||||||
|
Reactotron
|
||||||
|
.setAsyncStorageHandler(AsyncStorage) // AsyncStorage would either come from `react-native` or `@react-native-community/async-storage` depending on where you get it from
|
||||||
|
.configure() // controls connection & communication settings
|
||||||
|
.useReactNative() // add all built-in react native plugins
|
||||||
|
.connect(); // let's connect!
|
|
@ -42,13 +42,15 @@ class FileListItem extends React.PureComponent {
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
const { claim, resolveUri, uri, batchResolve } = this.props;
|
const { claim, resolveUri, uri, batchResolve } = this.props;
|
||||||
if (!claim && !batchResolve) {
|
if (!claim && !batchResolve) {
|
||||||
|
console.log('resolving on componentDidMount?');
|
||||||
resolveUri(uri);
|
resolveUri(uri);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidUpdate() {
|
componentDidUpdate() {
|
||||||
const { claim, resolveUri, uri } = this.props;
|
const { claim, resolveUri, uri, batchResolve } = this.props;
|
||||||
if (!claim && uri !== this.state.url) {
|
if (!claim && uri !== this.state.url && !batchResolve) {
|
||||||
|
console.log('resolving on componentDidUpdate?');
|
||||||
this.setState({ url: uri }, () => resolveUri(uri));
|
this.setState({ url: uri }, () => resolveUri(uri));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ const select = (state, props) => ({
|
||||||
|
|
||||||
const perform = dispatch => ({
|
const perform = dispatch => ({
|
||||||
resolveUris: uris => dispatch(doResolveUris(uris)),
|
resolveUris: uris => dispatch(doResolveUris(uris)),
|
||||||
searchRecommended: query => dispatch(doSearch(query, 20, undefined, true)),
|
searchRecommended: query => dispatch(doSearch(query, 20, undefined, true, false)),
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(
|
export default connect(
|
||||||
|
|
|
@ -38,8 +38,8 @@ export default class RelatedContent extends React.PureComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidUpdate() {
|
componentDidUpdate() {
|
||||||
const { resolveUris, recommendedContent } = this.props;
|
const { isSearching, resolveUris, recommendedContent } = this.props;
|
||||||
if (!this.state.resolveStarted) {
|
if (!isSearching && !this.state.resolveStarted) {
|
||||||
this.setState({ resolveStarted: true }, () => {
|
this.setState({ resolveStarted: true }, () => {
|
||||||
if (recommendedContent && recommendedContent.length > 0) {
|
if (recommendedContent && recommendedContent.length > 0) {
|
||||||
// batch resolve the uris
|
// batch resolve the uris
|
||||||
|
|
|
@ -28,7 +28,7 @@ const select = state => ({
|
||||||
});
|
});
|
||||||
|
|
||||||
const perform = dispatch => ({
|
const perform = dispatch => ({
|
||||||
search: query => dispatch(doSearch(query, numSearchResults)),
|
search: query => dispatch(doSearch(query, numSearchResults, null, false, false)),
|
||||||
claimSearch: options => dispatch(doClaimSearch(options)),
|
claimSearch: options => dispatch(doClaimSearch(options)),
|
||||||
updateSearchQuery: query => dispatch(doUpdateSearchQuery(query)),
|
updateSearchQuery: query => dispatch(doUpdateSearchQuery(query)),
|
||||||
pushDrawerStack: () => dispatch(doPushDrawerStack(Constants.DRAWER_ROUTE_SEARCH)),
|
pushDrawerStack: () => dispatch(doPushDrawerStack(Constants.DRAWER_ROUTE_SEARCH)),
|
||||||
|
|
|
@ -59,6 +59,7 @@ class SearchPage extends React.PureComponent {
|
||||||
claimSearchOptions: null,
|
claimSearchOptions: null,
|
||||||
claimSearchRun: false,
|
claimSearchRun: false,
|
||||||
showTagResult: false,
|
showTagResult: false,
|
||||||
|
resultsResolved: false,
|
||||||
});
|
});
|
||||||
search(searchQuery);
|
search(searchQuery);
|
||||||
}
|
}
|
||||||
|
@ -110,6 +111,13 @@ class SearchPage extends React.PureComponent {
|
||||||
|
|
||||||
componentDidUpdate() {
|
componentDidUpdate() {
|
||||||
const { isSearching, resolveUris, uris } = this.props;
|
const { isSearching, resolveUris, uris } = this.props;
|
||||||
|
if (!isSearching && !this.state.resultsResolved) {
|
||||||
|
this.setState({ resultsResolved: true }, () => {
|
||||||
|
if (uris && uris.length > 0) {
|
||||||
|
resolveUris(uris);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getSearchQuery() {
|
getSearchQuery() {
|
||||||
|
@ -208,13 +216,7 @@ class SearchPage extends React.PureComponent {
|
||||||
ListEmptyComponent={!isSearching ? this.listEmptyComponent() : null}
|
ListEmptyComponent={!isSearching ? this.listEmptyComponent() : null}
|
||||||
ListHeaderComponent={this.state.currentUri ? this.listHeaderComponent(this.state.showTagResult) : null}
|
ListHeaderComponent={this.state.currentUri ? this.listHeaderComponent(this.state.showTagResult) : null}
|
||||||
renderItem={({ item }) => (
|
renderItem={({ item }) => (
|
||||||
<FileListItem
|
<FileListItem key={item} uri={item} style={searchStyle.resultItem} batchResolve navigation={navigation} />
|
||||||
key={item}
|
|
||||||
uri={item}
|
|
||||||
style={searchStyle.resultItem}
|
|
||||||
batchResolve
|
|
||||||
navigation={navigation}
|
|
||||||
/>
|
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
Loading…
Reference in a new issue