Compare commits

..
11 changed files with 59 additions and 43 deletions

No files matched your search

+2 -2
View File
@@ -7067,8 +7067,8 @@
}
},
"lbry-redux": {
"version": "github:lbryio/lbry-redux#e8f29f1c47b136669df265babb109d2488a37db0",
"from": "github:lbryio/lbry-redux#e8f29f1c47b136669df265babb109d2488a37db0",
"version": "github:lbryio/lbry-redux#c910cd2b80b165843a81fdf6ce96094429b94ec8",
"from": "github:lbryio/lbry-redux#c910cd2b80b165843a81fdf6ce96094429b94ec8",
"requires": {
"proxy-polyfill": "0.1.6",
"reselect": "^3.0.0",
+1 -1
View File
@@ -12,7 +12,7 @@
"base-64": "^0.1.0",
"@expo/vector-icons": "^8.1.0",
"gfycat-style-urls": "^1.0.3",
"lbry-redux": "lbryio/lbry-redux#e8f29f1c47b136669df265babb109d2488a37db0",
"lbry-redux": "lbryio/lbry-redux#c910cd2b80b165843a81fdf6ce96094429b94ec8",
"lbryinc": "lbryio/lbryinc#053ca52f4f7f9bf8eb62a3581b183671a475ad1c",
"lodash": ">=4.17.11",
"merge": ">=1.2.1",
+1 -1
View File
@@ -134,7 +134,7 @@ const Constants = {
ORDER_BY_EFFECTIVE_AMOUNT: 'effective_amount',
DEFAULT_PAGE_SIZE: 10,
DEFAULT_PAGE_SIZE: 20,
ALL_PLACEHOLDER: '_all',
+4 -23
View File
@@ -109,7 +109,6 @@ class FilePage extends React.PureComponent {
onComponentFocused = () => {
StatusBar.setHidden(false);
console.log('fileComponent Focused...');
NativeModules.Firebase.setCurrentScreen('File').then(result => {
DeviceEventEmitter.addListener('onStoragePermissionGranted', this.handleStoragePermissionGranted);
DeviceEventEmitter.addListener('onStoragePermissionRefused', this.handleStoragePermissionRefused);
@@ -653,13 +652,13 @@ class FilePage extends React.PureComponent {
const isPlayable = mediaType === 'video' || mediaType === 'audio';
const isViewable = mediaType === 'image' || mediaType === 'text';
const purchaseUrl = this.getPurchaseUrl();
NativeModules.Firebase.track('purchase_uri', { uri: purchaseUrl });
const { permanent_url: uri } = claim;
NativeModules.Firebase.track('purchase_uri', { uri: uri });
if (!isPlayable) {
this.checkStoragePermissionForDownload();
} else {
this.confirmPurchaseUri(purchaseUrl, costInfo, !isPlayable);
this.confirmPurchaseUri(uri, costInfo, !isPlayable);
}
if (isPlayable) {
@@ -672,19 +671,6 @@ class FilePage extends React.PureComponent {
}
};
getPurchaseUrl = () => {
const { claim, navigation } = this.props;
const { permanent_url: permanentUrl } = claim;
let purchaseUrl;
if (navigation.state.params) {
const { uri, fullUri } = navigation.state.params;
purchaseUrl = fullUri || uri || permanentUrl;
}
return purchaseUrl;
};
onDownloadPressed = () => {
this.checkStoragePermissionForDownload();
};
@@ -810,11 +796,6 @@ class FilePage extends React.PureComponent {
'<html>' +
' <head>' +
' <meta charset="utf-8"/>' +
' <meta name="viewport" content="width=device-width, user-scalable=no"/>' +
' <style type="text/css">' +
' body { margin: 16px }' +
' img { width: 100%; }' +
' </style>' +
' </head>' +
' <body>' +
' <div id="content"></div>' +
@@ -861,7 +842,7 @@ class FilePage extends React.PureComponent {
<View style={filePageStyle.pageContainer}>
<UriBar value={uri} navigation={navigation} />
{isResolvingUri && (
<View style={filePageStyle.busyContainer}>
<View stylebuildWeb={filePageStyle.busyContainer}>
<ActivityIndicator size="large" color={Colors.NextLbryGreen} />
<Text style={filePageStyle.infoText}>{__('Loading decentralized data...')}</Text>
</View>
+7 -5
View File
@@ -5,6 +5,7 @@ import {
doResolvedSearch,
doUpdateSearchQuery,
makeSelectResolvedSearchResults,
makeSelectResolvedSearchResultsLastPageReached,
makeSelectSearchUris,
selectClaimSearchByQuery,
selectIsSearching,
@@ -17,20 +18,21 @@ import { selectCurrentRoute } from 'redux/selectors/drawer';
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
import SearchPage from './view';
const numSearchResults = 25;
const select = state => ({
claimSearchByQuery: selectClaimSearchByQuery(state),
currentRoute: selectCurrentRoute(state),
isSearching: selectIsSearching(state),
query: selectSearchValue(state),
resolvingUris: selectResolvingUris(state),
uris: makeSelectSearchUris(makeSelectQueryWithOptions(null, numSearchResults)(state))(state),
results: makeSelectResolvedSearchResults(makeSelectQueryWithOptions(null, numSearchResults)(state))(state),
uris: makeSelectSearchUris(makeSelectQueryWithOptions(null, Constants.DEFAULT_PAGE_SIZE)(state))(state),
results: makeSelectResolvedSearchResults(makeSelectQueryWithOptions(null, Constants.DEFAULT_PAGE_SIZE)(state))(state),
lastPageReached: makeSelectResolvedSearchResultsLastPageReached(
makeSelectQueryWithOptions(null, Constants.DEFAULT_PAGE_SIZE)(state),
)(state),
});
const perform = dispatch => ({
search: query => dispatch(doResolvedSearch(query, numSearchResults, null, false, {})),
search: (query, from) => dispatch(doResolvedSearch(query, Constants.DEFAULT_PAGE_SIZE, from, false, {})),
claimSearch: options => dispatch(doClaimSearch(options)),
updateSearchQuery: query => dispatch(doUpdateSearchQuery(query)),
pushDrawerStack: () => dispatch(doPushDrawerStack(Constants.DRAWER_ROUTE_SEARCH)),
+35 -6
View File
@@ -20,9 +20,12 @@ import FloatingWalletBalance from 'component/floatingWalletBalance';
import UriBar from 'component/uriBar';
import searchStyle from 'styles/search';
const softLimit = 500;
class SearchPage extends React.PureComponent {
state = {
currentQuery: null,
currentFrom: 0,
currentUri: null,
showTagResult: false,
claimSearchRun: false,
@@ -56,6 +59,7 @@ class SearchPage extends React.PureComponent {
const searchQuery = query || this.getSearchQuery();
if (searchQuery && searchQuery.trim().length > 0) {
this.setState({
currentFrom: 0,
currentQuery: searchQuery,
currentUri: isURIValid(searchQuery) ? normalizeURI(searchQuery) : null,
claimSearchOptions: null,
@@ -64,7 +68,7 @@ class SearchPage extends React.PureComponent {
resultsResolved: false,
tagResultDisplayed: false,
});
search(searchQuery);
search(searchQuery, 0);
}
});
};
@@ -83,12 +87,13 @@ class SearchPage extends React.PureComponent {
if (query && query.trim().length > 0 && query !== this.state.currentQuery) {
this.setState({
currentFrom: 0,
currentQuery: query,
currentUri: isURIValid(query) ? normalizeURI(query) : null,
resultsResolved: false,
tagResultDisplayed: false,
});
search(query);
search(query, 0);
}
}
@@ -134,13 +139,15 @@ class SearchPage extends React.PureComponent {
const { search } = this.props;
this.setState({
currentUri: isURIValid(keywords) ? normalizeURI(keywords) : null,
currentFrom: 0,
currentQuery: keywords,
claimSearchOptions: null,
claimSearchRun: false,
showTagResult: false,
resultsResolved: false,
tagResultDisplayed: false,
});
search(keywords);
search(keywords, 0);
};
listEmptyComponent = () => {
@@ -186,6 +193,21 @@ class SearchPage extends React.PureComponent {
navigation.navigate({ routeName: Constants.DRAWER_ROUTE_TAG, key: `tagPage`, params: { tag: tag.toLowerCase() } });
};
handleVerticalEndReached = () => {
// fetch more results
const { lastPageReached, results, search, isSearching } = this.props;
if (lastPageReached || (results && results.length > softLimit)) {
return;
}
if (!isSearching) {
const from = results ? results.length : 0;
this.setState({ currentFrom: from }, () => {
search(this.state.currentQuery, from);
});
}
};
render() {
const { isSearching, navigation, query, results } = this.props;
@@ -193,13 +215,13 @@ class SearchPage extends React.PureComponent {
<View style={searchStyle.container}>
<UriBar value={query} navigation={navigation} onSearchSubmitted={this.handleSearchSubmitted} />
{isSearching && (
{isSearching && this.state.currentFrom === 0 && (
<View style={searchStyle.busyContainer}>
<ActivityIndicator size="large" color={Colors.NextLbryGreen} style={searchStyle.loading} />
</View>
)}
{!isSearching && (
{(!isSearching || this.state.currentFrom > 0) && (
<FlatList
extraData={this.state}
style={searchStyle.scrollContainer}
@@ -207,8 +229,10 @@ class SearchPage extends React.PureComponent {
keyboardShouldPersistTaps={'handled'}
data={results}
keyExtractor={(item, index) => item.claimId}
initialNumToRender={8}
initialNumToRender={10}
maxToRenderPerBatch={20}
onEndReached={this.handleVerticalEndReached}
onEndReachedThreshold={0.2}
removeClippedSubviews
ListEmptyComponent={!isSearching ? this.listEmptyComponent() : null}
ListHeaderComponent={this.listHeaderComponent(this.state.showTagResult, this.state.currentQuery)}
@@ -217,6 +241,11 @@ class SearchPage extends React.PureComponent {
)}
/>
)}
{this.state.currentFrom > 0 && isSearching && (
<View style={searchStyle.moreLoading}>
<ActivityIndicator size="small" color={Colors.NextLbryGreen} />
</View>
)}
<FloatingWalletBalance navigation={navigation} />
</View>
);
-2
View File
@@ -24,8 +24,6 @@ const Colors = {
StatsAudio: '#f6a637',
StatsImage: '#ff4a7d',
StatsOther: '#26bcf7',
ThumbnailPlaceholder: '#d5d5d5',
};
export default Colors;
-1
View File
@@ -32,7 +32,6 @@ const fileListStyle = StyleSheet.create({
color: Colors.White,
},
thumbnail: {
backgroundColor: Colors.ThumbnailPlaceholder,
width: thumbnailWidth,
height: thumbnailHeight,
marginRight: screenWidthPixels <= 720 ? 10 : 12,
+1
View File
@@ -65,6 +65,7 @@ const filePageStyle = StyleSheet.create({
titleRow: {
flexDirection: 'row',
marginTop: 12,
marginBottom: 2,
marginLeft: 12,
marginRight: 12,
alignItems: 'center',
+2 -2
View File
@@ -46,8 +46,8 @@ const floatingButtonStyle = StyleSheet.create({
fontSize: 16,
},
bottomRight: {
right: 0,
bottom: 0,
right: 10,
bottom: 10,
},
rewardIcon: {
color: Colors.White,
+6
View File
@@ -80,6 +80,12 @@ const searchStyle = StyleSheet.create({
loading: {
position: 'absolute',
},
moreLoading: {
width: '100%',
height: 48,
alignItems: 'center',
justifyContent: 'center',
},
});
export default searchStyle;