From a22345219f650f0963ab8d13c6f09840ea0f41de Mon Sep 17 00:00:00 2001 From: Thomas Zarebczan Date: Mon, 11 Feb 2019 23:18:43 -0500 Subject: [PATCH] review fixes Removed local settings storage. Value will be reset when switching back and forth. --- src/renderer/constants/settings.js | 1 - src/renderer/page/settings/index.js | 1 - src/renderer/page/settings/view.jsx | 10 +++++----- src/renderer/redux/reducers/settings.js | 5 ----- 4 files changed, 5 insertions(+), 12 deletions(-) diff --git a/src/renderer/constants/settings.js b/src/renderer/constants/settings.js index e4c940f64..a00c97a9b 100644 --- a/src/renderer/constants/settings.js +++ b/src/renderer/constants/settings.js @@ -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'; diff --git a/src/renderer/page/settings/index.js b/src/renderer/page/settings/index.js index 4c4051e5a..6d178b368 100644 --- a/src/renderer/page/settings/index.js +++ b/src/renderer/page/settings/index.js @@ -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 => ({ diff --git a/src/renderer/page/settings/view.jsx b/src/renderer/page/settings/view.jsx index 442e57380..8b7b8ecf9 100644 --- a/src/renderer/page/settings/view.jsx +++ b/src/renderer/page/settings/view.jsx @@ -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 { } 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 { 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 { checked={!disableMaxKeyFee} onChange={() => { this.onKeyFeeDisableChange(false); - this.onKeyFeeChange(localMaxKeyFee); + this.onKeyFeeChange(defaultMaxKeyFee); }} postfix={__('Choose limit')} /> @@ -239,7 +237,9 @@ class SettingsPage extends React.PureComponent { 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 + } /> )} diff --git a/src/renderer/redux/reducers/settings.js b/src/renderer/redux/reducers/settings.js index 49ded0603..e61542429 100644 --- a/src/renderer/redux/reducers/settings.js +++ b/src/renderer/redux/reducers/settings.js @@ -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