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", "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",

View file

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

View file

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

View file

@ -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) && (
<Text style={featuredResult ? fileListStyle.featuredTitle : fileListStyle.title}> <View style={fileListStyle.titleContainer}>
{this.formatTitle(title) || this.formatTitle(name)} <Text style={featuredResult ? fileListStyle.featuredTitle : fileListStyle.title}>
</Text> {this.formatTitle(title) || this.formatTitle(name)}
</Text>
{isRewardContent && <Icon style={fileListStyle.rewardIcon} name="award" size={12} />}
</View>
)} )}
{channel && !hideChannel && ( {channel && !hideChannel && (
<Link <Link

View file

@ -43,21 +43,22 @@ class AboutPage extends React.PureComponent {
const { pushDrawerStack, setPlayerVisible } = this.props; const { pushDrawerStack, setPlayerVisible } = this.props;
pushDrawerStack(); pushDrawerStack();
setPlayerVisible(); setPlayerVisible();
NativeModules.Firebase.setCurrentScreen('About');
if (NativeModules.VersionInfo) { NativeModules.Firebase.setCurrentScreen('About').then(result => {
NativeModules.VersionInfo.getAppVersion().then(version => { if (NativeModules.VersionInfo) {
this.setState({ appVersion: version }); NativeModules.VersionInfo.getAppVersion().then(version => {
this.setState({ appVersion: version });
});
}
Lbry.version().then(info => {
this.setState({
versionInfo: info,
});
}); });
} Lbry.status().then(info => {
Lbry.version().then(info => { this.setState({
this.setState({ lbryId: info.installation_id,
versionInfo: info, });
});
});
Lbry.status().then(info => {
this.setState({
lbryId: info.installation_id,
}); });
}); });

View file

@ -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: () => {
sendTip(tipAmount, claim.claim_id, false, () => { this.setState({ sendTipStarted: true }, () =>
this.setState({ tipAmount: 0, showTipView: false }); sendTip(tipAmount, claim.claim_id, 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>

View file

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

View file

@ -162,26 +162,27 @@ 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.Gallery.canUseCamera().then(canUseCamera => this.setState({ canUseCamera })); NativeModules.Firebase.setCurrentScreen('Publish').then(result => {
NativeModules.Gallery.getThumbnailPath().then(thumbnailPath => this.setState({ thumbnailPath })); NativeModules.Gallery.canUseCamera().then(canUseCamera => this.setState({ canUseCamera }));
this.setState( NativeModules.Gallery.getThumbnailPath().then(thumbnailPath => this.setState({ thumbnailPath }));
{ this.setState(
loadingVideos: true, {
}, loadingVideos: true,
() => { },
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
if (navigation.state.params) { if (navigation.state.params) {
const { editMode, claimToEdit } = navigation.state.params; const { editMode, claimToEdit } = navigation.state.params;
if (editMode) { if (editMode) {
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);

View file

@ -37,16 +37,16 @@ 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({ currentQuery: searchQuery,
currentQuery: searchQuery, currentUri: isURIValid(searchQuery) ? normalizeURI(searchQuery) : null,
currentUri: isURIValid(searchQuery) ? normalizeURI(searchQuery) : null, });
}); search(searchQuery);
search(searchQuery); }
} });
}; };
componentDidMount() { componentDidMount() {

View file

@ -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() {

View file

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

View file

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

View file

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