Compare commits
21
Commits
fix-send-tip
...
0.8.4-rc
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1dc85cc4c9 | ||
|
|
095bc9ed0a | ||
|
|
894b34fd57 | ||
|
|
ced1056596 | ||
|
|
3978753cdb | ||
|
|
7a141c817e | ||
|
|
ad810d5c9e | ||
|
|
decf0623fb | ||
|
|
c7f2b78b92 | ||
|
|
47cf15741c | ||
|
|
e74a419ffd | ||
|
|
0c06f478c8 | ||
|
|
9391c1b78c | ||
|
|
e902420269 | ||
|
|
dc0d3ad9b6 | ||
|
|
1c70fc878a | ||
|
|
47cdf2698f | ||
|
|
cf5045cce3 | ||
|
|
e6139d59d9 | ||
|
|
a45e9c5513 | ||
|
|
68d99ac639 |
No files matched your search
Generated
+318
-395
File diff suppressed because it is too large.
Load diff
+5
-5
@@ -12,8 +12,8 @@
|
||||
"base-64": "^0.1.0",
|
||||
"@expo/vector-icons": "^8.1.0",
|
||||
"gfycat-style-urls": "^1.0.3",
|
||||
"lbry-redux": "lbryio/lbry-redux#73f10d488d5fd5df7aa806b60c8df5c948ca3c9a",
|
||||
"lbryinc": "lbryio/lbryinc#17868d948a160af27a375956226f8dd23fa2c37d",
|
||||
"lbry-redux": "lbryio/lbry-redux#362d764c4c0de23032b6871b4d54207dc548028c",
|
||||
"lbryinc": "lbryio/lbryinc#b9f354ae50bd57691765a7d042c5054167878bf4",
|
||||
"lodash": ">=4.17.11",
|
||||
"merge": ">=1.2.1",
|
||||
"moment": "^2.22.1",
|
||||
@@ -22,15 +22,15 @@
|
||||
"@react-native-community/async-storage": "^1.5.1",
|
||||
"react-native-camera": "^2.11.1",
|
||||
"react-native-country-picker-modal": "^0.6.2",
|
||||
"react-native-document-picker": "^2.3.0",
|
||||
"react-native-document-picker": "^3.2.4",
|
||||
"react-native-exception-handler": "2.9.0",
|
||||
"react-native-fast-image": "^6.1.1",
|
||||
"react-native-fs": "^2.13.3",
|
||||
"react-native-gesture-handler": "^1.1.0",
|
||||
"react-native-gesture-handler": "1.1.0",
|
||||
"react-native-image-zoom-viewer": "^2.2.5",
|
||||
"react-native-password-strength-meter": "^0.0.2",
|
||||
"react-native-phone-input": "lbryio/react-native-phone-input",
|
||||
"react-native-reanimated": "^1.2.0",
|
||||
"react-native-reanimated": "1.2.0",
|
||||
"react-native-super-grid": "^3.0.4",
|
||||
"react-native-vector-icons": "^6.6.0",
|
||||
"react-native-video": "lbryio/react-native-video#exoplayer-lbry-android",
|
||||
|
||||
@@ -40,7 +40,7 @@ import {
|
||||
} from 'lbryinc';
|
||||
import { makeSelectClientSetting } from 'redux/selectors/settings';
|
||||
import { decode as atob } from 'base-64';
|
||||
import { dispatchNavigateBack, dispatchNavigateToUri } from 'utils/helper';
|
||||
import { dispatchNavigateBack, dispatchNavigateToUri, transformUrl } from 'utils/helper';
|
||||
import AsyncStorage from '@react-native-community/async-storage';
|
||||
import Colors from 'styles/colors';
|
||||
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||
@@ -413,7 +413,7 @@ class AppWithNavigationState extends React.Component {
|
||||
);
|
||||
}
|
||||
} else {
|
||||
dispatchNavigateToUri(dispatch, nav, evt.url);
|
||||
dispatchNavigateToUri(dispatch, nav, transformUrl(evt.url));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -26,12 +26,19 @@ export default class ChannelSelector extends React.PureComponent {
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
const { channels, fetchChannelListMine, fetchingChannels } = this.props;
|
||||
const { channels, channelName, fetchChannelListMine, fetchingChannels } = this.props;
|
||||
if (!channels.length && !fetchingChannels) {
|
||||
fetchChannelListMine();
|
||||
}
|
||||
}
|
||||
|
||||
componentDidUpdate() {
|
||||
const { channelName } = this.props;
|
||||
if (this.state.currentSelectedValue !== channelName) {
|
||||
this.setState({ currentSelectedValue: channelName });
|
||||
}
|
||||
}
|
||||
|
||||
handleCreateCancel = () => {
|
||||
this.setState({ showCreateChannel: false, newChannelName: '', newChannelBid: 0.1 });
|
||||
};
|
||||
@@ -171,7 +178,7 @@ export default class ChannelSelector extends React.PureComponent {
|
||||
|
||||
render() {
|
||||
const channel = this.state.addingChannel ? 'new' : this.props.channel;
|
||||
const { fetchingChannels, channels = [] } = this.props;
|
||||
const { enabled, fetchingChannels, channels = [] } = this.props;
|
||||
const pickerItems = [Constants.ITEM_ANONYMOUS, Constants.ITEM_CREATE_A_CHANNEL].concat(channels.map(ch => ch.name));
|
||||
|
||||
const {
|
||||
@@ -188,6 +195,7 @@ export default class ChannelSelector extends React.PureComponent {
|
||||
return (
|
||||
<View style={channelSelectorStyle.container}>
|
||||
<Picker
|
||||
enabled={enabled}
|
||||
selectedValue={this.state.currentSelectedValue}
|
||||
style={channelSelectorStyle.channelPicker}
|
||||
itemStyle={channelSelectorStyle.channelPickerItem}
|
||||
|
||||
@@ -11,14 +11,13 @@ import { selectShowNsfw } from 'redux/selectors/settings';
|
||||
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||
import ClaimList from './view';
|
||||
|
||||
const select = (state, props) => {
|
||||
return {
|
||||
claimSearchByQuery: selectClaimSearchByQuery(state),
|
||||
lastPageReached: selectClaimSearchByQueryLastPageReached(state),
|
||||
loadingByQuery: selectFetchingClaimSearchByQuery(state),
|
||||
loading: selectFetchingClaimSearch(state),
|
||||
};
|
||||
};
|
||||
const select = state => ({
|
||||
showNsfwContent: selectShowNsfw(state),
|
||||
claimSearchByQuery: selectClaimSearchByQuery(state),
|
||||
lastPageReached: selectClaimSearchByQueryLastPageReached(state),
|
||||
loadingByQuery: selectFetchingClaimSearchByQuery(state),
|
||||
loading: selectFetchingClaimSearch(state),
|
||||
});
|
||||
|
||||
const perform = dispatch => ({
|
||||
claimSearch: options => dispatch(doClaimSearch(options)),
|
||||
|
||||
@@ -42,7 +42,6 @@ class ClaimList extends React.PureComponent {
|
||||
tags: prevTags,
|
||||
channelIds: prevChannelIds,
|
||||
time: prevTime,
|
||||
showNsfwContent,
|
||||
} = prevProps;
|
||||
const { claimSearchByQuery, orderBy, tags, channelIds, time } = this.props;
|
||||
|
||||
@@ -72,7 +71,7 @@ class ClaimList extends React.PureComponent {
|
||||
}
|
||||
|
||||
buildClaimSearchOptions() {
|
||||
const { orderBy = Constants.DEFAULT_ORDER_BY, channelIds, showNsfwContent, tags, time } = this.props;
|
||||
const { orderBy, channelIds, showNsfwContent, tags, time } = this.props;
|
||||
const { currentPage, subscriptionsView } = this.state;
|
||||
|
||||
const options = {
|
||||
|
||||
@@ -53,39 +53,39 @@ class FileList extends React.PureComponent<Props, State> {
|
||||
dateNew: fileInfos =>
|
||||
this.props.sortByHeight
|
||||
? fileInfos.slice().sort((fileInfo1, fileInfo2) => {
|
||||
if (fileInfo1.pending) {
|
||||
return -1;
|
||||
}
|
||||
const height1 = this.props.claimsById[fileInfo1.claim_id]
|
||||
? this.props.claimsById[fileInfo1.claim_id].height
|
||||
: 0;
|
||||
const height2 = this.props.claimsById[fileInfo2.claim_id]
|
||||
? this.props.claimsById[fileInfo2.claim_id].height
|
||||
: 0;
|
||||
if (height1 > height2) {
|
||||
return -1;
|
||||
} else if (height1 < height2) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
})
|
||||
if (fileInfo1.pending) {
|
||||
return -1;
|
||||
}
|
||||
const height1 = this.props.claimsById[fileInfo1.claim_id]
|
||||
? this.props.claimsById[fileInfo1.claim_id].height
|
||||
: 0;
|
||||
const height2 = this.props.claimsById[fileInfo2.claim_id]
|
||||
? this.props.claimsById[fileInfo2.claim_id].height
|
||||
: 0;
|
||||
if (height1 > height2) {
|
||||
return -1;
|
||||
} else if (height1 < height2) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
})
|
||||
: [...fileInfos].reverse(),
|
||||
dateOld: fileInfos =>
|
||||
this.props.sortByHeight
|
||||
? fileInfos.slice().sort((fileInfo1, fileInfo2) => {
|
||||
const height1 = this.props.claimsById[fileInfo1.claim_id]
|
||||
? this.props.claimsById[fileInfo1.claim_id].height
|
||||
: 999999;
|
||||
const height2 = this.props.claimsById[fileInfo2.claim_id]
|
||||
? this.props.claimsById[fileInfo2.claim_id].height
|
||||
: 999999;
|
||||
if (height1 < height2) {
|
||||
return -1;
|
||||
} else if (height1 > height2) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
})
|
||||
const height1 = this.props.claimsById[fileInfo1.claim_id]
|
||||
? this.props.claimsById[fileInfo1.claim_id].height
|
||||
: 999999;
|
||||
const height2 = this.props.claimsById[fileInfo2.claim_id]
|
||||
? this.props.claimsById[fileInfo2.claim_id].height
|
||||
: 999999;
|
||||
if (height1 < height2) {
|
||||
return -1;
|
||||
} else if (height1 > height2) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
})
|
||||
: fileInfos,
|
||||
title: fileInfos =>
|
||||
fileInfos.slice().sort((fileInfo1, fileInfo2) => {
|
||||
@@ -160,7 +160,7 @@ class FileList extends React.PureComponent<Props, State> {
|
||||
// This is unfortunate
|
||||
// https://github.com/lbryio/lbry/issues/1159
|
||||
const name = claimName || claimNameDownloaded;
|
||||
uriParams.contentName = name;
|
||||
uriParams.claimName = name;
|
||||
uriParams.claimId = claimId;
|
||||
const uri = buildURI(uriParams);
|
||||
|
||||
@@ -179,7 +179,7 @@ class FileList extends React.PureComponent<Props, State> {
|
||||
style={fileListStyle.fileItem}
|
||||
uri={item}
|
||||
navigation={navigation}
|
||||
showDetails={true}
|
||||
showDetails
|
||||
compactView={false}
|
||||
/>
|
||||
)}
|
||||
|
||||
@@ -3,6 +3,7 @@ import { normalizeURI, parseURI } from 'lbry-redux';
|
||||
import { ActivityIndicator, Platform, Text, TouchableOpacity, View } from 'react-native';
|
||||
import { navigateToUri, formatBytes } from 'utils/helper';
|
||||
import Colors from 'styles/colors';
|
||||
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||
import DateTime from 'component/dateTime';
|
||||
import FileItemMedia from 'component/fileItemMedia';
|
||||
import Icon from 'react-native-vector-icons/FontAwesome5';
|
||||
@@ -12,6 +13,10 @@ import ProgressBar from 'component/progressBar';
|
||||
import fileListStyle from 'styles/fileList';
|
||||
|
||||
class FileListItem extends React.PureComponent {
|
||||
state = {
|
||||
url: null,
|
||||
};
|
||||
|
||||
getStorageForFileInfo = fileInfo => {
|
||||
if (!fileInfo.completed) {
|
||||
const written = formatBytes(fileInfo.written_bytes);
|
||||
@@ -41,9 +46,21 @@ class FileListItem extends React.PureComponent {
|
||||
}
|
||||
}
|
||||
|
||||
componentDidUpdate() {
|
||||
const { claim, resolveUri, uri } = this.props;
|
||||
if (!claim && uri !== this.state.url) {
|
||||
this.setState({ url: uri }, () => resolveUri(uri));
|
||||
}
|
||||
}
|
||||
|
||||
defaultOnPress = () => {
|
||||
const { autoplay, navigation, uri, shortUrl } = this.props;
|
||||
navigateToUri(navigation, shortUrl || uri, { autoplay });
|
||||
const { autoplay, claim, featuredResult, navigation, uri, shortUrl } = this.props;
|
||||
|
||||
if (featuredResult && !claim) {
|
||||
navigation.navigate({ routeName: Constants.DRAWER_ROUTE_PUBLISH, params: { vanityUrl: uri.trim() } });
|
||||
} else {
|
||||
navigateToUri(navigation, shortUrl || uri, { autoplay });
|
||||
}
|
||||
};
|
||||
|
||||
onPressHandler = () => {
|
||||
@@ -111,7 +128,7 @@ class FileListItem extends React.PureComponent {
|
||||
// shouldHide = 'channel' === claim.value_type;
|
||||
}
|
||||
|
||||
if (shouldHide || (!isResolvingUri && !claim) || (featuredResult && !isResolvingUri && !claim && !title && !name)) {
|
||||
if (shouldHide || (!isResolvingUri && !claim && !featuredResult)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -130,7 +147,7 @@ class FileListItem extends React.PureComponent {
|
||||
style={fileListStyle.thumbnail}
|
||||
duration={duration}
|
||||
resizeMode="cover"
|
||||
title={title || name}
|
||||
title={title || name || normalizeURI(uri).substring(7)}
|
||||
thumbnail={thumbnail}
|
||||
/>
|
||||
{selected && (
|
||||
@@ -167,6 +184,13 @@ class FileListItem extends React.PureComponent {
|
||||
{isRewardContent && <Icon style={fileListStyle.rewardIcon} name="award" size={12} />}
|
||||
</View>
|
||||
)}
|
||||
|
||||
{featuredResult && !isResolving && !claim && (
|
||||
<View style={fileListStyle.titleContainer}>
|
||||
<Text style={fileListStyle.featuredTitle}>Nothing here. Publish something!</Text>
|
||||
</View>
|
||||
)}
|
||||
|
||||
{channel && !hideChannel && (
|
||||
<Link
|
||||
style={fileListStyle.publisher}
|
||||
|
||||
@@ -19,11 +19,12 @@ class TransactionListItem extends React.PureComponent {
|
||||
return (
|
||||
<View style={transactionListStyle.listItem}>
|
||||
<View style={[transactionListStyle.row, transactionListStyle.topRow]}>
|
||||
<View style={transactionListStyle.col}>
|
||||
<View style={[transactionListStyle.col, transactionListStyle.leftCol]}>
|
||||
<Text style={transactionListStyle.text}>{this.capitalize(type)}</Text>
|
||||
{name && claimId && (
|
||||
<Link
|
||||
style={transactionListStyle.link}
|
||||
numberOfLines={1}
|
||||
onPress={() => navigateToUri(navigation, buildURI({ claimName: name, claimId }))}
|
||||
text={name}
|
||||
/>
|
||||
@@ -37,7 +38,7 @@ class TransactionListItem extends React.PureComponent {
|
||||
</View>
|
||||
</View>
|
||||
<View style={transactionListStyle.row}>
|
||||
<View style={transactionListStyle.col}>
|
||||
<View style={[transactionListStyle.col, transactionListStyle.leftCol]}>
|
||||
<Link
|
||||
style={transactionListStyle.smallLink}
|
||||
text={txid.substring(0, 8)}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import React from 'react';
|
||||
import { SEARCH_TYPES, isNameValid, isURIValid, normalizeURI } from 'lbry-redux';
|
||||
import { FlatList, Keyboard, Text, TextInput, TouchableOpacity, View } from 'react-native';
|
||||
import { navigateToUri } from 'utils/helper';
|
||||
import { navigateToUri, transformUrl } from 'utils/helper';
|
||||
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||
import UriBarItem from './internal/uri-bar-item';
|
||||
import Icon from 'react-native-vector-icons/FontAwesome5';
|
||||
@@ -109,12 +109,19 @@ class UriBar extends React.PureComponent {
|
||||
handleSubmitEditing = () => {
|
||||
const { navigation, onSearchSubmitted, updateSearchQuery } = this.props;
|
||||
if (this.state.inputText) {
|
||||
let inputText = this.state.inputText;
|
||||
if (inputText.startsWith('lbry://') && isURIValid(inputText)) {
|
||||
let inputText = this.state.inputText,
|
||||
inputTextIsUrl = false;
|
||||
if (inputText.startsWith('lbry://')) {
|
||||
const transformedUrl = transformUrl(inputText);
|
||||
// if it's a URI (lbry://...), open the file page
|
||||
const uri = normalizeURI(inputText);
|
||||
navigateToUri(navigation, uri);
|
||||
} else {
|
||||
if (transformedUrl && isURIValid(transformedUrl)) {
|
||||
inputTextIsUrl = true;
|
||||
navigateToUri(navigation, transformedUrl);
|
||||
}
|
||||
}
|
||||
|
||||
// couldn't parse the inputText as a URL for some reason, so do a search instead
|
||||
if (!inputTextIsUrl) {
|
||||
updateSearchQuery(inputText);
|
||||
// Not a URI, default to a search request
|
||||
if (onSearchSubmitted) {
|
||||
@@ -135,9 +142,11 @@ class UriBar extends React.PureComponent {
|
||||
|
||||
render() {
|
||||
const {
|
||||
allowEdit,
|
||||
belowOverlay,
|
||||
navigation,
|
||||
onExitSelectionMode,
|
||||
onEditActionPressed,
|
||||
onDeleteActionPressed,
|
||||
query,
|
||||
selectedItemCount,
|
||||
@@ -175,6 +184,19 @@ class UriBar extends React.PureComponent {
|
||||
</View>
|
||||
|
||||
<View style={uriBarStyle.selectionModeActions}>
|
||||
{allowEdit && selectedItemCount === 1 && (
|
||||
<TouchableOpacity
|
||||
style={[uriBarStyle.actionTouchArea, uriBarStyle.leftAction]}
|
||||
onPress={() => {
|
||||
if (onEditActionPressed) {
|
||||
onEditActionPressed();
|
||||
}
|
||||
}}
|
||||
>
|
||||
<Icon name="edit" size={20} style={uriBarStyle.actionIcon} />
|
||||
</TouchableOpacity>
|
||||
)}
|
||||
|
||||
<TouchableOpacity
|
||||
style={uriBarStyle.actionTouchArea}
|
||||
onPress={() => {
|
||||
|
||||
+14
-13
@@ -43,21 +43,22 @@ class AboutPage extends React.PureComponent {
|
||||
const { pushDrawerStack, setPlayerVisible } = this.props;
|
||||
pushDrawerStack();
|
||||
setPlayerVisible();
|
||||
NativeModules.Firebase.setCurrentScreen('About');
|
||||
|
||||
if (NativeModules.VersionInfo) {
|
||||
NativeModules.VersionInfo.getAppVersion().then(version => {
|
||||
this.setState({ appVersion: version });
|
||||
NativeModules.Firebase.setCurrentScreen('About').then(result => {
|
||||
if (NativeModules.VersionInfo) {
|
||||
NativeModules.VersionInfo.getAppVersion().then(version => {
|
||||
this.setState({ appVersion: version });
|
||||
});
|
||||
}
|
||||
Lbry.version().then(info => {
|
||||
this.setState({
|
||||
versionInfo: info,
|
||||
});
|
||||
});
|
||||
}
|
||||
Lbry.version().then(info => {
|
||||
this.setState({
|
||||
versionInfo: info,
|
||||
});
|
||||
});
|
||||
Lbry.status().then(info => {
|
||||
this.setState({
|
||||
lbryId: info.installation_id,
|
||||
Lbry.status().then(info => {
|
||||
this.setState({
|
||||
lbryId: info.installation_id,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { connect } from 'react-redux';
|
||||
import {
|
||||
doFetchFileInfo,
|
||||
doFetchClaimListMine,
|
||||
doFileGet,
|
||||
doPurchaseUri,
|
||||
doDeletePurchasedUri,
|
||||
@@ -18,6 +19,7 @@ import {
|
||||
makeSelectThumbnailForUri,
|
||||
makeSelectTitleForUri,
|
||||
selectBalance,
|
||||
selectMyClaimUrisWithoutChannels,
|
||||
selectPurchasedUris,
|
||||
selectFailedPurchaseUris,
|
||||
selectPurchaseUriErrorMessage,
|
||||
@@ -50,14 +52,15 @@ const select = (state, props) => {
|
||||
contentType: makeSelectContentTypeForUri(selectProps.uri)(state),
|
||||
costInfo: makeSelectCostInfoForUri(selectProps.uri)(state),
|
||||
metadata: makeSelectMetadataForUri(selectProps.uri)(state),
|
||||
//obscureNsfw: !selectShowNsfw(state),
|
||||
//tab: makeSelectCurrentParam('tab')(state),
|
||||
// obscureNsfw: !selectShowNsfw(state),
|
||||
// tab: makeSelectCurrentParam('tab')(state),
|
||||
fileInfo: makeSelectFileInfoForUri(selectProps.uri)(state),
|
||||
rewardedContentClaimIds: selectRewardContentClaimIds(state, selectProps),
|
||||
channelUri: makeSelectChannelForClaimUri(selectProps.uri, true)(state),
|
||||
position: makeSelectContentPositionForUri(selectProps.uri)(state),
|
||||
purchasedUris: selectPurchasedUris(state),
|
||||
failedPurchaseUris: selectFailedPurchaseUris(state),
|
||||
myClaimUris: selectMyClaimUrisWithoutChannels(state),
|
||||
purchaseUriErrorMessage: selectPurchaseUriErrorMessage(state),
|
||||
streamingUrl: makeSelectStreamingUrlForUri(selectProps.uri)(state),
|
||||
thumbnail: makeSelectThumbnailForUri(selectProps.uri)(state),
|
||||
@@ -71,6 +74,7 @@ const perform = dispatch => ({
|
||||
},
|
||||
fetchFileInfo: uri => dispatch(doFetchFileInfo(uri)),
|
||||
fetchCostInfo: uri => dispatch(doFetchCostInfoForUri(uri)),
|
||||
fetchMyClaims: () => dispatch(doFetchClaimListMine()),
|
||||
fileGet: (uri, saveFile) => dispatch(doFileGet(uri, saveFile)),
|
||||
notify: data => dispatch(doToast(data)),
|
||||
popDrawerStack: () => dispatch(doPopDrawerStack()),
|
||||
|
||||
+28
-11
@@ -232,6 +232,11 @@ class FilePage extends React.PureComponent {
|
||||
}
|
||||
};
|
||||
|
||||
onEditPressed = () => {
|
||||
const { claim, navigation } = this.props;
|
||||
navigation.navigate({ routeName: Constants.DRAWER_ROUTE_PUBLISH, params: { editMode: true, claimToEdit: claim } });
|
||||
};
|
||||
|
||||
onDeletePressed = () => {
|
||||
const { claim, deleteFile, deletePurchasedUri, fileInfo, navigation } = this.props;
|
||||
|
||||
@@ -244,11 +249,11 @@ class FilePage extends React.PureComponent {
|
||||
text: 'Yes',
|
||||
onPress: () => {
|
||||
const { uri } = navigation.state.params;
|
||||
|
||||
deleteFile(`${claim.txid}:${claim.nout}`, true);
|
||||
deletePurchasedUri(uri);
|
||||
if (NativeModules.UtilityModule) {
|
||||
NativeModules.UtilityModule.deleteDownload(uri);
|
||||
}
|
||||
|
||||
NativeModules.UtilityModule.deleteDownload(uri);
|
||||
this.setState({
|
||||
downloadPressed: false,
|
||||
fileViewLogged: false,
|
||||
@@ -571,6 +576,7 @@ class FilePage extends React.PureComponent {
|
||||
rewardedContentClaimIds,
|
||||
isResolvingUri,
|
||||
blackListedOutpoints,
|
||||
myClaimUris,
|
||||
navigation,
|
||||
position,
|
||||
purchaseUri,
|
||||
@@ -643,19 +649,20 @@ class FilePage extends React.PureComponent {
|
||||
const isPlayable = mediaType === 'video' || mediaType === 'audio';
|
||||
const { height, signing_channel: signingChannel, value } = claim;
|
||||
const channelName = signingChannel && signingChannel.name;
|
||||
const channelClaimId = claim && claim.signing_channel && claim.signing_channel.claim_id;
|
||||
const canSendTip = this.state.tipAmount > 0;
|
||||
const fullUri = `${claim.name}#${claim.claim_id}`;
|
||||
const canEdit = myClaimUris.includes(normalizeURI(fullUri));
|
||||
const showActions =
|
||||
fileInfo &&
|
||||
fileInfo.download_path &&
|
||||
(canEdit || (fileInfo && fileInfo.download_path)) &&
|
||||
!this.state.fullscreenMode &&
|
||||
!this.state.showImageViewer &&
|
||||
!this.state.showWebView;
|
||||
const showFileActions =
|
||||
fileInfo &&
|
||||
fileInfo.download_path &&
|
||||
(completed || (fileInfo && !fileInfo.stopped && fileInfo.written_bytes < fileInfo.total_bytes));
|
||||
const channelClaimId = claim && claim.signing_channel && claim.signing_channel.claim_id;
|
||||
const canSendTip = this.state.tipAmount > 0;
|
||||
const fullUri = `${claim.name}#${claim.claim_id}`;
|
||||
canEdit ||
|
||||
(fileInfo &&
|
||||
fileInfo.download_path &&
|
||||
(completed || (fileInfo && !fileInfo.stopped && fileInfo.written_bytes < fileInfo.total_bytes)));
|
||||
const fullChannelUri =
|
||||
channelClaimId && channelClaimId.trim().length > 0
|
||||
? normalizeURI(`${channelName}#${channelClaimId}`)
|
||||
@@ -826,6 +833,16 @@ class FilePage extends React.PureComponent {
|
||||
<View style={filePageStyle.actions}>
|
||||
{showFileActions && (
|
||||
<View style={filePageStyle.fileActions}>
|
||||
{canEdit && (
|
||||
<Button
|
||||
style={[filePageStyle.actionButton, filePageStyle.editButton]}
|
||||
theme={'light'}
|
||||
icon={'edit'}
|
||||
text={'Edit'}
|
||||
onPress={this.onEditPressed}
|
||||
/>
|
||||
)}
|
||||
|
||||
{completed && (
|
||||
<Button
|
||||
style={filePageStyle.actionButton}
|
||||
|
||||
@@ -46,7 +46,7 @@ const perform = dispatch => ({
|
||||
syncApply: (hash, data, password) => dispatch(doSyncApply(hash, data, password)),
|
||||
getSync: password => dispatch(doGetSync(password)),
|
||||
checkSync: () => dispatch(doCheckSync()),
|
||||
setDefaultAccount: () => dispatch(doSetDefaultAccount()),
|
||||
setDefaultAccount: (success, failure) => dispatch(doSetDefaultAccount(success, failure)),
|
||||
notify: data => dispatch(doToast(data)),
|
||||
resendVerificationEmail: email => dispatch(doUserResendVerificationEmail(email)),
|
||||
});
|
||||
|
||||
+22
-10
@@ -33,7 +33,7 @@ class FirstRunScreen extends React.PureComponent {
|
||||
isEmailVerified: false,
|
||||
skipAccountConfirmed: false,
|
||||
showBottomContainer: false,
|
||||
walletPassword: null,
|
||||
walletPassword: '',
|
||||
syncApplyStarted: false,
|
||||
};
|
||||
|
||||
@@ -45,14 +45,13 @@ class FirstRunScreen extends React.PureComponent {
|
||||
});
|
||||
|
||||
if (NativeModules.FirstRun) {
|
||||
NativeModules.Firebase.setCurrentScreen('First Run');
|
||||
|
||||
NativeModules.FirstRun.isFirstRun().then(firstRun => {
|
||||
AsyncStorage.removeItem(Constants.KEY_FIRST_RUN_EMAIL);
|
||||
AsyncStorage.removeItem(Constants.KEY_EMAIL_VERIFY_PENDING);
|
||||
this.setState({ isFirstRun: firstRun });
|
||||
|
||||
if (firstRun) {
|
||||
NativeModules.Firebase.setCurrentScreen('First Run');
|
||||
this.setState({ currentPage: FirstRunScreen.pages[0] });
|
||||
} else {
|
||||
// Not the first run. Navigate to the splash screen right away
|
||||
@@ -87,12 +86,25 @@ class FirstRunScreen extends React.PureComponent {
|
||||
this.setState({ showBottomContainer: true });
|
||||
} else {
|
||||
// password successfully verified
|
||||
if (NativeModules.UtilityModule) {
|
||||
NativeModules.UtilityModule.setSecureValue(Constants.KEY_FIRST_RUN_PASSWORD, this.state.walletPassword);
|
||||
}
|
||||
setDefaultAccount();
|
||||
setClientSetting(Constants.SETTING_DEVICE_WALLET_SYNCED, true);
|
||||
this.closeFinalPage();
|
||||
NativeModules.UtilityModule.setSecureValue(Constants.KEY_FIRST_RUN_PASSWORD, this.state.walletPassword);
|
||||
setDefaultAccount(
|
||||
() => {
|
||||
setClientSetting(Constants.SETTING_DEVICE_WALLET_SYNCED, true);
|
||||
|
||||
// unlock the wallet
|
||||
Lbry.account_unlock({ password: this.state.walletPassword ? this.state.walletPassword : '' })
|
||||
.then(() => this.closeFinalPage())
|
||||
.catch(err =>
|
||||
notify({ message: 'The wallet could not be unlocked at this time. Please restart the app.' })
|
||||
);
|
||||
},
|
||||
err => {
|
||||
notify({
|
||||
message:
|
||||
'The account restore operation could not be completed successfully. Please restart the app and try again.',
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -254,7 +266,7 @@ class FirstRunScreen extends React.PureComponent {
|
||||
};
|
||||
|
||||
onWalletPasswordChanged = password => {
|
||||
this.setState({ walletPassword: password });
|
||||
this.setState({ walletPassword: password !== null ? password : '' });
|
||||
};
|
||||
|
||||
onWalletViewLayout = () => {
|
||||
|
||||
+164
-57
@@ -18,13 +18,14 @@ import { FlatGrid } from 'react-native-super-grid';
|
||||
import {
|
||||
isNameValid,
|
||||
buildURI,
|
||||
normalizeURI,
|
||||
parseURI,
|
||||
regexInvalidURI,
|
||||
CLAIM_VALUES,
|
||||
LICENSES,
|
||||
MATURE_TAGS,
|
||||
THUMBNAIL_STATUSES,
|
||||
} from 'lbry-redux';
|
||||
import { DocumentPicker, DocumentPickerUtil } from 'react-native-document-picker';
|
||||
import { RNCamera } from 'react-native-camera';
|
||||
import { generateCombination } from 'gfycat-style-urls';
|
||||
import RNFS from 'react-native-fs';
|
||||
@@ -42,7 +43,7 @@ import Tag from 'component/tag';
|
||||
import TagSearch from 'component/tagSearch';
|
||||
import UriBar from 'component/uriBar';
|
||||
import publishStyle from 'styles/publish';
|
||||
import __ from 'utils/helper';
|
||||
import { __, navigateToUri } from 'utils/helper';
|
||||
|
||||
const languages = {
|
||||
en: 'English',
|
||||
@@ -76,7 +77,9 @@ class PublishPage extends React.PureComponent {
|
||||
camera = null;
|
||||
|
||||
state = {
|
||||
canPublish: false,
|
||||
canUseCamera: false,
|
||||
editMode: false,
|
||||
titleFocused: false,
|
||||
descriptionFocused: false,
|
||||
loadingVideos: false,
|
||||
@@ -107,6 +110,7 @@ class PublishPage extends React.PureComponent {
|
||||
priceSet: false,
|
||||
|
||||
// input data
|
||||
hasEditedContentAddress: false,
|
||||
bid: 0.1,
|
||||
description: null,
|
||||
title: null,
|
||||
@@ -114,13 +118,13 @@ class PublishPage extends React.PureComponent {
|
||||
license: LICENSES.NONE,
|
||||
licenseUrl: '',
|
||||
otherLicenseDescription: '',
|
||||
mature: false,
|
||||
name: null,
|
||||
price: 0,
|
||||
uri: null,
|
||||
tags: [],
|
||||
selectedChannel: null,
|
||||
uploadedThumbnailUri: null,
|
||||
vanityUrlSet: false,
|
||||
|
||||
// other
|
||||
publishStarted: false,
|
||||
@@ -158,19 +162,93 @@ class PublishPage extends React.PureComponent {
|
||||
};
|
||||
|
||||
onComponentFocused = () => {
|
||||
const { pushDrawerStack, setPlayerVisible } = this.props;
|
||||
const { balance, pushDrawerStack, setPlayerVisible, navigation } = this.props;
|
||||
pushDrawerStack();
|
||||
setPlayerVisible();
|
||||
NativeModules.Firebase.setCurrentScreen('Publish');
|
||||
|
||||
NativeModules.Gallery.canUseCamera().then(canUseCamera => this.setState({ canUseCamera }));
|
||||
NativeModules.Gallery.getThumbnailPath().then(thumbnailPath => this.setState({ thumbnailPath }));
|
||||
NativeModules.Firebase.setCurrentScreen('Publish').then(result => {
|
||||
NativeModules.Gallery.canUseCamera().then(canUseCamera => this.setState({ canUseCamera }));
|
||||
NativeModules.Gallery.getThumbnailPath().then(thumbnailPath => this.setState({ thumbnailPath }));
|
||||
this.setState(
|
||||
{
|
||||
canPublish: balance >= 0.1,
|
||||
loadingVideos: true,
|
||||
},
|
||||
() => {
|
||||
NativeModules.Gallery.getVideos().then(videos => this.setState({ videos, loadingVideos: false }));
|
||||
}
|
||||
);
|
||||
|
||||
// Check if this is an edit action
|
||||
if (navigation.state.params) {
|
||||
const { editMode, claimToEdit, vanityUrl } = navigation.state.params;
|
||||
if (editMode) {
|
||||
this.prepareEdit(claimToEdit);
|
||||
} else if (vanityUrl) {
|
||||
const { claimName } = parseURI(vanityUrl);
|
||||
this.setState({
|
||||
name: claimName,
|
||||
hasEditedContentAddress: true,
|
||||
vanityUrlSet: true,
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
prepareEdit = claim => {
|
||||
let channelName;
|
||||
const { amount, name, signing_channel: signingChannel, value } = claim;
|
||||
const { description, fee, languages, license, license_url: licenseUrl, tags, thumbnail, title } = value;
|
||||
if (signingChannel) {
|
||||
channelName = signingChannel.name;
|
||||
}
|
||||
|
||||
const thumbnailUrl = thumbnail ? thumbnail.url : null;
|
||||
|
||||
// Determine the license
|
||||
let licenseType, otherLicenseDescription;
|
||||
if (!LICENSES.CC_LICENSES.some(({ value }) => value === license)) {
|
||||
if (!license || license === LICENSES.NONE || license === LICENSES.PUBLIC_DOMAIN) {
|
||||
licenseType = license;
|
||||
} else if (license && !licenseUrl && license !== LICENSES.NONE) {
|
||||
licenseType = LICENSES.COPYRIGHT;
|
||||
} else {
|
||||
licenseType = LICENSES.OTHER;
|
||||
}
|
||||
|
||||
otherLicenseDescription = license;
|
||||
} else {
|
||||
licenseType = license;
|
||||
}
|
||||
|
||||
this.setState(
|
||||
{
|
||||
loadingVideos: true,
|
||||
editMode: true,
|
||||
currentPhase: Constants.PHASE_DETAILS,
|
||||
|
||||
hasEditedContentAddress: true,
|
||||
bid: amount,
|
||||
channelName,
|
||||
description,
|
||||
language: languages && languages.length > 0 ? languages[0] : 'en', // default to English
|
||||
license: licenseType,
|
||||
licenseUrl,
|
||||
otherLicenseDescription,
|
||||
name,
|
||||
price: fee && fee.amount ? fee.amount : 0,
|
||||
priceSet: fee && fee.amount > 0,
|
||||
tags: tags && tags.length > 0 ? tags : [],
|
||||
title,
|
||||
currentThumbnailUri: thumbnailUrl,
|
||||
uploadedThumbnailUri: thumbnailUrl,
|
||||
vanityUrlSet: false,
|
||||
},
|
||||
() => {
|
||||
NativeModules.Gallery.getVideos().then(videos => this.setState({ videos, loadingVideos: false }));
|
||||
this.handleNameChange(name);
|
||||
if (channelName) {
|
||||
this.handleChannelChange(channelName);
|
||||
}
|
||||
}
|
||||
);
|
||||
};
|
||||
@@ -184,7 +262,7 @@ class PublishPage extends React.PureComponent {
|
||||
// We are only going to store the full uri, but we need to resolve the uri with and without the channel name
|
||||
let uri;
|
||||
try {
|
||||
uri = buildURI({ contentName: name, channelName });
|
||||
uri = buildURI({ claimName: name, channelName });
|
||||
} catch (e) {
|
||||
// something wrong with channel or name
|
||||
}
|
||||
@@ -192,7 +270,7 @@ class PublishPage extends React.PureComponent {
|
||||
if (uri) {
|
||||
if (channelName) {
|
||||
// resolve without the channel name so we know the winning bid for it
|
||||
const uriLessChannel = buildURI({ contentName: name });
|
||||
const uriLessChannel = buildURI({ claimName: name });
|
||||
resolveUri(uriLessChannel);
|
||||
}
|
||||
resolveUri(uri);
|
||||
@@ -209,6 +287,7 @@ class PublishPage extends React.PureComponent {
|
||||
handlePublishPressed = () => {
|
||||
const { notify, publish, updatePublishForm } = this.props;
|
||||
const {
|
||||
editMode,
|
||||
bid,
|
||||
channelName,
|
||||
currentMedia,
|
||||
@@ -217,7 +296,6 @@ class PublishPage extends React.PureComponent {
|
||||
license,
|
||||
licenseUrl,
|
||||
otherLicenseDescription,
|
||||
mature,
|
||||
name,
|
||||
price,
|
||||
priceSet,
|
||||
@@ -237,14 +315,21 @@ class PublishPage extends React.PureComponent {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!currentMedia && !editMode) {
|
||||
// sanity check. normally shouldn't happen
|
||||
notify({ message: 'No file selected. Please select a video or take a photo before publishing.' });
|
||||
return;
|
||||
}
|
||||
|
||||
const publishParams = {
|
||||
filePath: currentMedia.filePath,
|
||||
filePath: currentMedia ? currentMedia.filePath : null,
|
||||
bid: bid || 0.1,
|
||||
title: title || '',
|
||||
thumbnail,
|
||||
description: description || '',
|
||||
language,
|
||||
license,
|
||||
licenseType: license,
|
||||
licenseUrl,
|
||||
otherLicenseDescription,
|
||||
name: name || undefined,
|
||||
@@ -253,12 +338,9 @@ class PublishPage extends React.PureComponent {
|
||||
uri: uri || undefined,
|
||||
channel: CLAIM_VALUES.CHANNEL_ANONYMOUS === channelName ? null : channelName,
|
||||
isStillEditing: false,
|
||||
claim: {
|
||||
value: {
|
||||
tags,
|
||||
release_time: Math.round(Date.now() / 1000), // set now as the release time
|
||||
},
|
||||
},
|
||||
tags: tags.map(tag => {
|
||||
return { name: tag };
|
||||
}),
|
||||
};
|
||||
|
||||
updatePublishForm(publishParams);
|
||||
@@ -266,7 +348,11 @@ class PublishPage extends React.PureComponent {
|
||||
};
|
||||
|
||||
handlePublishSuccess = data => {
|
||||
this.setState({ publishStarted: false, currentPhase: Constants.PHASE_PUBLISH });
|
||||
const { navigation, notify } = this.props;
|
||||
notify({
|
||||
message: `Your content was successfully published to ${this.state.uri}. It will be available in a few mintues.`,
|
||||
});
|
||||
navigation.navigate({ routeName: Constants.DRAWER_ROUTE_PUBLISHES, params: { publishSuccess: true } });
|
||||
};
|
||||
|
||||
handlePublishFailure = error => {
|
||||
@@ -302,8 +388,8 @@ class PublishPage extends React.PureComponent {
|
||||
this.setState(
|
||||
{
|
||||
currentMedia: media,
|
||||
title: name,
|
||||
name: this.formatNameForTitle(name),
|
||||
title: null, // no title autogeneration (user will fill this in)
|
||||
name: this.state.hasEditedContentAddress ? this.state.name : this.formatNameForTitle(name),
|
||||
currentPhase: Constants.PHASE_DETAILS,
|
||||
},
|
||||
() => this.handleNameChange(this.state.name)
|
||||
@@ -320,6 +406,7 @@ class PublishPage extends React.PureComponent {
|
||||
this.setState(
|
||||
{
|
||||
publishStarted: false,
|
||||
editMode: false,
|
||||
|
||||
currentMedia: null,
|
||||
currentThumbnailUri: null,
|
||||
@@ -334,6 +421,7 @@ class PublishPage extends React.PureComponent {
|
||||
priceSet: false,
|
||||
|
||||
// input data
|
||||
hasEditedContentAddress: false,
|
||||
bid: 0.1,
|
||||
description: null,
|
||||
title: null,
|
||||
@@ -347,6 +435,8 @@ class PublishPage extends React.PureComponent {
|
||||
tags: [],
|
||||
selectedChannel: null,
|
||||
uploadedThumbnailUri: null,
|
||||
|
||||
vanityUrlSet: false,
|
||||
},
|
||||
() => {
|
||||
// reset thumbnail
|
||||
@@ -433,19 +523,6 @@ class PublishPage extends React.PureComponent {
|
||||
});
|
||||
};
|
||||
|
||||
handleUploadPressed = () => {
|
||||
DocumentPicker.show(
|
||||
{
|
||||
filetype: [DocumentPickerUtil.allFiles()],
|
||||
},
|
||||
(error, res) => {
|
||||
if (!error) {
|
||||
// console.log(res);
|
||||
}
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
getRandomFileId = () => {
|
||||
// generate a random id for a photo or recorded video between 1 and 20 (for creating thumbnails)
|
||||
const id = Math.floor(Math.random() * (20 - 2)) + 1;
|
||||
@@ -464,9 +541,13 @@ class PublishPage extends React.PureComponent {
|
||||
this.setState({ price });
|
||||
};
|
||||
|
||||
handleNameChange = name => {
|
||||
handleNameChange = (name, userInput) => {
|
||||
const { notify } = this.props;
|
||||
this.setState({ name });
|
||||
if (userInput) {
|
||||
this.setState({ hasEditedContentAddress: true });
|
||||
}
|
||||
|
||||
if (!isNameValid(name, false)) {
|
||||
notify({ message: 'Your content address contains invalid characters' });
|
||||
return;
|
||||
@@ -483,7 +564,7 @@ class PublishPage extends React.PureComponent {
|
||||
};
|
||||
|
||||
handleAddTag = tag => {
|
||||
if (!tag) {
|
||||
if (!tag || !this.state.canPublish || this.state.publishStarted) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -500,7 +581,7 @@ class PublishPage extends React.PureComponent {
|
||||
};
|
||||
|
||||
handleRemoveTag = tag => {
|
||||
if (!tag) {
|
||||
if (!tag || !this.state.canPublish || this.state.publishStarted) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -556,15 +637,20 @@ class PublishPage extends React.PureComponent {
|
||||
};
|
||||
|
||||
handleTitleChange = title => {
|
||||
this.setState(
|
||||
{
|
||||
title,
|
||||
name: this.formatNameForTitle(title),
|
||||
},
|
||||
() => {
|
||||
this.handleNameChange(this.state.name);
|
||||
}
|
||||
);
|
||||
this.setState({ title });
|
||||
|
||||
if (!this.state.editMode && !this.state.hasEditedContentAddress) {
|
||||
// only autogenerate url if the user has not yet edited the field
|
||||
// also shouldn't change url in edit mode
|
||||
this.setState(
|
||||
{
|
||||
name: this.formatNameForTitle(title),
|
||||
},
|
||||
() => {
|
||||
this.handleNameChange(this.state.name);
|
||||
}
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
handleDescriptionChange = description => {
|
||||
@@ -685,9 +771,12 @@ class PublishPage extends React.PureComponent {
|
||||
)}
|
||||
</View>
|
||||
);
|
||||
} else if (Constants.PHASE_DETAILS === this.state.currentPhase && this.state.currentMedia) {
|
||||
} else if (
|
||||
Constants.PHASE_DETAILS === this.state.currentPhase &&
|
||||
(this.state.editMode || this.state.currentMedia)
|
||||
) {
|
||||
const { currentMedia, currentThumbnailUri } = this.state;
|
||||
if (!currentThumbnailUri) {
|
||||
if (!currentThumbnailUri && !this.state.editMode) {
|
||||
this.updateThumbnailUriForMedia(currentMedia);
|
||||
}
|
||||
content = (
|
||||
@@ -701,7 +790,7 @@ class PublishPage extends React.PureComponent {
|
||||
/>
|
||||
</View>
|
||||
)}
|
||||
{balance < 0.1 && <PublishRewardsDriver navigation={navigation} />}
|
||||
{!this.state.canPublish && <PublishRewardsDriver navigation={navigation} />}
|
||||
|
||||
{this.state.uploadThumbnailStarted && !this.state.uploadedThumbnailUri && (
|
||||
<View style={publishStyle.thumbnailUploadContainer}>
|
||||
@@ -716,6 +805,7 @@ class PublishPage extends React.PureComponent {
|
||||
<Text style={publishStyle.textInputTitle}>Title</Text>
|
||||
)}
|
||||
<TextInput
|
||||
editable={this.state.canPublish && !this.state.publishStarted}
|
||||
placeholder={this.state.titleFocused ? '' : 'Title'}
|
||||
style={publishStyle.inputText}
|
||||
value={this.state.title}
|
||||
@@ -733,6 +823,7 @@ class PublishPage extends React.PureComponent {
|
||||
<Text style={publishStyle.textInputTitle}>Description</Text>
|
||||
)}
|
||||
<TextInput
|
||||
editable={this.state.canPublish && !this.state.publishStarted}
|
||||
placeholder={this.state.descriptionFocused ? '' : 'Description'}
|
||||
style={publishStyle.inputText}
|
||||
value={this.state.description}
|
||||
@@ -764,7 +855,11 @@ class PublishPage extends React.PureComponent {
|
||||
<View style={publishStyle.card}>
|
||||
<Text style={publishStyle.cardTitle}>Channel</Text>
|
||||
|
||||
<ChannelSelector onChannelChange={this.handleChannelChange} />
|
||||
<ChannelSelector
|
||||
enabled={this.state.canPublish && !this.state.publishStarted}
|
||||
channelName={this.state.channelName}
|
||||
onChannelChange={this.handleChannelChange}
|
||||
/>
|
||||
</View>
|
||||
|
||||
<View style={publishStyle.card}>
|
||||
@@ -782,6 +877,7 @@ class PublishPage extends React.PureComponent {
|
||||
{this.state.priceSet && (
|
||||
<View style={[publishStyle.inputRow, publishStyle.priceInputRow]}>
|
||||
<TextInput
|
||||
editable={this.state.canPublish && !this.state.publishStarted}
|
||||
placeholder={'0.00'}
|
||||
keyboardType={'number-pad'}
|
||||
style={publishStyle.priceInput}
|
||||
@@ -796,21 +892,25 @@ class PublishPage extends React.PureComponent {
|
||||
</View>
|
||||
|
||||
<View style={publishStyle.card}>
|
||||
<Text style={publishStyle.cardTitle}>Content Address</Text>
|
||||
<Text style={publishStyle.cardTitle}>Content address</Text>
|
||||
<Text style={publishStyle.helpText}>
|
||||
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 &&
|
||||
' You cannot change this address while editing your content. If you wish to use a new address, please republish the content.'}
|
||||
</Text>
|
||||
|
||||
<TextInput
|
||||
editable={!this.state.editMode && this.state.canPublish && !this.state.publishStarted}
|
||||
placeholder={'lbry://'}
|
||||
style={publishStyle.inputText}
|
||||
underlineColorAndroid={Colors.NextLbryGreen}
|
||||
numberOfLines={1}
|
||||
value={this.state.name}
|
||||
onChangeText={this.handleNameChange}
|
||||
onChangeText={value => this.handleNameChange(value, true)}
|
||||
/>
|
||||
<View style={publishStyle.inputRow}>
|
||||
<TextInput
|
||||
editable={this.state.canPublish && !this.state.publishStarted}
|
||||
placeholder={'0.00'}
|
||||
style={publishStyle.priceInput}
|
||||
underlineColorAndroid={Colors.NextLbryGreen}
|
||||
@@ -830,6 +930,7 @@ class PublishPage extends React.PureComponent {
|
||||
<View>
|
||||
<Text style={publishStyle.cardText}>Language</Text>
|
||||
<Picker
|
||||
enabled={this.state.canPublish && !this.state.publishStarted}
|
||||
selectedValue={this.state.language}
|
||||
style={publishStyle.picker}
|
||||
itemStyle={publishStyle.pickerItem}
|
||||
@@ -844,6 +945,7 @@ class PublishPage extends React.PureComponent {
|
||||
<View>
|
||||
<Text style={publishStyle.cardText}>License</Text>
|
||||
<Picker
|
||||
enabled={this.state.canPublish && !this.state.publishStarted}
|
||||
selectedValue={this.state.license}
|
||||
style={publishStyle.picker}
|
||||
itemStyle={publishStyle.pickerItem}
|
||||
@@ -859,6 +961,7 @@ class PublishPage extends React.PureComponent {
|
||||
</Picker>
|
||||
{[LICENSES.COPYRIGHT, LICENSES.OTHER].includes(this.state.license) && (
|
||||
<TextInput
|
||||
editable={this.state.canPublish && !this.state.publishStarted}
|
||||
placeholder={'License description'}
|
||||
style={publishStyle.inputText}
|
||||
underlineColorAndroid={Colors.NextLbryGreen}
|
||||
@@ -901,8 +1004,8 @@ class PublishPage extends React.PureComponent {
|
||||
<View style={publishStyle.rightActionButtons}>
|
||||
<Button
|
||||
style={publishStyle.publishButton}
|
||||
disabled={balance < 0.1 || !this.state.uploadedThumbnailUri}
|
||||
text="Publish"
|
||||
disabled={!this.state.canPublish || !this.state.uploadedThumbnailUri}
|
||||
text={this.state.editMode ? 'Save changes' : 'Publish'}
|
||||
onPress={this.handlePublishPressed}
|
||||
/>
|
||||
</View>
|
||||
@@ -917,7 +1020,11 @@ class PublishPage extends React.PureComponent {
|
||||
<Text style={publishStyle.successTitle}>Success!</Text>
|
||||
<Text style={publishStyle.successText}>Congratulations! Your content was successfully uploaded.</Text>
|
||||
<View style={publishStyle.successRow}>
|
||||
<Link style={publishStyle.successUrl} text={this.state.uri} href={this.state.uri} />
|
||||
<Link
|
||||
style={publishStyle.successUrl}
|
||||
text={this.state.uri}
|
||||
onPress={() => navigateToUri(navigation, this.state.uri)}
|
||||
/>
|
||||
<TouchableOpacity
|
||||
onPress={() => {
|
||||
Clipboard.setString(this.state.uri);
|
||||
|
||||
@@ -37,10 +37,10 @@ class PublishesPage extends React.PureComponent {
|
||||
const { checkPendingPublishes, fetchMyClaims, pushDrawerStack, setPlayerVisible } = this.props;
|
||||
pushDrawerStack();
|
||||
setPlayerVisible();
|
||||
NativeModules.Firebase.setCurrentScreen('Publishes');
|
||||
|
||||
fetchMyClaims();
|
||||
checkPendingPublishes();
|
||||
NativeModules.Firebase.setCurrentScreen('Publishes').then(result => {
|
||||
fetchMyClaims();
|
||||
checkPendingPublishes();
|
||||
});
|
||||
};
|
||||
|
||||
addOrRemoveItem = (uri, claim) => {
|
||||
@@ -70,6 +70,16 @@ class PublishesPage extends React.PureComponent {
|
||||
this.setState({ selectionMode: false, selectedUris: [], selectedClaimsMap: {} });
|
||||
};
|
||||
|
||||
onEditActionPressed = () => {
|
||||
const { navigation } = this.props;
|
||||
const { selectedClaimsMap, selectedUris } = this.state;
|
||||
// only 1 item can be edited (and edit button should be visible only if there is a single selection)
|
||||
const claim = selectedClaimsMap[selectedUris[0]];
|
||||
this.onExitSelectionMode();
|
||||
|
||||
navigation.navigate({ routeName: Constants.DRAWER_ROUTE_PUBLISH, params: { editMode: true, claimToEdit: claim } });
|
||||
};
|
||||
|
||||
onDeleteActionPressed = () => {
|
||||
const { abandonClaim } = this.props;
|
||||
const { selectedClaimsMap } = this.state;
|
||||
@@ -103,11 +113,13 @@ class PublishesPage extends React.PureComponent {
|
||||
return (
|
||||
<View style={publishStyle.container}>
|
||||
<UriBar
|
||||
allowEdit
|
||||
navigation={navigation}
|
||||
selectionMode={selectionMode}
|
||||
selectedItemCount={selectedUris.length}
|
||||
onExitSelectionMode={this.onExitSelectionMode}
|
||||
onDeleteActionPressed={this.onDeleteActionPressed}
|
||||
onEditActionPressed={this.onEditActionPressed}
|
||||
onExitSelectionMode={this.onExitSelectionMode}
|
||||
/>
|
||||
{fetching && (
|
||||
<View style={publishStyle.centered}>
|
||||
@@ -138,7 +150,6 @@ class PublishesPage extends React.PureComponent {
|
||||
removeClippedSubviews
|
||||
renderItem={({ item }) => (
|
||||
<FileListItem
|
||||
hideChannel
|
||||
key={item}
|
||||
uri={item}
|
||||
style={publishStyle.listItem}
|
||||
|
||||
+11
-17
@@ -37,16 +37,16 @@ class SearchPage extends React.PureComponent {
|
||||
const { pushDrawerStack, setPlayerVisible, query, search } = this.props;
|
||||
pushDrawerStack();
|
||||
setPlayerVisible();
|
||||
NativeModules.Firebase.setCurrentScreen('Search');
|
||||
|
||||
const searchQuery = query || this.getSearchQuery();
|
||||
if (searchQuery && searchQuery.trim().length > 0) {
|
||||
this.setState({
|
||||
currentQuery: searchQuery,
|
||||
currentUri: isURIValid(searchQuery) ? normalizeURI(searchQuery) : null,
|
||||
});
|
||||
search(searchQuery);
|
||||
}
|
||||
NativeModules.Firebase.setCurrentScreen('Search').then(result => {
|
||||
const searchQuery = query || this.getSearchQuery();
|
||||
if (searchQuery && searchQuery.trim().length > 0) {
|
||||
this.setState({
|
||||
currentQuery: searchQuery,
|
||||
currentUri: isURIValid(searchQuery) ? normalizeURI(searchQuery) : null,
|
||||
});
|
||||
search(searchQuery);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
componentDidMount() {
|
||||
@@ -101,13 +101,7 @@ class SearchPage extends React.PureComponent {
|
||||
const { currentUri } = this.state;
|
||||
|
||||
return (
|
||||
<FileListItem
|
||||
uri={currentUri}
|
||||
featuredResult
|
||||
style={searchStyle.featuredResultItem}
|
||||
navigation={navigation}
|
||||
onPress={() => navigateToUri(navigation, this.state.currentUri)}
|
||||
/>
|
||||
<FileListItem uri={currentUri} featuredResult style={searchStyle.featuredResultItem} navigation={navigation} />
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Lbry } from 'lbry-redux';
|
||||
import { ActivityIndicator, Linking, NativeModules, Platform, Text, View } from 'react-native';
|
||||
import { NavigationActions, StackActions } from 'react-navigation';
|
||||
import { decode as atob } from 'base-64';
|
||||
import { navigateToUri } from 'utils/helper';
|
||||
import { navigateToUri, transformUrl } from 'utils/helper';
|
||||
import moment from 'moment';
|
||||
import AsyncStorage from '@react-native-community/async-storage';
|
||||
import Button from 'component/button';
|
||||
@@ -81,7 +81,7 @@ class SplashScreen extends React.PureComponent {
|
||||
});
|
||||
}
|
||||
} else {
|
||||
navigateToUri(navigation, launchUrl);
|
||||
navigateToUri(navigation, transformUrl(launchUrl));
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -130,7 +130,7 @@ class SplashScreen extends React.PureComponent {
|
||||
if (user && user.id && user.has_verified_email) {
|
||||
// user already authenticated
|
||||
NativeModules.UtilityModule.getSecureValue(Constants.KEY_FIRST_RUN_PASSWORD).then(walletPassword => {
|
||||
if (walletPassword && walletPassword.trim().length > 0) {
|
||||
if (walletPassword) {
|
||||
getSync(walletPassword);
|
||||
}
|
||||
this.navigateToMain();
|
||||
@@ -166,14 +166,14 @@ class SplashScreen extends React.PureComponent {
|
||||
|
||||
// For now, automatically unlock the wallet if a password is set so that downloads work
|
||||
NativeModules.UtilityModule.getSecureValue(Constants.KEY_FIRST_RUN_PASSWORD).then(password => {
|
||||
if (password && password.trim().length > 0) {
|
||||
if (password) {
|
||||
this.setState({
|
||||
message: 'Unlocking account',
|
||||
details: 'Decrypting wallet',
|
||||
});
|
||||
|
||||
// unlock the wallet and then finish the splash screen
|
||||
Lbry.account_unlock({ password })
|
||||
Lbry.account_unlock({ password: password || '' })
|
||||
.then(() => {
|
||||
this.setState({
|
||||
message: testingNetwork,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import React from 'react';
|
||||
import { NativeModules, View, ScrollView, Text } from 'react-native';
|
||||
import { ActivityIndicator, NativeModules, View, ScrollView, Text } from 'react-native';
|
||||
import Colors from 'styles/colors';
|
||||
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||
import TransactionList from 'component/transactionList';
|
||||
import UriBar from 'component/uriBar';
|
||||
@@ -23,9 +24,9 @@ class TransactionHistoryPage extends React.PureComponent {
|
||||
const { fetchTransactions, pushDrawerStack, setPlayerVisible } = this.props;
|
||||
pushDrawerStack();
|
||||
setPlayerVisible();
|
||||
NativeModules.Firebase.setCurrentScreen('Transaction History');
|
||||
|
||||
fetchTransactions();
|
||||
NativeModules.Firebase.setCurrentScreen('Transaction History').then(result => {
|
||||
fetchTransactions();
|
||||
});
|
||||
};
|
||||
|
||||
componentDidMount() {
|
||||
@@ -44,13 +45,16 @@ class TransactionHistoryPage extends React.PureComponent {
|
||||
const { fetchingTransactions, transactions, navigation } = this.props;
|
||||
|
||||
return (
|
||||
<View>
|
||||
<View style={walletStyle.container}>
|
||||
<UriBar navigation={navigation} />
|
||||
{fetchingTransactions && (
|
||||
<View style={walletStyle.loadingContainer}>
|
||||
<ActivityIndicator size={'small'} color={Colors.NextLbryGreen} />
|
||||
<Text style={walletStyle.loadingText}>Loading transactions...</Text>
|
||||
</View>
|
||||
)}
|
||||
<ScrollView style={walletStyle.transactionHistoryScroll}>
|
||||
<View style={walletStyle.historyList}>
|
||||
{fetchingTransactions && !transactions.length && (
|
||||
<Text style={walletStyle.infoText}>Loading transactions...</Text>
|
||||
)}
|
||||
{!fetchingTransactions && transactions.length === 0 && (
|
||||
<Text style={walletStyle.infoText}>No transactions to list.</Text>
|
||||
)}
|
||||
|
||||
@@ -45,9 +45,12 @@ class TrendingPage extends React.PureComponent {
|
||||
}
|
||||
|
||||
onComponentFocused = () => {
|
||||
const { pushDrawerStack, setPlayerVisible, navigation } = this.props;
|
||||
const { pushDrawerStack, setPlayerVisible, navigation, sortByItem } = this.props;
|
||||
const { filterForTags } = navigation.state.params ? navigation.state.params : { filterForTags: false };
|
||||
this.setState({ currentTrendingForItem: TRENDING_FOR_ITEMS[filterForTags ? 1 : 0] });
|
||||
this.setState({
|
||||
currentTrendingForItem: TRENDING_FOR_ITEMS[filterForTags ? 1 : 0],
|
||||
orderBy: getOrderBy(sortByItem),
|
||||
});
|
||||
pushDrawerStack(Constants.DRAWER_ROUTE_TRENDING, navigation.state.params);
|
||||
setPlayerVisible();
|
||||
NativeModules.Firebase.setCurrentScreen('All content');
|
||||
@@ -110,7 +113,7 @@ class TrendingPage extends React.PureComponent {
|
||||
<Icon style={discoverStyle.tagSortIcon} name={'sort-down'} size={14} />
|
||||
</TouchableOpacity>
|
||||
|
||||
{sortByTop && <Text style={discoverStyle.pickerLabel}>in the</Text>}
|
||||
{sortByTop && <Text style={discoverStyle.pickerLabel}>from</Text>}
|
||||
|
||||
{sortByTop && (
|
||||
<TouchableOpacity style={discoverStyle.tagTime} onPress={() => this.setState({ showTimePicker: true })}>
|
||||
|
||||
@@ -29,7 +29,7 @@ import {
|
||||
} from 'lbryinc';
|
||||
import { doSetClientSetting } from 'redux/actions/settings';
|
||||
import { makeSelectClientSetting } from 'redux/selectors/settings';
|
||||
import Constants from 'constants';
|
||||
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||
import Verification from './view';
|
||||
|
||||
const select = state => ({
|
||||
@@ -54,13 +54,13 @@ const select = state => ({
|
||||
|
||||
const perform = dispatch => ({
|
||||
addUserEmail: email => dispatch(doUserEmailNew(email)),
|
||||
addUserPhone: (phone, country_code) => dispatch(doUserPhoneNew(phone, country_code)),
|
||||
addUserPhone: (phone, countryCode) => dispatch(doUserPhoneNew(phone, countryCode)),
|
||||
getSync: password => dispatch(doGetSync(password)),
|
||||
checkSync: () => dispatch(doCheckSync()),
|
||||
verifyPhone: verificationCode => dispatch(doUserPhoneVerify(verificationCode)),
|
||||
notify: data => dispatch(doToast(data)),
|
||||
setClientSetting: (key, value) => dispatch(doSetClientSetting(key, value)),
|
||||
setDefaultAccount: () => dispatch(doSetDefaultAccount()),
|
||||
setDefaultAccount: (success, failure) => dispatch(doSetDefaultAccount(success, failure)),
|
||||
setEmailToVerify: email => dispatch(doUserEmailToVerify(email)),
|
||||
syncApply: (hash, data, password) => dispatch(doSyncApply(hash, data, password)),
|
||||
resendVerificationEmail: email => dispatch(doUserResendVerificationEmail(email)),
|
||||
|
||||
@@ -5,7 +5,7 @@ import { BarPasswordStrengthDisplay } from 'react-native-password-strength-meter
|
||||
import Button from 'component/button';
|
||||
import Link from 'component/link';
|
||||
import Colors from 'styles/colors';
|
||||
import Constants from 'constants';
|
||||
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||
import firstRunStyle from 'styles/firstRun';
|
||||
import Icon from 'react-native-vector-icons/FontAwesome5';
|
||||
import rewardStyle from 'styles/reward';
|
||||
@@ -62,11 +62,29 @@ class SyncVerifyPage extends React.PureComponent {
|
||||
} else {
|
||||
// password successfully verified
|
||||
if (NativeModules.UtilityModule) {
|
||||
NativeModules.UtilityModule.setSecureValue(Constants.KEY_FIRST_RUN_PASSWORD, this.state.password);
|
||||
NativeModules.UtilityModule.setSecureValue(
|
||||
Constants.KEY_FIRST_RUN_PASSWORD,
|
||||
this.state.password ? this.state.password : ''
|
||||
);
|
||||
}
|
||||
setDefaultAccount();
|
||||
setClientSetting(Constants.SETTING_DEVICE_WALLET_SYNCED, true);
|
||||
navigation.goBack();
|
||||
setDefaultAccount(
|
||||
() => {
|
||||
setClientSetting(Constants.SETTING_DEVICE_WALLET_SYNCED, true);
|
||||
|
||||
// unlock the wallet
|
||||
Lbry.account_unlock({ password: this.state.password ? this.state.password : '' })
|
||||
.then(() => navigation.goBack())
|
||||
.catch(err =>
|
||||
notify({ message: 'The wallet could not be unlocked at this time. Please restart the app.' })
|
||||
);
|
||||
},
|
||||
err => {
|
||||
notify({
|
||||
message:
|
||||
'The account restore operation could not be completed successfully. Please restart the app and try again.',
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ class WalletPage extends React.PureComponent {
|
||||
const { deviceWalletSynced, getSync, user } = this.props;
|
||||
if (deviceWalletSynced && user && user.has_verified_email) {
|
||||
NativeModules.UtilityModule.getSecureValue(Constants.KEY_FIRST_RUN_PASSWORD).then(walletPassword => {
|
||||
if (walletPassword && walletPassword.trim().length > 0) {
|
||||
if (walletPassword) {
|
||||
getSync(walletPassword);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -194,6 +194,10 @@ const filePageStyle = StyleSheet.create({
|
||||
},
|
||||
fileActions: {
|
||||
alignSelf: 'flex-end',
|
||||
flexDirection: 'row',
|
||||
},
|
||||
editButton: {
|
||||
marginRight: 8,
|
||||
},
|
||||
socialActions: {
|
||||
alignSelf: 'flex-start',
|
||||
|
||||
@@ -17,6 +17,9 @@ const transactionListStyle = StyleSheet.create({
|
||||
topRow: {
|
||||
marginBottom: 4,
|
||||
},
|
||||
leftCol: {
|
||||
flex: 0.7,
|
||||
},
|
||||
col: {
|
||||
alignSelf: 'stretch',
|
||||
},
|
||||
|
||||
@@ -98,6 +98,9 @@ const uriBarStyle = StyleSheet.create({
|
||||
height: '100%',
|
||||
alignItems: 'center',
|
||||
},
|
||||
leftAction: {
|
||||
marginRight: 16,
|
||||
},
|
||||
actionTouchArea: {
|
||||
height: '100%',
|
||||
alignItems: 'center',
|
||||
|
||||
@@ -3,6 +3,7 @@ import Colors from './colors';
|
||||
|
||||
const walletStyle = StyleSheet.create({
|
||||
container: {
|
||||
flex: 1,
|
||||
backgroundColor: Colors.PageBackground,
|
||||
},
|
||||
scrollContainer: {
|
||||
@@ -288,6 +289,22 @@ const walletStyle = StyleSheet.create({
|
||||
syncSwitch: {
|
||||
marginLeft: 8,
|
||||
},
|
||||
loadingContainer: {
|
||||
position: 'absolute',
|
||||
flexDirection: 'row',
|
||||
left: 0,
|
||||
right: 0,
|
||||
top: 60,
|
||||
bottom: 0,
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
},
|
||||
loadingText: {
|
||||
color: '#aaaaaa',
|
||||
fontFamily: 'Inter-UI-Regular',
|
||||
fontSize: 16,
|
||||
marginLeft: 8,
|
||||
},
|
||||
});
|
||||
|
||||
export default walletStyle;
|
||||
+8
-2
@@ -1,5 +1,5 @@
|
||||
import { NavigationActions, StackActions } from 'react-navigation';
|
||||
import { buildURI, isURIValid } from 'lbry-redux';
|
||||
import { buildURI, isURIValid, normalizeURI } from 'lbry-redux';
|
||||
import { doPopDrawerStack, doPushDrawerStack, doSetPlayerVisible } from 'redux/actions/drawer';
|
||||
import Constants, { DrawerRoutes } from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||
|
||||
@@ -184,7 +184,7 @@ export function dispatchNavigateBack(dispatch, nav, drawerStack) {
|
||||
export function uriFromFileInfo(fileInfo) {
|
||||
const { name: claimName, claim_name: claimNameDownloaded, claim_id: claimId } = fileInfo;
|
||||
const uriParams = {};
|
||||
uriParams.contentName = claimName || claimNameDownloaded;
|
||||
uriParams.claimName = claimName || claimNameDownloaded;
|
||||
uriParams.claimId = claimId;
|
||||
return buildURI(uriParams);
|
||||
}
|
||||
@@ -246,6 +246,12 @@ export function getOrderBy(item) {
|
||||
return orderBy;
|
||||
}
|
||||
|
||||
// replace occurrences of ':' with '#' in a url (entered in the URI bar)
|
||||
export function transformUrl(url) {
|
||||
const start = 'lbry://'.length;
|
||||
return normalizeURI(url.substring(start).replace(/:/g, '#'));
|
||||
}
|
||||
|
||||
// i18n placeholder until we find a good react-native i18n module
|
||||
export function __(str) {
|
||||
return str;
|
||||
|
||||
Reference in new issue
Block a user