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

View file

@ -199,6 +199,9 @@ class PublishPage extends React.PureComponent {
vanityUrlSet = false;
if (navigation.state.params) {
const { displayForm, editMode, claimToEdit, vanityUrl } = navigation.state.params;
console.log('editMode=' + editMode);
console.log('***claimToEdit***');
console.log(claimToEdit);
if (editMode) {
this.prepareEdit(claimToEdit);
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
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 => {
const { navigation, notify } = this.props;
const { clearPublishFormState, navigation, notify } = this.props;
notify({
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 } });
};
@ -426,6 +428,7 @@ class PublishPage extends React.PureComponent {
updatePublishFormState({ currentMedia: media, name: newName });
this.setState(
{
publishStarted: false,
currentMedia: media,
title: null, // no title autogeneration (user will fill this in)
name: newName,
@ -443,7 +446,7 @@ class PublishPage extends React.PureComponent {
};
showSelector() {
const { updatePublishForm } = this.props;
const { clearPublishFormState, updatePublishForm } = this.props;
this.setState(
{
@ -485,6 +488,7 @@ class PublishPage extends React.PureComponent {
vanityUrlSet: false,
},
() => {
clearPublishFormState();
// reset thumbnail
updatePublishForm({ thumbnail: null });
}
@ -605,6 +609,7 @@ class PublishPage extends React.PureComponent {
{
currentThumbnailUri: null,
updatingThumbnailUri: false,
publishStarted: false,
currentPhase: Constants.PHASE_DETAILS,
showCameraOverlay: false,
videoRecordingMode: false,
@ -629,6 +634,7 @@ class PublishPage extends React.PureComponent {
{
currentPhase: Constants.PHASE_DETAILS,
currentThumbnailUri: null,
publishStarted: false,
updatingThumbnailUri: false,
showCameraOverlay: false,
videoRecordingMode: false,
@ -823,7 +829,7 @@ class PublishPage extends React.PureComponent {
: '';
const licenseUrl = LICENSES.CC_LICENSES.reduce((value, item) => {
if (typeof value === 'object') {
value = '';
value = license === value.value ? item.url : '';
}
if (license === item.value) {
value = item.url;