fix states and channel edit errors

This commit is contained in:
Akinwale Ariwodola 2019-09-24 13:05:38 +01:00
parent 4ff4f00a33
commit c08d5879fb
3 changed files with 19 additions and 18 deletions

View file

@ -331,14 +331,6 @@ class AppWithNavigationState extends React.Component {
// get user settings after email verification // get user settings after email verification
this.getUserSettings(); this.getUserSettings();
// upon successful email verification, do wallet sync (if password has been set)
// don't need to do this anymore...
/* NativeModules.UtilityModule.getSecureValue(Constants.KEY_FIRST_RUN_PASSWORD).then(walletPassword => {
if (walletPassword && walletPassword.trim().length > 0) {
dispatch(doGetSync(walletPassword));
}
}); */
} }
} }

View file

@ -534,10 +534,12 @@ export default class ChannelCreator extends React.PureComponent {
}; };
showChannelList = () => { showChannelList = () => {
const { popDrawerStack } = this.props; const { drawerStack, popDrawerStack } = this.props;
if (drawerStack[drawerStack.length - 1].route === Constants.DRAWER_ROUTE_CHANNEL_CREATOR_FORM) {
popDrawerStack(); popDrawerStack();
this.resetChannelCreator(); }
this.setState({ currentPhase: Constants.PHASE_LIST }); this.setState({ currentPhase: Constants.PHASE_LIST });
this.resetChannelCreator();
}; };
resetChannelCreator = () => { resetChannelCreator = () => {
@ -606,6 +608,7 @@ export default class ChannelCreator extends React.PureComponent {
this.setState({ this.setState({
claimId: channel.claim_id, claimId: channel.claim_id,
currentPhase: Constants.PHASE_CREATE, currentPhase: Constants.PHASE_CREATE,
displayName: value && value.title ? value.title : channel.name.substring(1),
editMode: true, editMode: true,
coverImageUrl: value && value.cover ? value.cover.url : null, coverImageUrl: value && value.cover ? value.cover.url : null,
currentChannelName: channel.name.substring(1), currentChannelName: channel.name.substring(1),
@ -864,7 +867,7 @@ export default class ChannelCreator extends React.PureComponent {
source={{ uri: thumbnailUrl }} source={{ uri: thumbnailUrl }}
/> />
)} )}
{thumbnailUrl !== null && thumbnailUrl.trim().length === 0 && newChannelName.length > 1 && ( {(thumbnailUrl === null || thumbnailUrl.trim().length === 0) && newChannelName.length > 1 && (
<Text style={channelIconStyle.autothumbCharacter}> <Text style={channelIconStyle.autothumbCharacter}>
{newChannelName.substring(0, 1).toUpperCase()} {newChannelName.substring(0, 1).toUpperCase()}
</Text> </Text>

View file

@ -199,6 +199,9 @@ class PublishPage extends React.PureComponent {
vanityUrlSet = false; vanityUrlSet = false;
if (navigation.state.params) { if (navigation.state.params) {
const { displayForm, editMode, claimToEdit, vanityUrl } = navigation.state.params; const { displayForm, editMode, claimToEdit, vanityUrl } = navigation.state.params;
console.log('editMode=' + editMode);
console.log('***claimToEdit***');
console.log(claimToEdit);
if (editMode) { if (editMode) {
this.prepareEdit(claimToEdit); this.prepareEdit(claimToEdit);
isEditMode = true; isEditMode = true;
@ -220,10 +223,8 @@ class PublishPage extends React.PureComponent {
// replace name with the specified vanity URL if there was one in the pending state // replace name with the specified vanity URL if there was one in the pending state
this.setState({ name: this.state.vanityUrl }); this.setState({ name: this.state.vanityUrl });
} }
this.setState({ currentPhase: Constants.PHASE_DETAILS });
} else {
this.setState({ currentPhase: Constants.PHASE_SELECTOR });
} }
this.setState({ currentPhase: isEditMode || hasFormState ? Constants.PHASE_DETAILS : Constants.PHASE_SELECTOR });
}); });
}; };
@ -384,10 +385,11 @@ class PublishPage extends React.PureComponent {
}; };
handlePublishSuccess = data => { handlePublishSuccess = data => {
const { navigation, notify } = this.props; const { clearPublishFormState, navigation, notify } = this.props;
notify({ notify({
message: `Your content was successfully published to ${this.state.uri}. It will be available in a few mintues.`, message: `Your content was successfully published to ${this.state.uri}. It will be available in a few mintues.`,
}); });
clearPublishFormState();
navigation.navigate({ routeName: Constants.DRAWER_ROUTE_PUBLISHES, params: { publishSuccess: true } }); navigation.navigate({ routeName: Constants.DRAWER_ROUTE_PUBLISHES, params: { publishSuccess: true } });
}; };
@ -426,6 +428,7 @@ class PublishPage extends React.PureComponent {
updatePublishFormState({ currentMedia: media, name: newName }); updatePublishFormState({ currentMedia: media, name: newName });
this.setState( this.setState(
{ {
publishStarted: false,
currentMedia: media, currentMedia: media,
title: null, // no title autogeneration (user will fill this in) title: null, // no title autogeneration (user will fill this in)
name: newName, name: newName,
@ -443,7 +446,7 @@ class PublishPage extends React.PureComponent {
}; };
showSelector() { showSelector() {
const { updatePublishForm } = this.props; const { clearPublishFormState, updatePublishForm } = this.props;
this.setState( this.setState(
{ {
@ -485,6 +488,7 @@ class PublishPage extends React.PureComponent {
vanityUrlSet: false, vanityUrlSet: false,
}, },
() => { () => {
clearPublishFormState();
// reset thumbnail // reset thumbnail
updatePublishForm({ thumbnail: null }); updatePublishForm({ thumbnail: null });
} }
@ -605,6 +609,7 @@ class PublishPage extends React.PureComponent {
{ {
currentThumbnailUri: null, currentThumbnailUri: null,
updatingThumbnailUri: false, updatingThumbnailUri: false,
publishStarted: false,
currentPhase: Constants.PHASE_DETAILS, currentPhase: Constants.PHASE_DETAILS,
showCameraOverlay: false, showCameraOverlay: false,
videoRecordingMode: false, videoRecordingMode: false,
@ -629,6 +634,7 @@ class PublishPage extends React.PureComponent {
{ {
currentPhase: Constants.PHASE_DETAILS, currentPhase: Constants.PHASE_DETAILS,
currentThumbnailUri: null, currentThumbnailUri: null,
publishStarted: false,
updatingThumbnailUri: false, updatingThumbnailUri: false,
showCameraOverlay: false, showCameraOverlay: false,
videoRecordingMode: false, videoRecordingMode: false,
@ -823,7 +829,7 @@ class PublishPage extends React.PureComponent {
: ''; : '';
const licenseUrl = LICENSES.CC_LICENSES.reduce((value, item) => { const licenseUrl = LICENSES.CC_LICENSES.reduce((value, item) => {
if (typeof value === 'object') { if (typeof value === 'object') {
value = ''; value = license === value.value ? item.url : '';
} }
if (license === item.value) { if (license === item.value) {
value = item.url; value = item.url;