edit published content #32

Merged
akinwale merged 5 commits from edit-publish into master 2019-08-25 18:08:44 +02:00
13 changed files with 95 additions and 62 deletions
Showing only changes of commit 6217c45322 - Show all commits

View file

@ -12,7 +12,7 @@
"base-64": "^0.1.0",
"@expo/vector-icons": "^8.1.0",
"gfycat-style-urls": "^1.0.3",
"lbry-redux": "lbryio/lbry-redux#4f812db1c7cdb4c08c5426d4d3f83023de5d655f",
"lbry-redux": "lbryio/lbry-redux#73f10d488d5fd5df7aa806b60c8df5c948ca3c9a",
"lbryinc": "lbryio/lbryinc#17868d948a160af27a375956226f8dd23fa2c37d",
"lodash": ">=4.17.11",
"merge": ">=1.2.1",

View file

@ -18,7 +18,7 @@ const select = (state, props) => ({
claim: makeSelectClaimForUri(props.uri)(state),
fileInfo: makeSelectFileInfoForUri(props.uri)(state),
metadata: makeSelectMetadataForUri(props.uri)(state),
rewardedContentClaimIds: selectRewardContentClaimIds(state, props),
rewardedContentClaimIds: selectRewardContentClaimIds(state),
isResolvingUri: makeSelectIsUriResolving(props.uri)(state),
obscureNsfw: !selectShowNsfw(state),
shortUrl: makeSelectShortUrlForUri(props.uri)(state),

View file

@ -10,7 +10,7 @@ import {
makeSelectTitleForUri,
makeSelectThumbnailForUri,
} from 'lbry-redux';
import { selectBlackListedOutpoints, selectFilteredOutpoints } from 'lbryinc';
import { selectBlackListedOutpoints, selectFilteredOutpoints, selectRewardContentClaimIds } from 'lbryinc';
import { selectShowNsfw } from 'redux/selectors/settings';
import FileListItem from './view';
@ -24,6 +24,7 @@ const select = (state, props) => ({
nsfw: makeSelectClaimIsNsfw(props.uri)(state),
isResolvingUri: makeSelectIsUriResolving(props.uri)(state),
obscureNsfw: !selectShowNsfw(state),
rewardedContentClaimIds: selectRewardContentClaimIds(state),
shortUrl: makeSelectShortUrlForUri(props.uri)(state),
title: makeSelectTitleForUri(props.uri)(state),
thumbnail: makeSelectThumbnailForUri(props.uri)(state),

View file

@ -70,6 +70,7 @@ class FileListItem extends React.PureComponent {
obscureNsfw,
onPress,
navigation,
rewardedContentClaimIds,
thumbnail,
hideChannel,
onLongPress,
@ -82,12 +83,21 @@ class FileListItem extends React.PureComponent {
const isResolving = !fileInfo && isResolvingUri;
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) {
name = claim.name;
signingChannel = claim.signing_channel;
channel = signingChannel ? signingChannel.name : null;
height = claim.height;
isRewardContent = rewardedContentClaimIds.includes(claim.claim_id);
channelClaimId = signingChannel ? signingChannel.claim_id : null;
fullChannelUri = channelClaimId ? `${channel}#${channelClaimId}` : channel;
shortChannelUri = signingChannel ? signingChannel.short_url : null;
@ -150,9 +160,12 @@ class FileListItem extends React.PureComponent {
)}
{(title || name) && (
<View style={fileListStyle.titleContainer}>
<Text style={featuredResult ? fileListStyle.featuredTitle : fileListStyle.title}>
{this.formatTitle(title) || this.formatTitle(name)}
</Text>
{isRewardContent && <Icon style={fileListStyle.rewardIcon} name="award" size={12} />}
</View>
)}
{channel && !hideChannel && (
<Link

View file

@ -43,8 +43,8 @@ class AboutPage extends React.PureComponent {
const { pushDrawerStack, setPlayerVisible } = this.props;
pushDrawerStack();
setPlayerVisible();
NativeModules.Firebase.setCurrentScreen('About');
NativeModules.Firebase.setCurrentScreen('About').then(result => {
if (NativeModules.VersionInfo) {
NativeModules.VersionInfo.getAppVersion().then(version => {
this.setState({ appVersion: version });
@ -60,6 +60,7 @@ class AboutPage extends React.PureComponent {
lbryId: info.installation_id,
});
});
});
if (!this.props.accessToken) this.props.fetchAccessToken();
};

View file

@ -70,6 +70,7 @@ class FilePage extends React.PureComponent {
mediaLoaded: false,
pageSuspended: false,
relatedContentY: 0,
sendTipStarted: false,
showDescription: false,
showImageViewer: false,
showWebView: false,
@ -503,7 +504,7 @@ class FilePage extends React.PureComponent {
return;
}
const suffix = 'credit' + (tipAmount === 1 ? '' : 's');
const suffix = 'credit' + (parseInt(tipAmount, 10) === 1 ? '' : 's');
Alert.alert(
'Send tip',
`Are you sure you want to tip ${tipAmount} ${suffix}?`,
@ -512,9 +513,11 @@ class FilePage extends React.PureComponent {
{
text: 'Yes',
onPress: () => {
this.setState({ sendTipStarted: true }, () =>
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>
{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>
@ -953,16 +957,19 @@ class FilePage extends React.PureComponent {
<View style={filePageStyle.row}>
<View style={filePageStyle.amountRow}>
<TextInput
editable={!this.state.sendTipStarted}
ref={ref => (this.tipAmountInput = ref)}
onChangeText={value => this.setState({ tipAmount: value })}
underlineColorAndroid={Colors.NextLbryGreen}
keyboardType={'numeric'}
placeholder={'0'}
value={this.state.tipAmount}
selectTextOnFocus
style={[filePageStyle.input, filePageStyle.tipAmountInput]}
/>
<Text style={[filePageStyle.text, filePageStyle.currency]}>LBC</Text>
</View>
{this.state.sendTipStarted && <ActivityIndicator size={'small'} color={Colors.NextLbryGreen} />}
<Link
style={[filePageStyle.link, filePageStyle.cancelTipLink]}
text={'Cancel'}
@ -971,7 +978,7 @@ class FilePage extends React.PureComponent {
<Button
text={'Send a tip'}
style={[filePageStyle.button, filePageStyle.sendButton]}
disabled={!canSendTip}
disabled={!canSendTip || this.state.sendTipStarted}
onPress={this.handleSendTip}
/>
</View>

View file

@ -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

View file

@ -162,8 +162,8 @@ class PublishPage extends React.PureComponent {
const { pushDrawerStack, setPlayerVisible, navigation } = this.props;
pushDrawerStack();
setPlayerVisible();
NativeModules.Firebase.setCurrentScreen('Publish');
NativeModules.Firebase.setCurrentScreen('Publish').then(result => {
NativeModules.Gallery.canUseCamera().then(canUseCamera => this.setState({ canUseCamera }));
NativeModules.Gallery.getThumbnailPath().then(thumbnailPath => this.setState({ thumbnailPath }));
this.setState(
@ -182,6 +182,7 @@ class PublishPage extends React.PureComponent {
this.prepareEdit(claimToEdit);
}
}
});
};
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
let uri;
try {
uri = buildURI({ contentName: name, channelName });
uri = buildURI({ claimName: name, channelName });
} catch (e) {
// something wrong with channel or name
}
@ -256,7 +257,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);

View file

@ -37,8 +37,7 @@ class SearchPage extends React.PureComponent {
const { pushDrawerStack, setPlayerVisible, query, search } = this.props;
pushDrawerStack();
setPlayerVisible();
NativeModules.Firebase.setCurrentScreen('Search');
NativeModules.Firebase.setCurrentScreen('Search').then(result => {
const searchQuery = query || this.getSearchQuery();
if (searchQuery && searchQuery.trim().length > 0) {
this.setState({
@ -47,6 +46,7 @@ class SearchPage extends React.PureComponent {
});
search(searchQuery);
}
});
};
componentDidMount() {

View file

@ -23,9 +23,9 @@ class TransactionHistoryPage extends React.PureComponent {
const { fetchTransactions, pushDrawerStack, setPlayerVisible } = this.props;
pushDrawerStack();
setPlayerVisible();
NativeModules.Firebase.setCurrentScreen('Transaction History');
NativeModules.Firebase.setCurrentScreen('Transaction History').then(result => {
fetchTransactions();
});
};
componentDidMount() {

View file

@ -203,7 +203,7 @@ const discoverStyle = StyleSheet.create({
justifyContent: 'space-between',
},
rewardIcon: {
color: Colors.Red,
color: Colors.NextLbryGreen,
flex: 0.1,
textAlign: 'right',
marginTop: 6,

View file

@ -105,6 +105,16 @@ const fileListStyle = StyleSheet.create({
alignItems: 'center',
justifyContent: 'center',
},
titleContainer: {
flexDirection: 'row',
marginRight: 16,
},
rewardIcon: {
color: Colors.NextLbryGreen,
textAlign: 'right',
marginLeft: 4,
marginTop: 4,
},
});
export default fileListStyle;

View file

@ -358,8 +358,9 @@ const filePageStyle = StyleSheet.create({
fontSize: 14,
},
rewardIcon: {
color: Colors.White,
marginRight: 8,
color: Colors.NextLbryGreen,
marginTop: -8,
marginLeft: 8,
},
backButton: {
position: 'absolute',