Compare commits

..
Author SHA1 Message Date
Akinwale Ariwodola 5681630e4c updates for patch release 2020-01-03 18:51:39 +01:00
Akinwale Ariwodola 1eecae469d rename Subscriptions -> Following. fix bad subs. 2019-12-29 14:56:15 +01:00
Akinwale Ariwodola f7c8bf3949 fix subsequent searches on search page. 2019-12-29 11:10:33 +01:00
Akinwale Ariwodola d538838921 hook reactotron into redux. more search page tweaks. 2019-12-29 11:02:11 +01:00
Akinwale Ariwodola b5abddb69a Merge pull request #105 from lbryio/reactotron
add reactotron. fix batch resolve functionality for search results.
2019-12-29 10:35:13 +01:00
Akinwale Ariwodola 15cbdcfaca add reactotron. fix batch resolve functionality for search results. 2019-12-29 10:34:00 +01:00
Akinwale Ariwodola 30246a189c remove console.log 2019-12-29 07:23:42 +01:00
Akinwale Ariwodola f77f0a7aa2 search tweaks and package updates 2019-12-29 06:48:13 +01:00
Akinwale Ariwodola 36d4bd7e99 Merge pull request #104 from lbryio/navigation-drawer-test
update react-navigation-drawer package
2019-12-29 06:45:47 +01:00
Akinwale Ariwodola b8f2a9e24f tweak related content view for perf. fix displayed dates. 2019-12-28 21:02:29 +01:00
Akinwale Ariwodola d7edbf55b5 react-navigation-drawer 2.3.3 2019-12-28 19:36:17 +01:00
Akinwale Ariwodola d362d9e8dd remove console.log 2019-12-28 15:56:37 +01:00
Akinwale Ariwodola f47693fb35 First run changes (#103)
* streamlined first run
* download button tweaks
* fix downloads. file page tweaks.
2019-12-28 15:45:12 +01:00
Akinwale Ariwodola 54b10c818e Merge pull request #102 from lbryio/react-native-0.61
update to RN 0.61.5
2019-12-28 15:16:56 +01:00
Akinwale Ariwodola 4b283e6606 update to RN 0.61.5 2019-12-28 15:14:37 +01:00
22 changed files with 3883 additions and 2157 deletions

No files matched your search

+4
View File
@@ -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;
+3399 -1850
View File
File diff suppressed because it is too large. Load diff
+22 -19
View File
@@ -12,50 +12,50 @@
"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",
"moment": "^2.22.1", "moment": "^2.22.1",
"react": "16.8.6", "react": "16.9.0",
"react-native": "0.59.10", "react-native": "0.61.5",
"@react-native-community/async-storage": "^1.5.1", "@react-native-community/async-storage": "^1.5.1",
"react-native-camera": "^2.11.1", "react-native-camera": "^3.15.0",
"react-native-country-picker-modal": "^0.6.2", "react-native-country-picker-modal": "^1.10.0",
"react-native-exception-handler": "2.9.0", "react-native-exception-handler": "2.9.0",
"react-native-fast-image": "^6.1.1", "react-native-fast-image": "^7.0.2",
"react-native-fs": "^2.13.3", "react-native-fs": "^2.13.3",
"react-native-gesture-handler": "1.3.0", "react-native-gesture-handler": "1.5.2",
"react-native-image-zoom-viewer": "^2.2.5", "react-native-image-zoom-viewer": "^2.2.5",
"react-native-password-strength-meter": "^0.0.2", "react-native-password-strength-meter": "^0.0.2",
"react-native-phone-input": "lbryio/react-native-phone-input", "react-native-phone-input": "lbryio/react-native-phone-input",
"react-native-reanimated": "1.2.0", "react-native-reanimated": "1.4.0",
"react-native-snackbar": "1.0.2", "react-native-snackbar": "2.0.4",
"react-native-super-grid": "^3.0.4", "react-native-super-grid": "^3.0.4",
"react-native-vector-icons": "^6.6.0", "react-native-vector-icons": "^6.6.0",
"react-native-video": "lbryio/react-native-video#exoplayer-lbry-android", "react-native-video": "lbryio/react-native-video#7992ff945872f9bd00a3736d9ff1318f343abf47",
"react-navigation": "^3.11.0", "react-navigation": "^3.13.0",
"react-navigation-drawer": "^1.4.0", "react-navigation-drawer": "^2.3.3",
"react-navigation-redux-helpers": "^3.0.2", "react-navigation-redux-helpers": "^3.0.2",
"react-navigation-stack": "^1.8.1", "react-navigation-stack": "^1.8.1",
"react-redux": "^5.0.3", "react-redux": "^5.0.3",
"redux": "^4.0.4", "redux": "^4.0.4",
"redux-persist": "^5.10.0", "redux-persist": "^6.0.0",
"redux-persist-filesystem-storage": "^1.3.2", "redux-persist-filesystem-storage": "^2.1.0",
"redux-persist-transform-compress": "^4.2.0", "redux-persist-transform-compress": "^4.2.0",
"redux-persist-transform-filter": "0.0.18", "redux-persist-transform-filter": "0.0.18",
"redux-thunk": "^2.3.0", "redux-thunk": "^2.3.0",
"rn-fetch-blob": "0.10.15", "rn-fetch-blob": "0.12.0",
"seedrandom": "3.0.3" "seedrandom": "3.0.3"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.5.4", "@babel/core": "^7.6.2",
"babel-eslint": "10.0.2", "babel-eslint": "10.0.2",
"@babel/plugin-proposal-object-rest-spread": "^7.5.4", "@babel/plugin-proposal-object-rest-spread": "^7.5.4",
"babel-preset-env": "^1.6.1", "babel-preset-env": "^1.6.1",
"babel-preset-stage-2": "^6.18.0", "babel-preset-stage-2": "^6.18.0",
"babel-plugin-module-resolver": "^3.1.1", "babel-plugin-module-resolver": "^3.1.1",
"eslint": "^5.16.0", "eslint": "^6.5.1",
"eslint-config-standard": "^12.0.0", "eslint-config-standard": "^12.0.0",
"eslint-config-standard-jsx": "^6.0.2", "eslint-config-standard-jsx": "^6.0.2",
"eslint-plugin-flowtype": "^2.46.1", "eslint-plugin-flowtype": "^2.46.1",
@@ -67,8 +67,11 @@
"flow-babel-webpack-plugin": "^1.1.1", "flow-babel-webpack-plugin": "^1.1.1",
"husky": "^0.14.3", "husky": "^0.14.3",
"lint-staged": "^7.0.4", "lint-staged": "^7.0.4",
"metro-react-native-babel-preset": "^0.55.0", "metro-react-native-babel-preset": "^0.56.0",
"prettier": "^1.11.1", "prettier": "^1.11.1",
"react-devtools": "^3.6.3" "@react-native-community/eslint-config": "^0.0.5",
"react-devtools": "^3.6.3",
"reactotron-react-native": "4.0.2",
"reactotron-redux": "3.1.2"
} }
} }
+12
View File
@@ -0,0 +1,12 @@
import AsyncStorage from '@react-native-community/async-storage';
import Reactotron from 'reactotron-react-native';
import { reactotronRedux } from 'reactotron-redux';
const reactotron = 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
.use(reactotronRedux())
.connect();
export default reactotron;
+1 -1
View File
@@ -10,7 +10,7 @@ import discoverStyle from 'styles/discover';
const groupedMenuItems = { const groupedMenuItems = {
'Find content': [ 'Find content': [
{ icon: 'hashtag', label: 'Your Tags', route: Constants.DRAWER_ROUTE_DISCOVER }, { icon: 'hashtag', label: 'Your Tags', route: Constants.DRAWER_ROUTE_DISCOVER },
{ icon: 'heart', solid: true, label: 'Subscriptions', route: Constants.DRAWER_ROUTE_SUBSCRIPTIONS }, { icon: 'heart', solid: true, label: 'Following', route: Constants.DRAWER_ROUTE_SUBSCRIPTIONS },
{ icon: 'globe-americas', label: 'All Content', route: Constants.DRAWER_ROUTE_TRENDING }, { icon: 'globe-americas', label: 'All Content', route: Constants.DRAWER_ROUTE_TRENDING },
], ],
'Your content': [ 'Your content': [
-1
View File
@@ -30,7 +30,6 @@ class FileDownloadButton extends React.PureComponent {
fileInfo, fileInfo,
downloading, downloading,
uri, uri,
purchaseUri,
costInfo, costInfo,
isPlayable, isPlayable,
isViewable, isViewable,
+1 -1
View File
@@ -36,5 +36,5 @@ const perform = dispatch => ({
export default connect( export default connect(
select, select,
perform perform,
)(FileListItem); )(FileListItem);
+6 -4
View File
@@ -6,6 +6,7 @@ import Colors from 'styles/colors';
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
import DateTime from 'component/dateTime'; import DateTime from 'component/dateTime';
import FileItemMedia from 'component/fileItemMedia'; import FileItemMedia from 'component/fileItemMedia';
import FilePrice from 'component/filePrice';
import Icon from 'react-native-vector-icons/FontAwesome5'; import Icon from 'react-native-vector-icons/FontAwesome5';
import Link from 'component/link'; import Link from 'component/link';
import NsfwOverlay from 'component/nsfwOverlay'; import NsfwOverlay from 'component/nsfwOverlay';
@@ -47,8 +48,8 @@ class FileListItem extends React.PureComponent {
} }
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) {
this.setState({ url: uri }, () => resolveUri(uri)); this.setState({ url: uri }, () => resolveUri(uri));
} }
} }
@@ -166,6 +167,7 @@ class FileListItem extends React.PureComponent {
size={16} size={16}
/> />
)} )}
<FilePrice uri={uri} style={fileListStyle.filePriceContainer} textStyle={fileListStyle.filePriceText} />
<View style={fileListStyle.detailsContainer}> <View style={fileListStyle.detailsContainer}>
{featuredResult && ( {featuredResult && (
<Text style={fileListStyle.featuredUri} numberOfLines={1}> <Text style={fileListStyle.featuredUri} numberOfLines={1}>
@@ -178,7 +180,7 @@ class FileListItem extends React.PureComponent {
{!title && !name && <Text style={fileListStyle.uri}>{uri}</Text>} {!title && !name && <Text style={fileListStyle.uri}>{uri}</Text>}
{!title && !name && ( {!title && !name && (
<View style={fileListStyle.row}> <View style={fileListStyle.row}>
<ActivityIndicator size={'small'} color={featuredResult ? Colors.White : Colors.LbryGreen} /> <ActivityIndicator size={'small'} color={featuredResult ? Colors.White : Colors.NextLbryGreen} />
</View> </View>
)} )}
</View> </View>
@@ -209,7 +211,7 @@ class FileListItem extends React.PureComponent {
normalizeURI(shortChannelUri || fullChannelUri), normalizeURI(shortChannelUri || fullChannelUri),
null, null,
false, false,
fullChannelUri fullChannelUri,
); );
}} }}
/> />
+6 -4
View File
@@ -1,25 +1,27 @@
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { import {
doResolveUris, doResolveUris,
doSearch,
makeSelectClaimForUri, makeSelectClaimForUri,
makeSelectRecommendedContentForUri, makeSelectRecommendedContentForUri,
makeSelectTitleForUri, selectResolvingUris,
selectIsSearching, selectIsSearching,
} from 'lbry-redux'; } from 'lbry-redux';
import RelatedContent from './view'; import RelatedContent from './view';
const select = (state, props) => ({ const select = (state, props) => ({
claim: makeSelectClaimForUri(props.uri)(state), claim: makeSelectClaimForUri(props.uri)(state),
recommendedContent: makeSelectRecommendedContentForUri(props.uri)(state),
title: makeSelectTitleForUri(props.uri)(state),
isSearching: selectIsSearching(state), isSearching: selectIsSearching(state),
recommendedContent: makeSelectRecommendedContentForUri(props.uri)(state),
resolvingUris: selectResolvingUris(state),
}); });
const perform = dispatch => ({ const perform = dispatch => ({
resolveUris: uris => dispatch(doResolveUris(uris)), resolveUris: uris => dispatch(doResolveUris(uris)),
searchRecommended: query => dispatch(doSearch(query, 20, undefined, true, false)),
}); });
export default connect( export default connect(
select, select,
perform perform,
)(RelatedContent); )(RelatedContent);
+39 -5
View File
@@ -8,20 +8,54 @@ import fileListStyle from 'styles/fileList';
import relatedContentStyle from 'styles/relatedContent'; import relatedContentStyle from 'styles/relatedContent';
export default class RelatedContent extends React.PureComponent { export default class RelatedContent extends React.PureComponent {
state = {
resolveStarted: false,
};
componentDidMount() { componentDidMount() {
const { resolveUris, recommendedContent } = this.props; const { title, searchRecommended } = this.props;
if (recommendedContent && recommendedContent.length > 0) { if (title) {
// batch resolve the uris searchRecommended(title);
resolveUris(recommendedContent); }
}
shouldComponentUpdate(nextProps, nextState) {
const { isSearching, recommendedContent } = nextProps;
return isSearching || (!isSearching && this.allContentResolved());
}
allContentResolved() {
const { recommendedContent, resolvingUris } = this.props;
if (recommendedContent) {
let allResolved = true;
recommendedContent.forEach(uri => {
allResolved = allResolved && !resolvingUris.includes(uri);
});
return allResolved;
}
return false;
}
componentDidUpdate() {
const { isSearching, resolveUris, recommendedContent } = this.props;
if (!isSearching && !this.state.resolveStarted) {
this.setState({ resolveStarted: true }, () => {
if (recommendedContent && recommendedContent.length > 0) {
// batch resolve the uris
resolveUris(recommendedContent);
}
});
} }
} }
render() { render() {
const { recommendedContent, navigation, uri, fullUri } = this.props; const { isSearching, recommendedContent, navigation, uri, fullUri } = this.props;
return ( return (
<View style={relatedContentStyle.container}> <View style={relatedContentStyle.container}>
<Text style={relatedContentStyle.title}>{__('Related Content')}</Text> <Text style={relatedContentStyle.title}>{__('Related Content')}</Text>
{isSearching && <ActivityIndicator size={'small'} color={Colors.NextLbryGreen} />}
{recommendedContent && {recommendedContent &&
recommendedContent recommendedContent
.filter(recommendedUri => recommendedUri !== normalizeURI(fullUri)) .filter(recommendedUri => recommendedUri !== normalizeURI(fullUri))
+15 -5
View File
@@ -46,7 +46,7 @@ class UriBar extends React.PureComponent {
const { currentRoute: prevRoute } = this.props; const { currentRoute: prevRoute } = this.props;
if (Constants.DRAWER_ROUTE_SEARCH === currentRoute && currentRoute !== prevRoute) { if (Constants.DRAWER_ROUTE_SEARCH === currentRoute && currentRoute !== prevRoute) {
this.setState({ currentValue: query, inputText: query }); this.setState({ currentValue: query, inputText: query }, () => this.setCaretPosition(query));
} }
} }
@@ -75,7 +75,9 @@ class UriBar extends React.PureComponent {
} }
}, UriBar.INPUT_TIMEOUT); }, UriBar.INPUT_TIMEOUT);
} }
this.setState({ inputText: newValue, currentValue: newValue, changeTextTimeout: timeout }); this.setState({ inputText: newValue, currentValue: newValue, changeTextTimeout: timeout }, () =>
this.setCaretPosition(newValue),
);
}; };
handleItemPress = item => { handleItemPress = item => {
@@ -85,7 +87,7 @@ class UriBar extends React.PureComponent {
Keyboard.dismiss(); Keyboard.dismiss();
if (SEARCH_TYPES.SEARCH === type) { if (SEARCH_TYPES.SEARCH === type) {
this.setState({ currentValue: value }); this.setState({ currentValue: value }, () => this.setCaretPosition(value));
updateSearchQuery(value); updateSearchQuery(value);
if (onSearchSubmitted) { if (onSearchSubmitted) {
@@ -129,6 +131,12 @@ class UriBar extends React.PureComponent {
} }
} }
setCaretPosition(text) {
if (this.textInput && text && text.length > 0) {
this.textInput.setNativeProps({ selection: { start: text.length, end: text.length } });
}
}
handleSubmitEditing = () => { handleSubmitEditing = () => {
const { navigation, onSearchSubmitted, updateSearchQuery } = this.props; const { navigation, onSearchSubmitted, updateSearchQuery } = this.props;
if (this.state.inputText) { if (this.state.inputText) {
@@ -179,7 +187,7 @@ class UriBar extends React.PureComponent {
value, value,
} = this.props; } = this.props;
if (this.state.currentValue === null) { if (this.state.currentValue === null) {
this.setState({ currentValue: value }); this.setState({ currentValue: value }, () => this.setCaretPosition(value));
} }
let style = [ let style = [
@@ -253,7 +261,9 @@ class UriBar extends React.PureComponent {
autoCorrect={false} autoCorrect={false}
style={uriBarStyle.uriText} style={uriBarStyle.uriText}
onLayout={() => { onLayout={() => {
this.setSelection(); if (!this.state.focused) {
this.setSelection();
}
}} }}
selectTextOnFocus selectTextOnFocus
placeholder={__('Search movies, music, and more')} placeholder={__('Search movies, music, and more')}
+6 -2
View File
@@ -38,9 +38,10 @@ class WalletSend extends React.PureComponent<Props> {
handleSend = () => { handleSend = () => {
const { balance, sendToAddress, notify } = this.props; const { balance, sendToAddress, notify } = this.props;
const { address, amount } = this.state; const { address, amount } = this.state;
if (address && !regexAddress.test(address)) { if (address && (!regexAddress.test(address) || address.substring(0, 1) === 'r')) {
notify({ notify({
message: __('The recipient address is not a valid LBRY address.'), message: __('The recipient address is not a valid LBRY address.'),
isError: true,
}); });
return; return;
} }
@@ -48,6 +49,7 @@ class WalletSend extends React.PureComponent<Props> {
if (amount > balance) { if (amount > balance) {
notify({ notify({
message: __('Insufficient credits'), message: __('Insufficient credits'),
isError: true,
}); });
return; return;
} }
@@ -72,6 +74,7 @@ class WalletSend extends React.PureComponent<Props> {
const { notify } = this.props; const { notify } = this.props;
notify({ notify({
message: __('The recipient address is not a valid LBRY address.'), message: __('The recipient address is not a valid LBRY address.'),
isError: true,
}); });
} }
}; };
@@ -97,9 +100,10 @@ class WalletSend extends React.PureComponent<Props> {
this.setState({ this.setState({
address: value, address: value,
addressChanged: true, addressChanged: true,
addressValid: value.trim().length === 0 || regexAddress.test(value), addressValid: value.trim().length === 0 || (regexAddress.test(value) && !value.startsWith('r')),
}) })
} }
numberOfLines={1}
onBlur={this.handleAddressInputBlur} onBlur={this.handleAddressInputBlur}
onSubmitEditing={this.handleAddressInputSubmit} onSubmitEditing={this.handleAddressInputSubmit}
placeholder={'bbFxRyXXXXXXXXXXXZD8nE7XTLUxYnddTs'} placeholder={'bbFxRyXXXXXXXXXXXZD8nE7XTLUxYnddTs'}
+3 -2
View File
@@ -42,6 +42,7 @@ import AppWithNavigationState, {
} from 'component/AppNavigator'; } from 'component/AppNavigator';
import { REHYDRATE, PURGE, persistCombineReducers, persistStore } from 'redux-persist'; import { REHYDRATE, PURGE, persistCombineReducers, persistStore } from 'redux-persist';
import { __ } from 'i18n'; import { __ } from 'i18n';
import reactotron from '../reactotron';
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
import getStoredStateMigrateV4 from 'redux-persist/lib/integration/getStoredStateMigrateV4'; import getStoredStateMigrateV4 from 'redux-persist/lib/integration/getStoredStateMigrateV4';
import FilesystemStorage from 'redux-persist-filesystem-storage'; import FilesystemStorage from 'redux-persist-filesystem-storage';
@@ -179,7 +180,7 @@ const sharedStateCallback = ({ dispatch, getState }) => {
const emailVerified = selectUserVerifiedEmail(state); const emailVerified = selectUserVerifiedEmail(state);
if (syncEnabled && emailVerified) { if (syncEnabled && emailVerified) {
NativeModules.UtilityModule.getSecureValue(Constants.KEY_WALLET_PASSWORD).then(password => NativeModules.UtilityModule.getSecureValue(Constants.KEY_WALLET_PASSWORD).then(password =>
dispatch(doGetSync(password)) dispatch(doGetSync(password)),
); );
} }
}; };
@@ -195,7 +196,7 @@ const composeEnhancers = compose;
const store = createStore( const store = createStore(
enableBatching(reducers), enableBatching(reducers),
{}, // initial state, {}, // initial state,
composeEnhancers(applyMiddleware(...middleware)) composeEnhancers(applyMiddleware(...middleware), reactotron.createEnhancer()),
); );
window.store = store; window.store = store;
+1 -7
View File
@@ -9,7 +9,6 @@ import {
doDeletePurchasedUri, doDeletePurchasedUri,
doResolveUri, doResolveUri,
doResolveUris, doResolveUris,
doSearch,
doSendTip, doSendTip,
doToast, doToast,
makeSelectIsUriResolving, makeSelectIsUriResolving,
@@ -19,7 +18,6 @@ import {
makeSelectContentPositionForUri, makeSelectContentPositionForUri,
makeSelectContentTypeForUri, makeSelectContentTypeForUri,
makeSelectMetadataForUri, makeSelectMetadataForUri,
makeSelectRecommendedContentForUri,
makeSelectStreamingUrlForUri, makeSelectStreamingUrlForUri,
makeSelectThumbnailForUri, makeSelectThumbnailForUri,
makeSelectTitleForUri, makeSelectTitleForUri,
@@ -29,7 +27,6 @@ import {
selectPurchasedUris, selectPurchasedUris,
selectFailedPurchaseUris, selectFailedPurchaseUris,
selectPurchaseUriErrorMessage, selectPurchaseUriErrorMessage,
selectResolvingUris,
selectIsSearching, selectIsSearching,
} from 'lbry-redux'; } from 'lbry-redux';
import { import {
@@ -72,8 +69,6 @@ const select = (state, props) => {
streamingUrl: makeSelectStreamingUrlForUri(contentUri)(state), streamingUrl: makeSelectStreamingUrlForUri(contentUri)(state),
thumbnail: makeSelectThumbnailForUri(contentUri)(state), thumbnail: makeSelectThumbnailForUri(contentUri)(state),
title: makeSelectTitleForUri(contentUri)(state), title: makeSelectTitleForUri(contentUri)(state),
recommendedContent: makeSelectRecommendedContentForUri(contentUri)(state),
resolvingUris: selectResolvingUris(state),
isSearchingRecommendContent: selectIsSearching(state), isSearchingRecommendContent: selectIsSearching(state),
viewCount: makeSelectViewCountForUri(contentUri)(state), viewCount: makeSelectViewCountForUri(contentUri)(state),
}; };
@@ -98,7 +93,6 @@ const perform = dispatch => ({
deletePurchasedUri: uri => dispatch(doDeletePurchasedUri(uri)), deletePurchasedUri: uri => dispatch(doDeletePurchasedUri(uri)),
resolveUri: uri => dispatch(doResolveUri(uri)), resolveUri: uri => dispatch(doResolveUri(uri)),
resolveUris: uris => dispatch(doResolveUris(uris)), resolveUris: uris => dispatch(doResolveUris(uris)),
searchRecommended: query => dispatch(doSearch(query, 20, undefined, true)),
sendTip: (amount, claimId, isSupport, successCallback, errorCallback) => sendTip: (amount, claimId, isSupport, successCallback, errorCallback) =>
dispatch(doSendTip(amount, claimId, isSupport, successCallback, errorCallback)), dispatch(doSendTip(amount, claimId, isSupport, successCallback, errorCallback)),
setPlayerVisible: () => dispatch(doSetPlayerVisible(true)), setPlayerVisible: () => dispatch(doSetPlayerVisible(true)),
@@ -108,5 +102,5 @@ const perform = dispatch => ({
export default connect( export default connect(
select, select,
perform perform,
)(FilePage); )(FilePage);
+244 -204
View File
@@ -87,6 +87,7 @@ class FilePage extends React.PureComponent {
playerHeight: 0, playerHeight: 0,
uri: null, uri: null,
uriVars: null, uriVars: null,
showRecommended: false,
stopDownloadConfirmed: false, stopDownloadConfirmed: false,
streamingMode: false, streamingMode: false,
viewCountFetched: false, viewCountFetched: false,
@@ -112,8 +113,8 @@ class FilePage extends React.PureComponent {
if (!isResolvingUri && !claim) resolveUri(uri); if (!isResolvingUri && !claim) resolveUri(uri);
this.fetchFileInfo(this.props); this.fetchFileInfo(uri, this.props);
this.fetchCostInfo(this.props); this.fetchCostInfo(uri, this.props);
fetchMyClaims(); fetchMyClaims();
@@ -258,21 +259,26 @@ class FilePage extends React.PureComponent {
// attempt to retrieve images and html/text automatically once the claim is loaded, and it's free // attempt to retrieve images and html/text automatically once the claim is loaded, and it's free
const mediaType = Lbry.getMediaType(contentType); const mediaType = Lbry.getMediaType(contentType);
const isPlayable = mediaType === 'video' || mediaType === 'audio';
const isViewable = mediaType === 'image' || mediaType === 'text'; const isViewable = mediaType === 'image' || mediaType === 'text';
if (claim && costInfo && costInfo.cost === 0 && !this.state.autoGetAttempted && isViewable) { if (claim && costInfo && costInfo.cost === 0 && !this.state.autoGetAttempted && isViewable) {
this.setState({ autoGetAttempted: true }, () => this.checkStoragePermissionForDownload()); this.setState({ autoGetAttempted: true }, () => this.checkStoragePermissionForDownload());
} }
}
fetchFileInfo(props) { if (((costInfo && costInfo.cost > 0) || !isPlayable) && !this.state.showRecommended) {
if (props.fileInfo === undefined) { this.setState({ showRecommended: true });
props.fetchFileInfo(props.navigation.state.params.uri);
} }
} }
fetchCostInfo(props) { fetchFileInfo(uri, props) {
if (props.fileInfo === undefined) {
props.fetchFileInfo(uri);
}
}
fetchCostInfo(uri, props) {
if (props.costInfo === undefined) { if (props.costInfo === undefined) {
props.fetchCostInfo(props.navigation.state.params.uri); props.fetchCostInfo(uri);
} }
} }
@@ -307,12 +313,12 @@ class FilePage extends React.PureComponent {
const { abandonClaim, claim, deleteFile, deletePurchasedUri, myClaimUris, fileInfo, navigation } = this.props; const { abandonClaim, claim, deleteFile, deletePurchasedUri, myClaimUris, fileInfo, navigation } = this.props;
Alert.alert( Alert.alert(
'Delete file', __('Delete file'),
'Are you sure you want to remove this file from your device?', __('Are you sure you want to remove this file from your device?'),
[ [
{ text: 'No' }, { text: __('No') },
{ {
text: 'Yes', text: __('Yes'),
onPress: () => { onPress: () => {
const { uri } = navigation.state.params; const { uri } = navigation.state.params;
@@ -339,7 +345,7 @@ class FilePage extends React.PureComponent {
}, },
}, },
], ],
{ cancelable: true } { cancelable: true },
); );
}; };
@@ -375,7 +381,7 @@ class FilePage extends React.PureComponent {
}, },
}, },
], ],
{ cancelable: true } { cancelable: true },
); );
}; };
@@ -524,7 +530,6 @@ class FilePage extends React.PureComponent {
}; };
onPlaybackStarted = () => { onPlaybackStarted = () => {
const { searchRecommended, title } = this.props;
let timeToStartMillis, timeToStart; let timeToStartMillis, timeToStart;
if (this.startTime) { if (this.startTime) {
timeToStartMillis = Date.now() - this.startTime; timeToStartMillis = Date.now() - this.startTime;
@@ -544,9 +549,7 @@ class FilePage extends React.PureComponent {
NativeModules.Firebase.track('play', payload); NativeModules.Firebase.track('play', payload);
// only fetch recommended content after playback has started // only fetch recommended content after playback has started
if (title) { this.setState({ showRecommended: true });
searchRecommended(title);
}
}; };
onPlaybackFinished = () => { onPlaybackFinished = () => {
@@ -600,6 +603,38 @@ class FilePage extends React.PureComponent {
)); ));
}; };
confirmPurchaseUri = (uri, costInfo, download) => {
const { notify, purchaseUri, title } = this.props;
const { cost } = costInfo;
if (!costInfo) {
notify({ message: __('This content cannot be viewed at this time. Please try again in a bit.'), isError: true });
return;
}
if (costInfo.cost > 0) {
Alert.alert(
__('Confirm Purchase'),
__(
cost === 1
? 'This will purchase "%title%" for %amount% credit'
: 'This will purchase "%title%" for %amount% credits',
{ title, amount: cost },
),
[
{
text: __('OK'),
onPress: () => purchaseUri(uri, costInfo, download),
},
{ text: __('Cancel') },
],
);
} else {
// Free content. Just call purchaseUri directly.
purchaseUri(uri, costInfo, download);
}
};
onFileDownloadButtonPressed = () => { onFileDownloadButtonPressed = () => {
const { claim, costInfo, contentType, purchaseUri, setPlayerVisible } = this.props; const { claim, costInfo, contentType, purchaseUri, setPlayerVisible } = this.props;
const mediaType = Lbry.getMediaType(contentType); const mediaType = Lbry.getMediaType(contentType);
@@ -612,7 +647,7 @@ class FilePage extends React.PureComponent {
if (!isPlayable) { if (!isPlayable) {
this.checkStoragePermissionForDownload(); this.checkStoragePermissionForDownload();
} else { } else {
purchaseUri(uri, costInfo, !isPlayable); this.confirmPurchaseUri(uri, costInfo, !isPlayable);
} }
if (isPlayable) { if (isPlayable) {
@@ -650,9 +685,9 @@ class FilePage extends React.PureComponent {
stopDownloadConfirmed: false, stopDownloadConfirmed: false,
}, },
() => { () => {
purchaseUri(claim.permanent_url, costInfo, true); this.confirmPurchaseUri(claim.permanent_url, costInfo, true);
NativeModules.UtilityModule.checkDownloads(); NativeModules.UtilityModule.checkDownloads();
} },
); );
}; };
@@ -689,7 +724,7 @@ class FilePage extends React.PureComponent {
], ],
showImageViewer: true, showImageViewer: true,
}, },
() => pushDrawerStack(Constants.DRAWER_ROUTE_FILE_VIEW) () => pushDrawerStack(Constants.DRAWER_ROUTE_FILE_VIEW),
); );
} }
} }
@@ -700,7 +735,7 @@ class FilePage extends React.PureComponent {
{ {
showWebView: true, showWebView: true,
}, },
() => pushDrawerStack(Constants.DRAWER_ROUTE_FILE_VIEW) () => pushDrawerStack(Constants.DRAWER_ROUTE_FILE_VIEW),
); );
} }
} }
@@ -794,7 +829,7 @@ class FilePage extends React.PureComponent {
<View style={filePageStyle.dmcaContainer}> <View style={filePageStyle.dmcaContainer}>
<Text style={filePageStyle.dmcaText}> <Text style={filePageStyle.dmcaText}>
{__( {__(
'In response to a complaint we received under the US Digital Millennium Copyright Act, we have blocked access to this content from our applications.' 'In response to a complaint we received under the US Digital Millennium Copyright Act, we have blocked access to this content from our applications.',
)} )}
</Text> </Text>
<Link style={filePageStyle.dmcaLink} href="https://lbry.com/faq/dmca" text={__('Read More')} /> <Link style={filePageStyle.dmcaLink} href="https://lbry.com/faq/dmca" text={__('Read More')} />
@@ -864,7 +899,7 @@ class FilePage extends React.PureComponent {
if (!isPlayable) { if (!isPlayable) {
this.checkStoragePermissionForDownload(); this.checkStoragePermissionForDownload();
} else { } else {
purchaseUri(claim.permanent_url, costInfo, !isPlayable); this.confirmPurchaseUri(claim.permanent_url, costInfo, !isPlayable);
} }
NativeModules.UtilityModule.checkDownloads(); NativeModules.UtilityModule.checkDownloads();
}); });
@@ -882,6 +917,8 @@ class FilePage extends React.PureComponent {
return ( return (
<View style={filePageStyle.pageContainer}> <View style={filePageStyle.pageContainer}>
{!this.state.fullscreenMode && <UriBar value={uri} navigation={navigation} />} {!this.state.fullscreenMode && <UriBar value={uri} navigation={navigation} />}
{innerContent}
{this.state.showWebView && isWebViewable && ( {this.state.showWebView && isWebViewable && (
<WebView allowFileAccess source={{ uri: localFileUri }} style={filePageStyle.viewer} /> <WebView allowFileAccess source={{ uri: localFileUri }} style={filePageStyle.viewer} />
)} )}
@@ -892,7 +929,7 @@ class FilePage extends React.PureComponent {
renderIndicator={() => null} renderIndicator={() => null}
/> />
)} )}
{!this.state.showWebView && ( {!innerContent && !this.state.showWebView && (
<View <View
style={ style={
this.state.fullscreenMode ? filePageStyle.innerPageContainerFsMode : filePageStyle.innerPageContainer this.state.fullscreenMode ? filePageStyle.innerPageContainerFsMode : filePageStyle.innerPageContainer
@@ -950,14 +987,18 @@ class FilePage extends React.PureComponent {
/> />
)} )}
{!fileInfo && ( {!fileInfo && (
<FilePrice uri={uri} style={filePageStyle.filePriceContainer} textStyle={filePageStyle.filePriceText} /> <FilePrice
uri={claim && claim.permanent_url ? claim.permanent_url : uri}
style={filePageStyle.filePriceContainer}
textStyle={filePageStyle.filePriceText}
/>
)} )}
<TouchableOpacity style={filePageStyle.backButton} onPress={this.onBackButtonPressed}> <TouchableOpacity style={filePageStyle.backButton} onPress={this.onBackButtonPressed}>
<Icon name={'arrow-left'} size={18} style={filePageStyle.backButtonIcon} /> <Icon name={'arrow-left'} size={18} style={filePageStyle.backButtonIcon} />
</TouchableOpacity> </TouchableOpacity>
</TouchableOpacity> </TouchableOpacity>
{(this.state.streamingMode || (canLoadMedia && fileInfo && isPlayable)) && ( {!innerContent && (this.state.streamingMode || (canLoadMedia && fileInfo && isPlayable)) && (
<View <View
style={playerBgStyle} style={playerBgStyle}
ref={ref => { ref={ref => {
@@ -970,10 +1011,10 @@ class FilePage extends React.PureComponent {
}} }}
/> />
)} )}
{(this.state.streamingMode || (canLoadMedia && fileInfo && isPlayable)) && this.state.fullscreenMode && ( {!innerContent &&
<View style={fsPlayerBgStyle} /> (this.state.streamingMode || (canLoadMedia && fileInfo && isPlayable)) &&
)} this.state.fullscreenMode && <View style={fsPlayerBgStyle} />}
{(this.state.streamingMode || (canLoadMedia && fileInfo && isPlayable)) && ( {!innerContent && (this.state.streamingMode || (canLoadMedia && fileInfo && isPlayable)) && (
<MediaPlayer <MediaPlayer
claim={claim} claim={claim}
assignPlayer={ref => { assignPlayer={ref => {
@@ -998,195 +1039,194 @@ class FilePage extends React.PureComponent {
/> />
)} )}
<ScrollView {!innerContent && (
style={filePageStyle.scrollContainer} <ScrollView
contentContainerstyle={showActions ? null : filePageStyle.scrollContent} style={filePageStyle.scrollContainer}
keyboardShouldPersistTaps={'handled'} contentContainerstyle={showActions ? null : filePageStyle.scrollContent}
ref={ref => { keyboardShouldPersistTaps={'handled'}
this.scrollView = ref; ref={ref => {
}} this.scrollView = ref;
> }}
<TouchableWithoutFeedback
style={filePageStyle.titleTouch}
onPress={() => this.setState({ showDescription: !this.state.showDescription })}
> >
<View style={filePageStyle.titleArea}> <TouchableWithoutFeedback
<View style={filePageStyle.titleRow}> style={filePageStyle.titleTouch}
<Text style={filePageStyle.title} selectable> onPress={() => this.setState({ showDescription: !this.state.showDescription })}
{title}
</Text>
{isRewardContent && <Icon name="award" style={filePageStyle.rewardIcon} size={16} />}
<View style={filePageStyle.descriptionToggle}>
<Icon name={this.state.showDescription ? 'caret-up' : 'caret-down'} size={24} />
</View>
</View>
<Text style={filePageStyle.viewCount}>
{viewCount === 1 && __('%view% view', { view: viewCount })}
{viewCount > 1 && __('%view% views', { view: viewCount })}
</Text>
</View>
</TouchableWithoutFeedback>
<View style={filePageStyle.largeButtonsRow}>
<TouchableOpacity style={filePageStyle.largeButton} onPress={this.handleSharePress}>
<Icon name={'share-alt'} size={16} style={filePageStyle.largeButtonIcon} />
<Text style={filePageStyle.largeButtonText}>{__('Share')}</Text>
</TouchableOpacity>
<TouchableOpacity
style={filePageStyle.largeButton}
onPress={() => this.setState({ showTipView: true })}
> >
<Icon name={'gift'} size={16} style={filePageStyle.largeButtonIcon} /> <View style={filePageStyle.titleArea}>
<Text style={filePageStyle.largeButtonText}>{__('Tip')}</Text> <View style={filePageStyle.titleRow}>
</TouchableOpacity> <Text style={filePageStyle.title} selectable>
{title}
{!canEdit && !isPlayable && ( </Text>
<View style={filePageStyle.sharedLargeButton}> {isRewardContent && <Icon name="award" style={filePageStyle.rewardIcon} size={16} />}
{!fileInfo || <View style={filePageStyle.descriptionToggle}>
(fileInfo.written_bytes <= 0 && !completed && ( <Icon name={this.state.showDescription ? 'caret-up' : 'caret-down'} size={24} />
<TouchableOpacity style={filePageStyle.innerLargeButton} onPress={this.onDownloadPressed}> </View>
<Icon name={'download'} size={16} style={filePageStyle.largeButtonIcon} /> </View>
<Text style={filePageStyle.largeButtonText}>{__('Download')}</Text> <Text style={filePageStyle.viewCount}>
</TouchableOpacity> {viewCount === 1 && __('%view% view', { view: viewCount })}
))} {viewCount > 1 && __('%view% views', { view: viewCount })}
</Text>
{!completed &&
fileInfo &&
!fileInfo.stopped &&
fileInfo.written_bytes > 0 &&
fileInfo.written_bytes < fileInfo.total_bytes &&
!this.state.stopDownloadConfirmed && (
<TouchableOpacity style={filePageStyle.innerLargeButton} onPress={this.onStopDownloadPressed}>
<Icon name={'stop'} size={16} style={filePageStyle.largeButtonIcon} />
<Text style={filePageStyle.largeButtonText}>{__('Stop')}</Text>
</TouchableOpacity>
)}
{completed && fileInfo && fileInfo.written_bytes >= fileInfo.total_bytes && (
<TouchableOpacity style={filePageStyle.innerLargeButton} onPress={this.onOpenFilePressed}>
<Icon name={'folder-open'} size={16} style={filePageStyle.largeButtonIcon} />
<Text style={filePageStyle.largeButtonText}>{__('Open')}</Text>
</TouchableOpacity>
)}
</View> </View>
)} </TouchableWithoutFeedback>
<View style={filePageStyle.largeButtonsRow}>
<TouchableOpacity style={filePageStyle.largeButton} onPress={this.handleSharePress}>
<Icon name={'share-alt'} size={16} style={filePageStyle.largeButtonIcon} />
<Text style={filePageStyle.largeButtonText}>{__('Share')}</Text>
</TouchableOpacity>
{!canEdit && (
<TouchableOpacity <TouchableOpacity
style={filePageStyle.largeButton} style={filePageStyle.largeButton}
onPress={() => Linking.openURL(`https://lbry.com/dmca/${claim.claim_id}`)} onPress={() => this.setState({ showTipView: true })}
> >
<Icon name={'flag'} size={16} style={filePageStyle.largeButtonIcon} /> <Icon name={'gift'} size={16} style={filePageStyle.largeButtonIcon} />
<Text style={filePageStyle.largeButtonText}>{__('Report')}</Text> <Text style={filePageStyle.largeButtonText}>{__('Tip')}</Text>
</TouchableOpacity> </TouchableOpacity>
)}
{canEdit && ( {!canEdit && !isPlayable && (
<TouchableOpacity style={filePageStyle.largeButton} onPress={this.onEditPressed}> <View style={filePageStyle.sharedLargeButton}>
<Icon name={'edit'} size={16} style={filePageStyle.largeButtonIcon} /> {!fileInfo ||
<Text style={filePageStyle.largeButtonText}>{__('Edit')}</Text> (fileInfo.written_bytes <= 0 && !completed && (
</TouchableOpacity> <TouchableOpacity style={filePageStyle.innerLargeButton} onPress={this.onDownloadPressed}>
)} <Icon name={'download'} size={16} style={filePageStyle.largeButtonIcon} />
<Text style={filePageStyle.largeButtonText}>{__('Download')}</Text>
</TouchableOpacity>
))}
{(completed || canEdit) && ( {!completed &&
<TouchableOpacity style={filePageStyle.largeButton} onPress={this.onDeletePressed}> fileInfo &&
<Icon name={'trash-alt'} size={16} style={filePageStyle.largeButtonIcon} /> !fileInfo.stopped &&
<Text style={filePageStyle.largeButtonText}>{__('Delete')}</Text> fileInfo.written_bytes > 0 &&
</TouchableOpacity> fileInfo.written_bytes < fileInfo.total_bytes &&
)} !this.state.stopDownloadConfirmed && (
</View> <TouchableOpacity style={filePageStyle.innerLargeButton} onPress={this.onStopDownloadPressed}>
<Icon name={'stop'} size={16} style={filePageStyle.largeButtonIcon} />
<Text style={filePageStyle.largeButtonText}>{__('Stop')}</Text>
</TouchableOpacity>
)}
<View style={filePageStyle.channelRow}> {completed && fileInfo && fileInfo.written_bytes >= fileInfo.total_bytes && (
<View style={filePageStyle.publishInfo}> <TouchableOpacity style={filePageStyle.innerLargeButton} onPress={this.onOpenFilePressed}>
{channelName && ( <Icon name={'folder-open'} size={16} style={filePageStyle.largeButtonIcon} />
<Link <Text style={filePageStyle.largeButtonText}>{__('Open')}</Text>
style={filePageStyle.channelName} </TouchableOpacity>
selectable )}
text={channelName}
numberOfLines={1}
ellipsizeMode={'tail'}
onPress={() => {
navigateToUri(
navigation,
normalizeURI(shortChannelUri || fullChannelUri),
null,
false,
fullChannelUri
);
}}
/>
)}
{!channelName && (
<Text style={filePageStyle.anonChannelName} selectable ellipsizeMode={'tail'}>
{__('Anonymous')}
</Text>
)}
<DateTime
style={filePageStyle.publishDate}
textStyle={filePageStyle.publishDateText}
uri={uri}
formatOptions={{ day: 'numeric', month: 'long', year: 'numeric' }}
show={DateTime.SHOW_DATE}
/>
</View>
<View style={filePageStyle.subscriptionRow}>
{false && ((isPlayable && !fileInfo) || (isPlayable && fileInfo && !fileInfo.download_path)) && (
<Button
style={[filePageStyle.actionButton, filePageStyle.saveFileButton]}
theme={'light'}
icon={'download'}
onPress={this.onSaveFilePressed}
/>
)}
{channelName && (
<SubscribeButton
style={filePageStyle.actionButton}
uri={fullChannelUri}
name={channelName}
hideText={false}
/>
)}
{false && channelName && (
<SubscribeNotificationButton
style={[filePageStyle.actionButton, filePageStyle.bellButton]}
uri={fullChannelUri}
name={channelName}
/>
)}
</View>
</View>
{this.state.showDescription && description && description.length > 0 && (
<View style={filePageStyle.divider} />
)}
{this.state.showDescription && description && (
<View>
<Text style={filePageStyle.description} selectable>
{this.linkify(description)}
</Text>
{tags && tags.length > 0 && (
<View style={filePageStyle.tagContainer}>
<Text style={filePageStyle.tagTitle}>{__('Tags')}</Text>
<View style={filePageStyle.tagList}>{this.renderTags(tags)}</View>
</View> </View>
)} )}
{!canEdit && (
<TouchableOpacity
style={filePageStyle.largeButton}
onPress={() => Linking.openURL(`https://lbry.com/dmca/${claim.claim_id}`)}
>
<Icon name={'flag'} size={16} style={filePageStyle.largeButtonIcon} />
<Text style={filePageStyle.largeButtonText}>{__('Report')}</Text>
</TouchableOpacity>
)}
{canEdit && (
<TouchableOpacity style={filePageStyle.largeButton} onPress={this.onEditPressed}>
<Icon name={'edit'} size={16} style={filePageStyle.largeButtonIcon} />
<Text style={filePageStyle.largeButtonText}>{__('Edit')}</Text>
</TouchableOpacity>
)}
{(completed || canEdit) && (
<TouchableOpacity style={filePageStyle.largeButton} onPress={this.onDeletePressed}>
<Icon name={'trash-alt'} size={16} style={filePageStyle.largeButtonIcon} />
<Text style={filePageStyle.largeButtonText}>{__('Delete')}</Text>
</TouchableOpacity>
)}
</View> </View>
)}
{costInfo && parseFloat(costInfo.cost) > balance && !fileInfo && ( <View style={filePageStyle.channelRow}>
<FileRewardsDriver navigation={navigation} /> <View style={filePageStyle.publishInfo}>
)} {channelName && (
<Link
style={filePageStyle.channelName}
selectable
text={channelName}
numberOfLines={1}
ellipsizeMode={'tail'}
onPress={() => {
navigateToUri(
navigation,
normalizeURI(shortChannelUri || fullChannelUri),
null,
false,
fullChannelUri,
);
}}
/>
)}
{!channelName && (
<Text style={filePageStyle.anonChannelName} selectable ellipsizeMode={'tail'}>
{__('Anonymous')}
</Text>
)}
<DateTime
style={filePageStyle.publishDate}
textStyle={filePageStyle.publishDateText}
uri={fullUri}
formatOptions={{ day: 'numeric', month: 'long', year: 'numeric' }}
show={DateTime.SHOW_DATE}
/>
</View>
<View style={filePageStyle.subscriptionRow}>
{false && ((isPlayable && !fileInfo) || (isPlayable && fileInfo && !fileInfo.download_path)) && (
<Button
style={[filePageStyle.actionButton, filePageStyle.saveFileButton]}
theme={'light'}
icon={'download'}
onPress={this.onSaveFilePressed}
/>
)}
{channelName && (
<SubscribeButton
style={filePageStyle.actionButton}
uri={fullChannelUri}
name={channelName}
hideText={false}
/>
)}
{false && channelName && (
<SubscribeNotificationButton
style={[filePageStyle.actionButton, filePageStyle.bellButton]}
uri={fullChannelUri}
name={channelName}
/>
)}
</View>
</View>
<View onLayout={this.setRelatedContentPosition} /> {this.state.showDescription && description && description.length > 0 && (
<View style={filePageStyle.divider} />
)}
{this.state.showDescription && description && (
<View>
<Text style={filePageStyle.description} selectable>
{this.linkify(description)}
</Text>
{tags && tags.length > 0 && (
<View style={filePageStyle.tagContainer}>
<Text style={filePageStyle.tagTitle}>{__('Tags')}</Text>
<View style={filePageStyle.tagList}>{this.renderTags(tags)}</View>
</View>
)}
</View>
)}
{isSearchingRecommendContent && ( {costInfo && parseFloat(costInfo.cost) > balance && !fileInfo && (
<ActivityIndicator size="small" color={Colors.NextLbryGreen} style={filePageStyle.relatedLoading} /> <FileRewardsDriver navigation={navigation} />
)} )}
{!isSearchingRecommendContent && recommendedContent && recommendedContent.length > 0 && (
<RelatedContent navigation={navigation} uri={uri} fullUri={fullUri} /> <View onLayout={this.setRelatedContentPosition} />
)}
</ScrollView> {this.state.showRecommended && (
<RelatedContent navigation={navigation} title={title} uri={fullUri} fullUri={fullUri} />
)}
</ScrollView>
)}
</View> </View>
)} )}
{this.state.showTipView && ( {this.state.showTipView && (
+26 -18
View File
@@ -196,7 +196,7 @@ class PublishPage extends React.PureComponent {
}, },
() => { () => {
NativeModules.Gallery.getVideos().then(videos => this.setState({ videos, loadingVideos: false })); NativeModules.Gallery.getVideos().then(videos => this.setState({ videos, loadingVideos: false }));
} },
); );
// Check if this is an edit action // Check if this is an edit action
@@ -288,7 +288,7 @@ class PublishPage extends React.PureComponent {
this.handleChannelChange(channelName); this.handleChannelChange(channelName);
} }
pushDrawerStack(Constants.DRAWER_ROUTE_PUBLISH_FORM); pushDrawerStack(Constants.DRAWER_ROUTE_PUBLISH_FORM);
} },
); );
}; };
@@ -356,18 +356,26 @@ class PublishPage extends React.PureComponent {
} }
if (!title || title.trim().length === 0) { if (!title || title.trim().length === 0) {
notify({ message: __('Please provide a title') }); notify({ message: __('Please provide a title'), isError: true });
return; return;
} }
if (!name) { if (!name) {
notify({ message: __('Please specify an address where people can find your content.') }); notify({ message: __('Please specify an address where people can find your content.'), isError: true });
return;
}
if (!isNameValid(name, false)) {
notify({ message: __('Your content address contains invalid characters.'), isError: true });
return; return;
} }
if (!currentMedia && !editMode) { if (!currentMedia && !editMode) {
// sanity check. normally shouldn't happen // sanity check. normally shouldn't happen
notify({ message: __('No file selected. Please select a video or take a photo before publishing.') }); notify({
message: __('No file selected. Please select a video or take a photo before publishing.'),
isError: true,
});
return; return;
} }
@@ -456,7 +464,7 @@ class PublishPage extends React.PureComponent {
() => { () => {
this.handleNameChange(this.state.name); this.handleNameChange(this.state.name);
pushDrawerStack(Constants.DRAWER_ROUTE_PUBLISH_FORM); pushDrawerStack(Constants.DRAWER_ROUTE_PUBLISH_FORM);
} },
); );
} }
@@ -510,7 +518,7 @@ class PublishPage extends React.PureComponent {
clearPublishFormState(); clearPublishFormState();
// reset thumbnail // reset thumbnail
updatePublishForm({ thumbnail: null }); updatePublishForm({ thumbnail: null });
} },
); );
} }
@@ -537,7 +545,7 @@ class PublishPage extends React.PureComponent {
}, },
() => { () => {
NativeModules.UtilityModule.openDocumentPicker('*/*'); NativeModules.UtilityModule.openDocumentPicker('*/*');
} },
); );
}; };
@@ -583,7 +591,7 @@ class PublishPage extends React.PureComponent {
() => { () => {
// upload a new thumbnail // upload a new thumbnail
uploadImageAsset(fileUrl, this.handleThumbnailUploadSuccess, this.handleThumbnailUploadFailure); uploadImageAsset(fileUrl, this.handleThumbnailUploadSuccess, this.handleThumbnailUploadFailure);
} },
); );
} }
} else { } else {
@@ -634,7 +642,7 @@ class PublishPage extends React.PureComponent {
videoRecordingMode: false, videoRecordingMode: false,
recordingVideo: false, recordingVideo: false,
}, },
() => pushDrawerStack(Constants.DRAWER_ROUTE_PUBLISH_FORM) () => pushDrawerStack(Constants.DRAWER_ROUTE_PUBLISH_FORM),
); );
}); });
} }
@@ -658,7 +666,7 @@ class PublishPage extends React.PureComponent {
showCameraOverlay: false, showCameraOverlay: false,
videoRecordingMode: false, videoRecordingMode: false,
}, },
() => pushDrawerStack(Constants.DRAWER_ROUTE_PUBLISH) () => pushDrawerStack(Constants.DRAWER_ROUTE_PUBLISH),
); );
}); });
} }
@@ -777,8 +785,8 @@ class PublishPage extends React.PureComponent {
uploadImageAsset( uploadImageAsset(
this.getFilePathFromUri(uri), this.getFilePathFromUri(uri),
this.handleThumbnailUploadSuccess, this.handleThumbnailUploadSuccess,
this.handleThumbnailUploadFailure this.handleThumbnailUploadFailure,
) ),
); );
} }
} else if (mediaType === 'image' || mediaType === 'video') { } else if (mediaType === 'image' || mediaType === 'video') {
@@ -791,7 +799,7 @@ class PublishPage extends React.PureComponent {
this.setState({ currentThumbnailUri: `file://${path}`, updatingThumbnailUri: false }); this.setState({ currentThumbnailUri: `file://${path}`, updatingThumbnailUri: false });
if (!this.state.uploadedThumbnailUri) { if (!this.state.uploadedThumbnailUri) {
this.setState({ uploadThumbnailStarted: true }, () => this.setState({ uploadThumbnailStarted: true }, () =>
uploadImageAsset(path, this.handleThumbnailUploadSuccess, this.handleThumbnailUploadFailure) uploadImageAsset(path, this.handleThumbnailUploadSuccess, this.handleThumbnailUploadFailure),
); );
} }
}) })
@@ -817,7 +825,7 @@ class PublishPage extends React.PureComponent {
}, },
() => { () => {
this.handleNameChange(this.state.name); this.handleNameChange(this.state.name);
} },
); );
} }
}; };
@@ -881,7 +889,7 @@ class PublishPage extends React.PureComponent {
}, },
() => { () => {
NativeModules.UtilityModule.openDocumentPicker('image/*'); NativeModules.UtilityModule.openDocumentPicker('image/*');
} },
); );
}; };
@@ -1112,7 +1120,7 @@ class PublishPage extends React.PureComponent {
{__('The address where people can find your content (ex. lbry://myvideo). ')} {__('The address where people can find your content (ex. lbry://myvideo). ')}
{this.state.editMode && {this.state.editMode &&
__( __(
'You cannot change this address while editing your content. If you wish to use a new address, please republish the content.' 'You cannot change this address while editing your content. If you wish to use a new address, please republish the content.',
)} )}
</Text> </Text>
@@ -1262,7 +1270,7 @@ class PublishPage extends React.PureComponent {
</View> </View>
<Text style={publishStyle.successText}> <Text style={publishStyle.successText}>
{__( {__(
'Your content will be live in a few minutes. In the mean time, feel free to publish more content or explore the app.' 'Your content will be live in a few minutes. In the mean time, feel free to publish more content or explore the app.',
)} )}
</Text> </Text>
</View> </View>
+6 -4
View File
@@ -1,14 +1,15 @@
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { import {
doClaimSearch, doClaimSearch,
doResolveUris,
doSearch, doSearch,
doUpdateSearchQuery, doUpdateSearchQuery,
makeSelectSearchUris, makeSelectSearchUris,
selectClaimSearchByQuery, selectClaimSearchByQuery,
selectIsSearching, selectIsSearching,
selectResolvingUris,
selectSearchValue, selectSearchValue,
makeSelectQueryWithOptions, makeSelectQueryWithOptions,
selectSearchUrisByQuery,
} from 'lbry-redux'; } from 'lbry-redux';
import { doPushDrawerStack, doSetPlayerVisible } from 'redux/actions/drawer'; import { doPushDrawerStack, doSetPlayerVisible } from 'redux/actions/drawer';
import { selectCurrentRoute } from 'redux/selectors/drawer'; import { selectCurrentRoute } from 'redux/selectors/drawer';
@@ -22,19 +23,20 @@ const select = state => ({
currentRoute: selectCurrentRoute(state), currentRoute: selectCurrentRoute(state),
isSearching: selectIsSearching(state), isSearching: selectIsSearching(state),
query: selectSearchValue(state), query: selectSearchValue(state),
resolvingUris: selectResolvingUris(state),
uris: makeSelectSearchUris(makeSelectQueryWithOptions(null, numSearchResults)(state))(state), uris: makeSelectSearchUris(makeSelectQueryWithOptions(null, numSearchResults)(state))(state),
urisByQuery: selectSearchUrisByQuery(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)),
resolveUris: uris => dispatch(doResolveUris(uris)),
setPlayerVisible: () => dispatch(doSetPlayerVisible(false)), setPlayerVisible: () => dispatch(doSetPlayerVisible(false)),
}); });
export default connect( export default connect(
select, select,
perform perform,
)(SearchPage); )(SearchPage);
+59 -21
View File
@@ -26,6 +26,7 @@ class SearchPage extends React.PureComponent {
showTagResult: false, showTagResult: false,
claimSearchRun: false, claimSearchRun: false,
claimSearchOptions: null, claimSearchOptions: null,
resultsResolved: false,
}; };
static navigationOptions = { static navigationOptions = {
@@ -58,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);
} }
@@ -69,8 +71,8 @@ class SearchPage extends React.PureComponent {
} }
componentWillReceiveProps(nextProps) { componentWillReceiveProps(nextProps) {
const { currentRoute, query } = nextProps; const { currentRoute, query, isSearching } = nextProps;
const { currentRoute: prevRoute, search } = this.props; const { currentRoute: prevRoute, search, isSearching: prevIsSearching } = this.props;
if (Constants.DRAWER_ROUTE_SEARCH === currentRoute && currentRoute !== prevRoute) { if (Constants.DRAWER_ROUTE_SEARCH === currentRoute && currentRoute !== prevRoute) {
this.onComponentFocused(); this.onComponentFocused();
@@ -80,11 +82,44 @@ class SearchPage extends React.PureComponent {
this.setState({ this.setState({
currentQuery: query, currentQuery: query,
currentUri: isURIValid(query) ? normalizeURI(query) : null, currentUri: isURIValid(query) ? normalizeURI(query) : null,
resultsResolved: false,
}); });
search(query); search(query);
} }
} }
allContentResolved(props) {
const { uris, resolvingUris } = props;
if (!this.state.resultsResolved) {
return false;
}
if (uris) {
let allResolved = true;
uris.forEach(uri => {
allResolved = allResolved && !resolvingUris.includes(uri);
});
return allResolved;
}
return false;
}
shouldComponentUpdate(nextProps) {
const { isSearching, uris } = this.props;
return (isSearching && (!uris || uris.length === 0)) || (!isSearching && this.allContentResolved(this.props));
}
componentDidUpdate() {
const { isSearching, resolveUris, uris } = this.props;
if (!isSearching && !this.state.resultsResolved) {
this.setState({ resultsResolved: true }, () => {
if (uris && uris.length > 0) {
resolveUris(uris);
}
});
}
}
getSearchQuery() { getSearchQuery() {
const { navigation } = this.props; const { navigation } = this.props;
if (navigation && navigation.state && navigation.state.params) { if (navigation && navigation.state && navigation.state.params) {
@@ -100,6 +135,7 @@ class SearchPage extends React.PureComponent {
claimSearchOptions: null, claimSearchOptions: null,
claimSearchRun: false, claimSearchRun: false,
showTagResult: false, showTagResult: false,
resultsResolved: false,
}); });
search(keywords); search(keywords);
}; };
@@ -130,11 +166,11 @@ class SearchPage extends React.PureComponent {
this.setState({ claimSearchOptions: options, claimSearchRun: true }, () => claimSearch(options)); this.setState({ claimSearchOptions: options, claimSearchRun: true }, () => claimSearch(options));
} }
if (this.state.claimSearchRun && this.state.claimSearchOptions) { /* if (this.state.claimSearchRun && this.state.claimSearchOptions) {
const claimSearchKey = createNormalizedClaimSearchKey(this.state.claimSearchOptions); const claimSearchKey = createNormalizedClaimSearchKey(this.state.claimSearchOptions);
const claimSearchUris = claimSearchByQuery[claimSearchKey]; const claimSearchUris = claimSearchByQuery[claimSearchKey];
this.setState({ showTagResult: claimSearchUris && claimSearchUris.length > 0 }); this.setState({ showTagResult: claimSearchUris && claimSearchUris.length > 0 });
} } */
return ( return (
<View> <View>
@@ -155,7 +191,7 @@ class SearchPage extends React.PureComponent {
}; };
render() { render() {
const { isSearching, navigation, query, uris, urisByQuery } = this.props; const { isSearching, navigation, query, uris } = this.props;
return ( return (
<View style={searchStyle.container}> <View style={searchStyle.container}>
@@ -167,22 +203,24 @@ class SearchPage extends React.PureComponent {
</View> </View>
)} )}
<FlatList {!isSearching && (
extraData={this.state} <FlatList
style={searchStyle.scrollContainer} extraData={this.state}
contentContainerStyle={searchStyle.scrollPadding} style={searchStyle.scrollContainer}
keyboardShouldPersistTaps={'handled'} contentContainerStyle={searchStyle.scrollPadding}
data={uris} keyboardShouldPersistTaps={'handled'}
keyExtractor={(item, index) => item} data={uris}
initialNumToRender={10} keyExtractor={(item, index) => item}
maxToRenderPerBatch={20} initialNumToRender={8}
removeClippedSubviews maxToRenderPerBatch={20}
ListEmptyComponent={!isSearching ? this.listEmptyComponent() : null} removeClippedSubviews
ListHeaderComponent={this.state.currentUri ? this.listHeaderComponent(this.state.showTagResult) : null} ListEmptyComponent={!isSearching ? this.listEmptyComponent() : null}
renderItem={({ item }) => ( ListHeaderComponent={this.state.currentUri ? this.listHeaderComponent(this.state.showTagResult) : null}
<FileListItem key={item} uri={item} style={searchStyle.resultItem} navigation={navigation} /> renderItem={({ item }) => (
)} <FileListItem key={item} uri={item} style={searchStyle.resultItem} batchResolve navigation={navigation} />
/> )}
/>
)}
<FloatingWalletBalance navigation={navigation} /> <FloatingWalletBalance navigation={navigation} />
</View> </View>
); );
+5 -5
View File
@@ -115,7 +115,7 @@ class SplashScreen extends React.PureComponent {
}, },
error => { error => {
/* failed */ /* failed */
} },
); );
}; };
@@ -293,7 +293,7 @@ class SplashScreen extends React.PureComponent {
isLagging: true, isLagging: true,
message: __('Connection Failure'), message: __('Connection Failure'),
details: __( details: __(
'We could not establish a connection to the SDK. Your data connection may be preventing LBRY from connecting. Contact hello@lbry.com if you think this is a software bug.' 'We could not establish a connection to the SDK. Your data connection may be preventing LBRY from connecting. Contact hello@lbry.com if you think this is a software bug.',
), ),
}); });
}); });
@@ -318,7 +318,7 @@ class SplashScreen extends React.PureComponent {
message: __('Testing network'), message: __('Testing network'),
details: __('Waiting for name resolution'), details: __('Waiting for name resolution'),
}, },
() => this.finishSplashScreen() () => this.finishSplashScreen(),
); );
}; };
@@ -331,12 +331,12 @@ class SplashScreen extends React.PureComponent {
<Text style={splashStyle.errorTitle}>{__('Oops! Something went wrong.')}</Text> <Text style={splashStyle.errorTitle}>{__('Oops! Something went wrong.')}</Text>
<Text style={splashStyle.paragraph}> <Text style={splashStyle.paragraph}>
{__( {__(
'Your wallet failed to unlock, which means you may not be able to play any videos or access your funds.' 'Your wallet failed to unlock, which means you may not be able to play any videos or access your funds.',
)} )}
</Text> </Text>
<Text style={splashStyle.paragraph}> <Text style={splashStyle.paragraph}>
{__( {__(
'You can try to fix this by tapping Stop on the LBRY service notification and starting the app again. If the problem continues, you may have to reinstall the app and restore your account.' 'You can try to fix this by tapping Stop on the LBRY service notification and starting the app again. If the problem continues, you may have to reinstall the app and restore your account.',
)} )}
</Text> </Text>
+5 -2
View File
@@ -73,7 +73,7 @@ class SubscriptionsPage extends React.PureComponent {
}; };
componentDidMount() { componentDidMount() {
this.onComponentFocused(); // this.onComponentFocused();
} }
componentWillReceiveProps(nextProps) { componentWillReceiveProps(nextProps) {
@@ -115,7 +115,10 @@ class SubscriptionsPage extends React.PureComponent {
unsubscribeShortChannelUrls = () => { unsubscribeShortChannelUrls = () => {
// this should only have to happen once // this should only have to happen once
const { subscribedChannels, channelUnsubscribe } = this.props; const { subscribedChannels, channelUnsubscribe } = this.props;
const badSubs = subscribedChannels.filter(sub => sub.uri.split('#')[1].length < 5); const badSubs = subscribedChannels.filter(sub => {
const parts = sub.uri.split('#');
return parts.length === 1 || parts[1].length < 5;
});
if (badSubs.length > 0) { if (badSubs.length > 0) {
badSubs.forEach(sub => channelUnsubscribe(sub)); badSubs.forEach(sub => channelUnsubscribe(sub));
} }
+16
View File
@@ -120,6 +120,22 @@ const fileListStyle = StyleSheet.create({
marginLeft: 4, marginLeft: 4,
marginTop: 4, marginTop: 4,
}, },
filePriceContainer: {
backgroundColor: Colors.NextLbryGreen,
justifyContent: 'center',
position: 'absolute',
left: thumbnailWidth - 64,
top: 8,
width: 56,
height: 24,
borderRadius: 4,
},
filePriceText: {
fontFamily: 'Inter-UI-Bold',
fontSize: 12,
textAlign: 'center',
color: '#0c604b',
},
}); });
export default fileListStyle; export default fileListStyle;
+7 -2
View File
@@ -27,11 +27,16 @@ const walletStyle = StyleSheet.create({
}, },
address: { address: {
fontFamily: 'Inter-UI-Regular', fontFamily: 'Inter-UI-Regular',
letterSpacing: 0.8,
borderWidth: 1, borderWidth: 1,
borderRadius: 16,
borderStyle: 'dashed', borderStyle: 'dashed',
borderColor: '#cccccc', borderColor: '#e1e1e1',
backgroundColor: '#f9f9f9', backgroundColor: '#f9f9f9',
padding: 8, paddingTop: 8,
paddingLeft: 8,
paddingRight: 8,
paddingBottom: 6,
width: '85%', width: '85%',
}, },
button: { button: {