fix remaining publish bugs

This commit is contained in:
Akinwale Ariwodola 2019-08-12 13:18:47 +01:00
parent f05181898b
commit 1853558215
2 changed files with 49 additions and 4 deletions

View file

@ -37,7 +37,7 @@ export default class ChannelSelector extends React.PureComponent {
}; };
handlePickerValueChange = (itemValue, itemIndex) => { handlePickerValueChange = (itemValue, itemIndex) => {
if (Constants.ITEM_CREATE_A_CHANNEL === itemValue) { if (Constants.ITEM_CREATE_A_CHANNEL === itemValue.name) {
this.setState({ showCreateChannel: true }); this.setState({ showCreateChannel: true });
} else { } else {
this.handleCreateCancel(); this.handleCreateCancel();

View file

@ -109,6 +109,8 @@ class PublishPage extends React.PureComponent {
title: null, title: null,
language: 'en', language: 'en',
license: LICENSES.NONE, license: LICENSES.NONE,
licenseUrl: '',
otherLicenseDescription: '',
mature: false, mature: false,
name: null, name: null,
price: 0, price: 0,
@ -191,6 +193,8 @@ class PublishPage extends React.PureComponent {
description, description,
language, language,
license, license,
licenseUrl,
otherLicenseDescription,
mature, mature,
name, name,
price, price,
@ -219,17 +223,18 @@ class PublishPage extends React.PureComponent {
description: description || '', description: description || '',
language, language,
license, license,
licenseUrl: '', licenseUrl,
otherLicenseDescription: '', otherLicenseDescription,
name: name || undefined, name: name || undefined,
contentIsFree: !priceSet, contentIsFree: !priceSet,
fee: { currency: 'LBC', price }, fee: { currency: 'LBC', amount: price },
uri: uri || undefined, uri: uri || undefined,
channel: CLAIM_VALUES.CHANNEL_ANONYMOUS === channelName ? null : channelName, channel: CLAIM_VALUES.CHANNEL_ANONYMOUS === channelName ? null : channelName,
isStillEditing: false, isStillEditing: false,
claim: { claim: {
value: { value: {
tags, tags,
release_time: Math.round(Date.now() / 1000), // set now as the release time
}, },
}, },
}; };
@ -310,6 +315,8 @@ class PublishPage extends React.PureComponent {
title: null, title: null,
language: 'en', language: 'en',
license: LICENSES.NONE, license: LICENSES.NONE,
licenseUrl: '',
otherLicenseDescription: '',
name: null, name: null,
price: 0, price: 0,
uri: null, uri: null,
@ -541,6 +548,34 @@ class PublishPage extends React.PureComponent {
this.setState({ description }); this.setState({ description });
}; };
handleLanguageValueChange = language => {
this.setState({ language });
};
handleLicenseValueChange = license => {
const otherLicenseDescription = [LICENSES.COPYRIGHT, LICENSES.OTHER].includes(license)
? this.state.otherLicenseDescription
: '';
this.setState({
otherLicenseDescription,
license,
licenseUrl: LICENSES.CC_LICENSES.reduce((value, item) => {
if (typeof value === 'object') {
value = '';
}
if (license === item.value) {
value = item.url;
}
return value;
}),
});
};
handleChangeLicenseDescription = otherLicenseDescription => {
this.setState({ otherLicenseDescription });
};
render() { render() {
const { balance, navigation, notify, publishFormValues } = this.props; const { balance, navigation, notify, publishFormValues } = this.props;
const { canUseCamera, currentPhase, galleryThumbnailsChecked, thumbnailPath, videos } = this.state; const { canUseCamera, currentPhase, galleryThumbnailsChecked, thumbnailPath, videos } = this.state;
@ -779,6 +814,16 @@ class PublishPage extends React.PureComponent {
<Picker.Item label={'Copyrighted...'} value={LICENSES.COPYRIGHT} key={LICENSES.COPYRIGHT} /> <Picker.Item label={'Copyrighted...'} value={LICENSES.COPYRIGHT} key={LICENSES.COPYRIGHT} />
<Picker.Item label={'Other...'} value={LICENSES.OTHER} key={LICENSES.OTHER} /> <Picker.Item label={'Other...'} value={LICENSES.OTHER} key={LICENSES.OTHER} />
</Picker> </Picker>
{[LICENSES.COPYRIGHT, LICENSES.OTHER].includes(this.state.license) && (
<TextInput
placeholder={'License description'}
style={publishStyle.inputText}
underlineColorAndroid={Colors.NextLbryGreen}
numberOfLines={1}
value={this.state.otherLicenseDescription}
onChangeText={this.handleChangeLicenseDescription}
/>
)}
</View> </View>
</View> </View>
)} )}