review fixes

Removed local settings storage. Value will be reset when switching back and forth.
This commit is contained in:
Thomas Zarebczan 2019-02-11 23:18:43 -05:00
parent 50131c6f58
commit a22345219f
4 changed files with 5 additions and 12 deletions

View file

@ -17,4 +17,3 @@ export const AUTOPLAY = 'autoplay';
export const RESULT_COUNT = 'resultCount';
export const OS_NOTIFICATIONS_ENABLED = 'osNotificationsEnabled';
export const AUTO_DOWNLOAD = 'autoDownload';
export const LOCAL_MAX_KEY_FEE = 'localMaxKeyFee';

View file

@ -31,7 +31,6 @@ const select = state => ({
walletEncrypted: selectWalletIsEncrypted(state),
osNotificationsEnabled: selectosNotificationsEnabled(state),
autoDownload: makeSelectClientSetting(settings.AUTO_DOWNLOAD)(state),
localMaxKeyFee: makeSelectClientSetting(settings.LOCAL_MAX_KEY_FEE)(state),
});
const perform = dispatch => ({

View file

@ -39,7 +39,6 @@ type Props = {
updateWalletStatus: () => void,
walletEncrypted: boolean,
osNotificationsEnabled: boolean,
localMaxKeyFee: Price,
};
type State = {
@ -87,7 +86,6 @@ class SettingsPage extends React.PureComponent<Props, State> {
}
onKeyFeeChange(newValue: Price) {
this.props.setClientSetting(SETTINGS.LOCAL_MAX_KEY_FEE, newValue);
this.setDaemonSetting('max_key_fee', newValue);
}
@ -172,12 +170,12 @@ class SettingsPage extends React.PureComponent<Props, State> {
walletEncrypted,
osNotificationsEnabled,
autoDownload,
localMaxKeyFee,
} = this.props;
const noDaemonSettings = !daemonSettings || Object.keys(daemonSettings).length === 0;
const isDarkModeEnabled = currentTheme === 'dark';
const defaultMaxKeyFee = { currency: 'USD', amount: 50 };
const disableMaxKeyFee = !(daemonSettings && daemonSettings.max_key_fee);
return (
@ -229,7 +227,7 @@ class SettingsPage extends React.PureComponent<Props, State> {
checked={!disableMaxKeyFee}
onChange={() => {
this.onKeyFeeDisableChange(false);
this.onKeyFeeChange(localMaxKeyFee);
this.onKeyFeeChange(defaultMaxKeyFee);
}}
postfix={__('Choose limit')}
/>
@ -239,7 +237,9 @@ class SettingsPage extends React.PureComponent<Props, State> {
label="Max purchase price"
min={0}
onChange={this.onKeyFeeChange}
price={daemonSettings.max_key_fee ? daemonSettings.max_key_fee : localMaxKeyFee}
price={
daemonSettings.max_key_fee ? daemonSettings.max_key_fee : defaultMaxKeyFee
}
/>
)}
</div>

View file

@ -10,11 +10,6 @@ function getLocalStorageSetting(setting, fallback) {
const reducers = {};
const defaultState = {
clientSettings: {
[SETTINGS.DISABLE_MAX_KEY_FEE]: getLocalStorageSetting(SETTINGS.DISABLE_MAX_KEY_FEE, false),
[SETTINGS.LOCAL_MAX_KEY_FEE]: getLocalStorageSetting(SETTINGS.LOCAL_MAX_KEY_FEE, {
currency: 'USD',
amount: 50.0,
}),
[SETTINGS.INSTANT_PURCHASE_ENABLED]: getLocalStorageSetting(
SETTINGS.INSTANT_PURCHASE_ENABLED,
false