fixed weird confilit bugs

This commit is contained in:
u-e 2019-03-20 23:28:59 +03:00
parent 86de8fe00e
commit 51cbd46f7d
3 changed files with 32 additions and 40 deletions

View File

@ -34,6 +34,7 @@ class SettingsItemView extends PureComponent {
isOn, isOn,
actionType, actionType,
defaultText, defaultText,
handleOnButtonPress,
} = this.props; } = this.props;
switch (type) { switch (type) {
@ -64,7 +65,7 @@ class SettingsItemView extends PureComponent {
case 'button': case 'button':
return ( return (
<TextButton <TextButton
onPress={() => handleOnChange(null, type, actionType)} onPress={() => handleOnButtonPress(actionType)}
textStyle={styles.textStyle} textStyle={styles.textStyle}
style={styles.textButton} style={styles.textButton}
text={text} text={text}

View File

@ -90,10 +90,6 @@ class SettingsContainer extends Component {
setNsfw2DB(action); setNsfw2DB(action);
break; break;
case 'feedback':
this._handleSendFeedback();
break;
default: default:
break; break;
} }
@ -180,13 +176,17 @@ class SettingsContainer extends Component {
this._setPushToken(); this._setPushToken();
}; };
_handleButtonPress = (action, actionType) => { _handleButtonPress = (actionType) => {
const { dispatch, setPinCodeState } = this.props; const { dispatch, setPinCodeState } = this.props;
switch (actionType) { switch (actionType) {
case 'pincode': case 'pincode':
setPinCodeState({ isReset: true }); setPinCodeState({ isReset: true });
dispatch(openPinCodeModal()); dispatch(openPinCodeModal());
break; break;
case 'feedback':
this._handleSendFeedback();
break;
default: default:
break; break;
} }
@ -202,10 +202,6 @@ class SettingsContainer extends Component {
this._handleToggleChanged(action, actionType); this._handleToggleChanged(action, actionType);
break; break;
case 'button':
this._handleButtonPress(action, actionType);
break;
default: default:
break; break;
} }
@ -229,18 +225,18 @@ class SettingsContainer extends Component {
}); });
} }
}; };
_handleSendFeedback = async () => { _handleSendFeedback = async () => {
const { dispatch, intl } = this.props; const { dispatch, intl } = this.props;
let message; let message;
await sendEmail( await sendEmail(
'bug@esteem.app', 'bug@esteem.app',
'Feedback/Bug report', 'Feedback/Bug report',
`Write your message here! `Write your message here!
App version: ${VersionNumber.buildVersion}
Platform: ${Platform.OS === 'ios' ? 'IOS' : 'Android'} App version: ${VersionNumber.buildVersion}
Device: ${DeviceInfo.getDeviceName()}`, Platform: ${Platform.OS === 'ios' ? 'IOS' : 'Android'}`,
) )
.then(() => { .then(() => {
message = 'settings.feedback_success'; message = 'settings.feedback_success';
@ -249,7 +245,7 @@ class SettingsContainer extends Component {
message = 'settings.feedback_fail'; message = 'settings.feedback_fail';
}); });
if (message) { if (message) {
dispatch( dispatch(
toastNotification( toastNotification(
intl.formatMessage({ intl.formatMessage({
@ -267,6 +263,7 @@ class SettingsContainer extends Component {
<SettingsScreen <SettingsScreen
serverList={serverList} serverList={serverList}
handleOnChange={this._handleOnChange} handleOnChange={this._handleOnChange}
handleOnButtonPress={this._handleButtonPress}
{...this.props} {...this.props}
/> />
); );

View File

@ -44,6 +44,7 @@ class SettingsScreen extends PureComponent {
selectedCurrency, selectedCurrency,
selectedLanguage, selectedLanguage,
serverList, serverList,
handleOnButtonPress,
} = this.props; } = this.props;
return ( return (
@ -92,9 +93,11 @@ class SettingsScreen extends PureComponent {
})} })}
type="dropdown" type="dropdown"
actionType="nsfw" actionType="nsfw"
options={NSFW.map(item => intl.formatMessage({ options={NSFW.map(item =>
id: item, intl.formatMessage({
}))} id: item,
}),
)}
selectedOptionIndex={parseInt(nsfw, 10)} selectedOptionIndex={parseInt(nsfw, 10)}
handleOnChange={handleOnChange} handleOnChange={handleOnChange}
/> />
@ -118,26 +121,6 @@ class SettingsScreen extends PureComponent {
/> />
{!!isLoggedIn && ( {!!isLoggedIn && (
<Fragment> <Fragment>
<SettingsItem
title={intl.formatMessage({
id: 'settings.pincode',
})}
text={intl.formatMessage({
id: 'settings.reset',
})}
type="button"
actionType="pincode"
handleOnChange={handleOnChange}
/>
<SettingsItem
title={intl.formatMessage({
id: 'settings.send_feedback',
})}
text={intl.formatMessage({
id: 'settings.send',
})}
type="button"
actionType="feedback"
{/* <SettingsItem {/* <SettingsItem
title={intl.formatMessage({ title={intl.formatMessage({
id: 'settings.default_footer', id: 'settings.default_footer',
@ -156,10 +139,21 @@ class SettingsScreen extends PureComponent {
})} })}
type="button" type="button"
actionType="pincode" actionType="pincode"
handleOnChange={handleOnChange} handleOnButtonPress={handleOnButtonPress}
/> />
</Fragment> </Fragment>
)} )}
<SettingsItem
title={intl.formatMessage({
id: 'settings.send_feedback',
})}
text={intl.formatMessage({
id: 'settings.send',
})}
type="button"
actionType="feedback"
handleOnButtonPress={handleOnButtonPress}
/>
</ScrollView> </ScrollView>
</View> </View>
); );