added show images toggle in settings screen

This commit is contained in:
Sadaqat Ali 2022-08-12 21:39:22 +05:00
parent 1b58c54565
commit 607c6f953c
4 changed files with 30 additions and 2 deletions

View File

@ -248,7 +248,8 @@
},
"feedback_success": "Email successfully open",
"feedback_fail": "Email client could not open",
"server_fail": "Server not available"
"server_fail": "Server not available",
"show_imgs": "Show images"
},
"voters": {
"voters_info": "Voters Info",

View File

@ -0,0 +1,5 @@
const SHOW_HIDE_IMGS = 'show_hide_images';
export default {
SHOW_HIDE_IMGS,
};

View File

@ -40,6 +40,7 @@ import {
setColorTheme,
setIsBiometricEnabled,
setEncryptedUnlockPin,
setHidePostsThumbnails,
} from '../../../redux/actions/applicationActions';
import { toastNotification } from '../../../redux/actions/uiAction';
import { setPushToken, getNodes } from '../../../providers/ecency/ecency';
@ -50,6 +51,8 @@ import { removeOtherAccount, updateCurrentAccount } from '../../../redux/actions
// Constants
import { VALUE as CURRENCY_VALUE } from '../../../constants/options/currency';
import { VALUE as LANGUAGE_VALUE } from '../../../constants/options/language';
import settingsTypes from '../../../constants/settingsTypes';
// Utilities
import { sendEmail } from '../../../utils/sendEmail';
@ -199,7 +202,7 @@ class SettingsContainer extends Component {
};
_handleToggleChanged = (action, actionType) => {
const { dispatch } = this.props;
const { dispatch, isHideImages } = this.props;
switch (actionType) {
case 'notification':
@ -243,6 +246,9 @@ class SettingsContainer extends Component {
}),
);
break;
case settingsTypes.SHOW_HIDE_IMGS:
dispatch(setHidePostsThumbnails(!isHideImages));
break;
default:
break;
}
@ -481,6 +487,7 @@ const mapStateToProps = (state) => ({
username: state.account.currentAccount && state.account.currentAccount.name,
currentAccount: state.account.currentAccount,
otherAccounts: state.account.otherAccounts,
isHideImages: state.application.hidePostsThumbnails,
});
export default injectIntl(connect(mapStateToProps)(SettingsContainer));

View File

@ -17,6 +17,7 @@ import { BasicHeader, SettingsItem, CollapsibleCard } from '../../../components'
// Styles
import styles from './settingsStyles';
import settingsTypes from '../../../constants/settingsTypes';
const SettingsScreen = ({
handleOnChange,
@ -41,6 +42,7 @@ const SettingsScreen = ({
voteNotification,
handleOnButtonPress,
isLoading,
isHideImages,
}) => {
return (
<Fragment>
@ -134,6 +136,19 @@ const SettingsScreen = ({
handleOnChange={handleOnChange}
/>
<SettingsItem
title={intl.formatMessage({
id: 'settings.show_imgs',
})}
text={intl.formatMessage({
id: 'settings.show_imgs',
})}
type="toggle"
actionType={settingsTypes.SHOW_HIDE_IMGS}
handleOnChange={handleOnChange}
isOn={!isHideImages}
/>
{!!isLoggedIn && (
<SettingsItem
title={intl.formatMessage({