channel creator fixes. fix wallet sync disable / re-enable errors.

This commit is contained in:
Akinwale Ariwodola 2019-09-26 07:25:33 +01:00
parent eebb25dba0
commit 62ac844084
5 changed files with 40 additions and 19 deletions

View file

@ -562,8 +562,8 @@ export default class ChannelCreator extends React.PureComponent {
newChannelBidError: '', newChannelBidError: '',
createChannelError: undefined, createChannelError: undefined,
showCreateChannel: false, showCreateChannel: false,
thumbnailUrl: null, thumbnailUrl: '',
coverImageUrl: null, coverImageUrl: '',
avatarImagePickerOpen: false, avatarImagePickerOpen: false,
coverImagePickerOpen: false, coverImagePickerOpen: false,
@ -914,7 +914,7 @@ export default class ChannelCreator extends React.PureComponent {
<View> <View>
<Text style={channelCreatorStyle.channelAt}>@</Text> <Text style={channelCreatorStyle.channelAt}>@</Text>
<TextInput <TextInput
editable={canSave && !creatingChannel && !updatingChannel} editable={canSave && !editMode && !creatingChannel && !updatingChannel}
style={channelCreatorStyle.channelNameInput} style={channelCreatorStyle.channelNameInput}
value={this.state.newChannelName} value={this.state.newChannelName}
onChangeText={value => this.handleNewChannelNameChange(value, true)} onChangeText={value => this.handleNewChannelNameChange(value, true)}
@ -924,10 +924,15 @@ export default class ChannelCreator extends React.PureComponent {
onBlur={() => this.setState({ channelNameFocused: false })} onBlur={() => this.setState({ channelNameFocused: false })}
/> />
</View> </View>
s
</View> </View>
{newChannelNameError.length > 0 && ( {newChannelNameError.length > 0 && (
<Text style={channelCreatorStyle.inlineError}>{newChannelNameError}</Text> <Text style={channelCreatorStyle.inlineError}>{newChannelNameError}</Text>
)} )}
{editMode && (
<Text style={channelCreatorStyle.helpText}>The channel name cannot be changed while editing.</Text>
)}
<View style={channelCreatorStyle.bidRow}> <View style={channelCreatorStyle.bidRow}>
<Text style={channelCreatorStyle.label}>Deposit</Text> <Text style={channelCreatorStyle.label}>Deposit</Text>
<TextInput <TextInput

View file

@ -80,9 +80,8 @@ class FirstRunScreen extends React.PureComponent {
} }
if (this.state.syncApplyStarted && !syncApplyIsPending) { if (this.state.syncApplyStarted && !syncApplyIsPending) {
this.setState({ syncApplyStarted: false });
if (syncApplyErrorMessage && syncApplyErrorMessage.trim().length > 0) { if (syncApplyErrorMessage && syncApplyErrorMessage.trim().length > 0) {
notify({ message: syncApplyErrorMessage, isError: true }); notify({ message: syncApplyErrorMessage, syncApplyStarted: false, isError: true });
this.setState({ showBottomContainer: true }); this.setState({ showBottomContainer: true });
} else { } else {
// password successfully verified // password successfully verified
@ -236,6 +235,7 @@ class FirstRunScreen extends React.PureComponent {
closeFinalPage() { closeFinalPage() {
// Final page. Let the app know that first run experience is completed. // Final page. Let the app know that first run experience is completed.
this.setState({ syncApplyStarted: false });
if (NativeModules.FirstRun) { if (NativeModules.FirstRun) {
NativeModules.FirstRun.firstRunCompleted(); NativeModules.FirstRun.firstRunCompleted();
} }

View file

@ -68,27 +68,37 @@ class SyncVerifyPage extends React.PureComponent {
); );
} }
setDefaultAccount( setDefaultAccount(
() => { () => this.finishSync(true),
setClientSetting(Constants.SETTING_DEVICE_WALLET_SYNCED, true);
// unlock the wallet
Lbry.account_unlock({ password: this.state.password ? this.state.password : '' })
.then(() => navigation.goBack())
.catch(err =>
notify({ message: 'The wallet could not be unlocked at this time. Please restart the app.' })
);
},
err => { err => {
notify({ // fail silently and still finish
message: this.finishSync();
'The account restore operation could not be completed successfully. Please restart the app and try again.',
});
} }
); );
} }
} }
} }
finishSync = (notifyUnlockFailed = false) => {
const { navigation, notify, setClientSetting } = this.props;
setClientSetting(Constants.SETTING_DEVICE_WALLET_SYNCED, true);
// unlock the wallet (if locked)
Lbry.status().then(status => {
if (status.wallet.is_locked) {
Lbry.account_unlock({ password: this.state.password ? this.state.password : '' })
.then(() => navigation.goBack())
.catch(err => {
if (notifyUnlockFailed) {
notify({ message: 'The wallet could not be unlocked at this time. Please restart the app.' });
}
});
} else {
navigation.goBack();
}
});
};
handleChangeText = text => { handleChangeText = text => {
// save the value to the state email // save the value to the state email
const { onPasswordChanged } = this.props; const { onPasswordChanged } = this.props;

View file

@ -45,6 +45,7 @@ const channelCreatorStyle = StyleSheet.create({
helpText: { helpText: {
fontFamily: 'Inter-UI-Regular', fontFamily: 'Inter-UI-Regular',
fontSize: 12, fontSize: 12,
color: Colors.DescriptionGrey,
}, },
channelTitleInput: { channelTitleInput: {
marginBottom: 4, marginBottom: 4,

View file

@ -436,6 +436,11 @@ const publishStyle = StyleSheet.create({
fontSize: 14, fontSize: 14,
color: Colors.DescriptionGrey, color: Colors.DescriptionGrey,
}, },
helpText: {
fontFamily: 'Inter-UI-Regular',
fontSize: 12,
color: Colors.DescriptionGrey,
},
publishesFooter: { publishesFooter: {
marginTop: 2, marginTop: 2,
marginLeft: 16, marginLeft: 16,