edit published content #32
13 changed files with 95 additions and 62 deletions
|
@ -12,7 +12,7 @@
|
||||||
"base-64": "^0.1.0",
|
"base-64": "^0.1.0",
|
||||||
"@expo/vector-icons": "^8.1.0",
|
"@expo/vector-icons": "^8.1.0",
|
||||||
"gfycat-style-urls": "^1.0.3",
|
"gfycat-style-urls": "^1.0.3",
|
||||||
"lbry-redux": "lbryio/lbry-redux#4f812db1c7cdb4c08c5426d4d3f83023de5d655f",
|
"lbry-redux": "lbryio/lbry-redux#73f10d488d5fd5df7aa806b60c8df5c948ca3c9a",
|
||||||
"lbryinc": "lbryio/lbryinc#17868d948a160af27a375956226f8dd23fa2c37d",
|
"lbryinc": "lbryio/lbryinc#17868d948a160af27a375956226f8dd23fa2c37d",
|
||||||
"lodash": ">=4.17.11",
|
"lodash": ">=4.17.11",
|
||||||
"merge": ">=1.2.1",
|
"merge": ">=1.2.1",
|
||||||
|
|
|
@ -18,7 +18,7 @@ const select = (state, props) => ({
|
||||||
claim: makeSelectClaimForUri(props.uri)(state),
|
claim: makeSelectClaimForUri(props.uri)(state),
|
||||||
fileInfo: makeSelectFileInfoForUri(props.uri)(state),
|
fileInfo: makeSelectFileInfoForUri(props.uri)(state),
|
||||||
metadata: makeSelectMetadataForUri(props.uri)(state),
|
metadata: makeSelectMetadataForUri(props.uri)(state),
|
||||||
rewardedContentClaimIds: selectRewardContentClaimIds(state, props),
|
rewardedContentClaimIds: selectRewardContentClaimIds(state),
|
||||||
isResolvingUri: makeSelectIsUriResolving(props.uri)(state),
|
isResolvingUri: makeSelectIsUriResolving(props.uri)(state),
|
||||||
obscureNsfw: !selectShowNsfw(state),
|
obscureNsfw: !selectShowNsfw(state),
|
||||||
shortUrl: makeSelectShortUrlForUri(props.uri)(state),
|
shortUrl: makeSelectShortUrlForUri(props.uri)(state),
|
||||||
|
|
|
@ -10,7 +10,7 @@ import {
|
||||||
makeSelectTitleForUri,
|
makeSelectTitleForUri,
|
||||||
makeSelectThumbnailForUri,
|
makeSelectThumbnailForUri,
|
||||||
} from 'lbry-redux';
|
} from 'lbry-redux';
|
||||||
import { selectBlackListedOutpoints, selectFilteredOutpoints } from 'lbryinc';
|
import { selectBlackListedOutpoints, selectFilteredOutpoints, selectRewardContentClaimIds } from 'lbryinc';
|
||||||
import { selectShowNsfw } from 'redux/selectors/settings';
|
import { selectShowNsfw } from 'redux/selectors/settings';
|
||||||
import FileListItem from './view';
|
import FileListItem from './view';
|
||||||
|
|
||||||
|
@ -24,6 +24,7 @@ const select = (state, props) => ({
|
||||||
nsfw: makeSelectClaimIsNsfw(props.uri)(state),
|
nsfw: makeSelectClaimIsNsfw(props.uri)(state),
|
||||||
isResolvingUri: makeSelectIsUriResolving(props.uri)(state),
|
isResolvingUri: makeSelectIsUriResolving(props.uri)(state),
|
||||||
obscureNsfw: !selectShowNsfw(state),
|
obscureNsfw: !selectShowNsfw(state),
|
||||||
|
rewardedContentClaimIds: selectRewardContentClaimIds(state),
|
||||||
shortUrl: makeSelectShortUrlForUri(props.uri)(state),
|
shortUrl: makeSelectShortUrlForUri(props.uri)(state),
|
||||||
title: makeSelectTitleForUri(props.uri)(state),
|
title: makeSelectTitleForUri(props.uri)(state),
|
||||||
thumbnail: makeSelectThumbnailForUri(props.uri)(state),
|
thumbnail: makeSelectThumbnailForUri(props.uri)(state),
|
||||||
|
|
|
@ -70,6 +70,7 @@ class FileListItem extends React.PureComponent {
|
||||||
obscureNsfw,
|
obscureNsfw,
|
||||||
onPress,
|
onPress,
|
||||||
navigation,
|
navigation,
|
||||||
|
rewardedContentClaimIds,
|
||||||
thumbnail,
|
thumbnail,
|
||||||
hideChannel,
|
hideChannel,
|
||||||
onLongPress,
|
onLongPress,
|
||||||
|
@ -82,12 +83,21 @@ class FileListItem extends React.PureComponent {
|
||||||
const isResolving = !fileInfo && isResolvingUri;
|
const isResolving = !fileInfo && isResolvingUri;
|
||||||
const duration = claim && claim.value && claim.value.video ? claim.value.video.duration : null;
|
const duration = claim && claim.value && claim.value.video ? claim.value.video.duration : null;
|
||||||
|
|
||||||
let name, channel, height, channelClaimId, fullChannelUri, shortChannelUri, shouldHide, signingChannel;
|
let name,
|
||||||
|
channel,
|
||||||
|
height,
|
||||||
|
isRewardContent,
|
||||||
|
channelClaimId,
|
||||||
|
fullChannelUri,
|
||||||
|
shortChannelUri,
|
||||||
|
shouldHide,
|
||||||
|
signingChannel;
|
||||||
if (claim) {
|
if (claim) {
|
||||||
name = claim.name;
|
name = claim.name;
|
||||||
signingChannel = claim.signing_channel;
|
signingChannel = claim.signing_channel;
|
||||||
channel = signingChannel ? signingChannel.name : null;
|
channel = signingChannel ? signingChannel.name : null;
|
||||||
height = claim.height;
|
height = claim.height;
|
||||||
|
isRewardContent = rewardedContentClaimIds.includes(claim.claim_id);
|
||||||
channelClaimId = signingChannel ? signingChannel.claim_id : null;
|
channelClaimId = signingChannel ? signingChannel.claim_id : null;
|
||||||
fullChannelUri = channelClaimId ? `${channel}#${channelClaimId}` : channel;
|
fullChannelUri = channelClaimId ? `${channel}#${channelClaimId}` : channel;
|
||||||
shortChannelUri = signingChannel ? signingChannel.short_url : null;
|
shortChannelUri = signingChannel ? signingChannel.short_url : null;
|
||||||
|
@ -150,9 +160,12 @@ class FileListItem extends React.PureComponent {
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{(title || name) && (
|
{(title || name) && (
|
||||||
|
<View style={fileListStyle.titleContainer}>
|
||||||
<Text style={featuredResult ? fileListStyle.featuredTitle : fileListStyle.title}>
|
<Text style={featuredResult ? fileListStyle.featuredTitle : fileListStyle.title}>
|
||||||
{this.formatTitle(title) || this.formatTitle(name)}
|
{this.formatTitle(title) || this.formatTitle(name)}
|
||||||
</Text>
|
</Text>
|
||||||
|
{isRewardContent && <Icon style={fileListStyle.rewardIcon} name="award" size={12} />}
|
||||||
|
</View>
|
||||||
)}
|
)}
|
||||||
{channel && !hideChannel && (
|
{channel && !hideChannel && (
|
||||||
<Link
|
<Link
|
||||||
|
|
|
@ -43,8 +43,8 @@ class AboutPage extends React.PureComponent {
|
||||||
const { pushDrawerStack, setPlayerVisible } = this.props;
|
const { pushDrawerStack, setPlayerVisible } = this.props;
|
||||||
pushDrawerStack();
|
pushDrawerStack();
|
||||||
setPlayerVisible();
|
setPlayerVisible();
|
||||||
NativeModules.Firebase.setCurrentScreen('About');
|
|
||||||
|
|
||||||
|
NativeModules.Firebase.setCurrentScreen('About').then(result => {
|
||||||
if (NativeModules.VersionInfo) {
|
if (NativeModules.VersionInfo) {
|
||||||
NativeModules.VersionInfo.getAppVersion().then(version => {
|
NativeModules.VersionInfo.getAppVersion().then(version => {
|
||||||
this.setState({ appVersion: version });
|
this.setState({ appVersion: version });
|
||||||
|
@ -60,6 +60,7 @@ class AboutPage extends React.PureComponent {
|
||||||
lbryId: info.installation_id,
|
lbryId: info.installation_id,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
if (!this.props.accessToken) this.props.fetchAccessToken();
|
if (!this.props.accessToken) this.props.fetchAccessToken();
|
||||||
};
|
};
|
||||||
|
|
|
@ -70,6 +70,7 @@ class FilePage extends React.PureComponent {
|
||||||
mediaLoaded: false,
|
mediaLoaded: false,
|
||||||
pageSuspended: false,
|
pageSuspended: false,
|
||||||
relatedContentY: 0,
|
relatedContentY: 0,
|
||||||
|
sendTipStarted: false,
|
||||||
showDescription: false,
|
showDescription: false,
|
||||||
showImageViewer: false,
|
showImageViewer: false,
|
||||||
showWebView: false,
|
showWebView: false,
|
||||||
|
@ -503,7 +504,7 @@ class FilePage extends React.PureComponent {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const suffix = 'credit' + (tipAmount === 1 ? '' : 's');
|
const suffix = 'credit' + (parseInt(tipAmount, 10) === 1 ? '' : 's');
|
||||||
Alert.alert(
|
Alert.alert(
|
||||||
'Send tip',
|
'Send tip',
|
||||||
`Are you sure you want to tip ${tipAmount} ${suffix}?`,
|
`Are you sure you want to tip ${tipAmount} ${suffix}?`,
|
||||||
|
@ -512,9 +513,11 @@ class FilePage extends React.PureComponent {
|
||||||
{
|
{
|
||||||
text: 'Yes',
|
text: 'Yes',
|
||||||
onPress: () => {
|
onPress: () => {
|
||||||
|
this.setState({ sendTipStarted: true }, () =>
|
||||||
sendTip(tipAmount, claim.claim_id, false, () => {
|
sendTip(tipAmount, claim.claim_id, false, () => {
|
||||||
this.setState({ tipAmount: 0, showTipView: false });
|
this.setState({ tipAmount: null, showTipView: false, sendTipStarted: false });
|
||||||
});
|
})
|
||||||
|
);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
@ -882,6 +885,7 @@ class FilePage extends React.PureComponent {
|
||||||
<Text style={filePageStyle.title} selectable>
|
<Text style={filePageStyle.title} selectable>
|
||||||
{title}
|
{title}
|
||||||
</Text>
|
</Text>
|
||||||
|
{isRewardContent && <Icon name="award" style={filePageStyle.rewardIcon} size={16} />}
|
||||||
<View style={filePageStyle.descriptionToggle}>
|
<View style={filePageStyle.descriptionToggle}>
|
||||||
<Icon name={this.state.showDescription ? 'caret-up' : 'caret-down'} size={24} />
|
<Icon name={this.state.showDescription ? 'caret-up' : 'caret-down'} size={24} />
|
||||||
</View>
|
</View>
|
||||||
|
@ -953,16 +957,19 @@ class FilePage extends React.PureComponent {
|
||||||
<View style={filePageStyle.row}>
|
<View style={filePageStyle.row}>
|
||||||
<View style={filePageStyle.amountRow}>
|
<View style={filePageStyle.amountRow}>
|
||||||
<TextInput
|
<TextInput
|
||||||
|
editable={!this.state.sendTipStarted}
|
||||||
ref={ref => (this.tipAmountInput = ref)}
|
ref={ref => (this.tipAmountInput = ref)}
|
||||||
onChangeText={value => this.setState({ tipAmount: value })}
|
onChangeText={value => this.setState({ tipAmount: value })}
|
||||||
underlineColorAndroid={Colors.NextLbryGreen}
|
underlineColorAndroid={Colors.NextLbryGreen}
|
||||||
keyboardType={'numeric'}
|
keyboardType={'numeric'}
|
||||||
placeholder={'0'}
|
placeholder={'0'}
|
||||||
value={this.state.tipAmount}
|
value={this.state.tipAmount}
|
||||||
|
selectTextOnFocus
|
||||||
style={[filePageStyle.input, filePageStyle.tipAmountInput]}
|
style={[filePageStyle.input, filePageStyle.tipAmountInput]}
|
||||||
/>
|
/>
|
||||||
<Text style={[filePageStyle.text, filePageStyle.currency]}>LBC</Text>
|
<Text style={[filePageStyle.text, filePageStyle.currency]}>LBC</Text>
|
||||||
</View>
|
</View>
|
||||||
|
{this.state.sendTipStarted && <ActivityIndicator size={'small'} color={Colors.NextLbryGreen} />}
|
||||||
<Link
|
<Link
|
||||||
style={[filePageStyle.link, filePageStyle.cancelTipLink]}
|
style={[filePageStyle.link, filePageStyle.cancelTipLink]}
|
||||||
text={'Cancel'}
|
text={'Cancel'}
|
||||||
|
@ -971,7 +978,7 @@ class FilePage extends React.PureComponent {
|
||||||
<Button
|
<Button
|
||||||
text={'Send a tip'}
|
text={'Send a tip'}
|
||||||
style={[filePageStyle.button, filePageStyle.sendButton]}
|
style={[filePageStyle.button, filePageStyle.sendButton]}
|
||||||
disabled={!canSendTip}
|
disabled={!canSendTip || this.state.sendTipStarted}
|
||||||
onPress={this.handleSendTip}
|
onPress={this.handleSendTip}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
|
|
|
@ -45,14 +45,13 @@ class FirstRunScreen extends React.PureComponent {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (NativeModules.FirstRun) {
|
if (NativeModules.FirstRun) {
|
||||||
NativeModules.Firebase.setCurrentScreen('First Run');
|
|
||||||
|
|
||||||
NativeModules.FirstRun.isFirstRun().then(firstRun => {
|
NativeModules.FirstRun.isFirstRun().then(firstRun => {
|
||||||
AsyncStorage.removeItem(Constants.KEY_FIRST_RUN_EMAIL);
|
AsyncStorage.removeItem(Constants.KEY_FIRST_RUN_EMAIL);
|
||||||
AsyncStorage.removeItem(Constants.KEY_EMAIL_VERIFY_PENDING);
|
AsyncStorage.removeItem(Constants.KEY_EMAIL_VERIFY_PENDING);
|
||||||
this.setState({ isFirstRun: firstRun });
|
this.setState({ isFirstRun: firstRun });
|
||||||
|
|
||||||
if (firstRun) {
|
if (firstRun) {
|
||||||
|
NativeModules.Firebase.setCurrentScreen('First Run');
|
||||||
this.setState({ currentPage: FirstRunScreen.pages[0] });
|
this.setState({ currentPage: FirstRunScreen.pages[0] });
|
||||||
} else {
|
} else {
|
||||||
// Not the first run. Navigate to the splash screen right away
|
// Not the first run. Navigate to the splash screen right away
|
||||||
|
|
|
@ -162,8 +162,8 @@ class PublishPage extends React.PureComponent {
|
||||||
const { pushDrawerStack, setPlayerVisible, navigation } = this.props;
|
const { pushDrawerStack, setPlayerVisible, navigation } = this.props;
|
||||||
pushDrawerStack();
|
pushDrawerStack();
|
||||||
setPlayerVisible();
|
setPlayerVisible();
|
||||||
NativeModules.Firebase.setCurrentScreen('Publish');
|
|
||||||
|
|
||||||
|
NativeModules.Firebase.setCurrentScreen('Publish').then(result => {
|
||||||
NativeModules.Gallery.canUseCamera().then(canUseCamera => this.setState({ canUseCamera }));
|
NativeModules.Gallery.canUseCamera().then(canUseCamera => this.setState({ canUseCamera }));
|
||||||
NativeModules.Gallery.getThumbnailPath().then(thumbnailPath => this.setState({ thumbnailPath }));
|
NativeModules.Gallery.getThumbnailPath().then(thumbnailPath => this.setState({ thumbnailPath }));
|
||||||
this.setState(
|
this.setState(
|
||||||
|
@ -182,6 +182,7 @@ class PublishPage extends React.PureComponent {
|
||||||
this.prepareEdit(claimToEdit);
|
this.prepareEdit(claimToEdit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
prepareEdit = claim => {
|
prepareEdit = claim => {
|
||||||
|
@ -248,7 +249,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
|
// We are only going to store the full uri, but we need to resolve the uri with and without the channel name
|
||||||
let uri;
|
let uri;
|
||||||
try {
|
try {
|
||||||
uri = buildURI({ contentName: name, channelName });
|
uri = buildURI({ claimName: name, channelName });
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// something wrong with channel or name
|
// something wrong with channel or name
|
||||||
}
|
}
|
||||||
|
@ -256,7 +257,7 @@ class PublishPage extends React.PureComponent {
|
||||||
if (uri) {
|
if (uri) {
|
||||||
if (channelName) {
|
if (channelName) {
|
||||||
// resolve without the channel name so we know the winning bid for it
|
// 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(uriLessChannel);
|
||||||
}
|
}
|
||||||
resolveUri(uri);
|
resolveUri(uri);
|
||||||
|
|
|
@ -37,8 +37,7 @@ class SearchPage extends React.PureComponent {
|
||||||
const { pushDrawerStack, setPlayerVisible, query, search } = this.props;
|
const { pushDrawerStack, setPlayerVisible, query, search } = this.props;
|
||||||
pushDrawerStack();
|
pushDrawerStack();
|
||||||
setPlayerVisible();
|
setPlayerVisible();
|
||||||
NativeModules.Firebase.setCurrentScreen('Search');
|
NativeModules.Firebase.setCurrentScreen('Search').then(result => {
|
||||||
|
|
||||||
const searchQuery = query || this.getSearchQuery();
|
const searchQuery = query || this.getSearchQuery();
|
||||||
if (searchQuery && searchQuery.trim().length > 0) {
|
if (searchQuery && searchQuery.trim().length > 0) {
|
||||||
this.setState({
|
this.setState({
|
||||||
|
@ -47,6 +46,7 @@ class SearchPage extends React.PureComponent {
|
||||||
});
|
});
|
||||||
search(searchQuery);
|
search(searchQuery);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
|
|
|
@ -23,9 +23,9 @@ class TransactionHistoryPage extends React.PureComponent {
|
||||||
const { fetchTransactions, pushDrawerStack, setPlayerVisible } = this.props;
|
const { fetchTransactions, pushDrawerStack, setPlayerVisible } = this.props;
|
||||||
pushDrawerStack();
|
pushDrawerStack();
|
||||||
setPlayerVisible();
|
setPlayerVisible();
|
||||||
NativeModules.Firebase.setCurrentScreen('Transaction History');
|
NativeModules.Firebase.setCurrentScreen('Transaction History').then(result => {
|
||||||
|
|
||||||
fetchTransactions();
|
fetchTransactions();
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
|
|
|
@ -203,7 +203,7 @@ const discoverStyle = StyleSheet.create({
|
||||||
justifyContent: 'space-between',
|
justifyContent: 'space-between',
|
||||||
},
|
},
|
||||||
rewardIcon: {
|
rewardIcon: {
|
||||||
color: Colors.Red,
|
color: Colors.NextLbryGreen,
|
||||||
flex: 0.1,
|
flex: 0.1,
|
||||||
textAlign: 'right',
|
textAlign: 'right',
|
||||||
marginTop: 6,
|
marginTop: 6,
|
||||||
|
|
|
@ -105,6 +105,16 @@ const fileListStyle = StyleSheet.create({
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
justifyContent: 'center',
|
justifyContent: 'center',
|
||||||
},
|
},
|
||||||
|
titleContainer: {
|
||||||
|
flexDirection: 'row',
|
||||||
|
marginRight: 16,
|
||||||
|
},
|
||||||
|
rewardIcon: {
|
||||||
|
color: Colors.NextLbryGreen,
|
||||||
|
textAlign: 'right',
|
||||||
|
marginLeft: 4,
|
||||||
|
marginTop: 4,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export default fileListStyle;
|
export default fileListStyle;
|
||||||
|
|
|
@ -358,8 +358,9 @@ const filePageStyle = StyleSheet.create({
|
||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
},
|
},
|
||||||
rewardIcon: {
|
rewardIcon: {
|
||||||
color: Colors.White,
|
color: Colors.NextLbryGreen,
|
||||||
marginRight: 8,
|
marginTop: -8,
|
||||||
|
marginLeft: 8,
|
||||||
},
|
},
|
||||||
backButton: {
|
backButton: {
|
||||||
position: 'absolute',
|
position: 'absolute',
|
||||||
|
|
Loading…
Reference in a new issue