review fixes
Removed local settings storage. Value will be reset when switching back and forth.
This commit is contained in:
parent
50131c6f58
commit
a22345219f
4 changed files with 5 additions and 12 deletions
|
@ -17,4 +17,3 @@ export const AUTOPLAY = 'autoplay';
|
||||||
export const RESULT_COUNT = 'resultCount';
|
export const RESULT_COUNT = 'resultCount';
|
||||||
export const OS_NOTIFICATIONS_ENABLED = 'osNotificationsEnabled';
|
export const OS_NOTIFICATIONS_ENABLED = 'osNotificationsEnabled';
|
||||||
export const AUTO_DOWNLOAD = 'autoDownload';
|
export const AUTO_DOWNLOAD = 'autoDownload';
|
||||||
export const LOCAL_MAX_KEY_FEE = 'localMaxKeyFee';
|
|
||||||
|
|
|
@ -31,7 +31,6 @@ const select = state => ({
|
||||||
walletEncrypted: selectWalletIsEncrypted(state),
|
walletEncrypted: selectWalletIsEncrypted(state),
|
||||||
osNotificationsEnabled: selectosNotificationsEnabled(state),
|
osNotificationsEnabled: selectosNotificationsEnabled(state),
|
||||||
autoDownload: makeSelectClientSetting(settings.AUTO_DOWNLOAD)(state),
|
autoDownload: makeSelectClientSetting(settings.AUTO_DOWNLOAD)(state),
|
||||||
localMaxKeyFee: makeSelectClientSetting(settings.LOCAL_MAX_KEY_FEE)(state),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const perform = dispatch => ({
|
const perform = dispatch => ({
|
||||||
|
|
|
@ -39,7 +39,6 @@ type Props = {
|
||||||
updateWalletStatus: () => void,
|
updateWalletStatus: () => void,
|
||||||
walletEncrypted: boolean,
|
walletEncrypted: boolean,
|
||||||
osNotificationsEnabled: boolean,
|
osNotificationsEnabled: boolean,
|
||||||
localMaxKeyFee: Price,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
type State = {
|
type State = {
|
||||||
|
@ -87,7 +86,6 @@ class SettingsPage extends React.PureComponent<Props, State> {
|
||||||
}
|
}
|
||||||
|
|
||||||
onKeyFeeChange(newValue: Price) {
|
onKeyFeeChange(newValue: Price) {
|
||||||
this.props.setClientSetting(SETTINGS.LOCAL_MAX_KEY_FEE, newValue);
|
|
||||||
this.setDaemonSetting('max_key_fee', newValue);
|
this.setDaemonSetting('max_key_fee', newValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -172,12 +170,12 @@ class SettingsPage extends React.PureComponent<Props, State> {
|
||||||
walletEncrypted,
|
walletEncrypted,
|
||||||
osNotificationsEnabled,
|
osNotificationsEnabled,
|
||||||
autoDownload,
|
autoDownload,
|
||||||
localMaxKeyFee,
|
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
const noDaemonSettings = !daemonSettings || Object.keys(daemonSettings).length === 0;
|
const noDaemonSettings = !daemonSettings || Object.keys(daemonSettings).length === 0;
|
||||||
const isDarkModeEnabled = currentTheme === 'dark';
|
const isDarkModeEnabled = currentTheme === 'dark';
|
||||||
|
|
||||||
|
const defaultMaxKeyFee = { currency: 'USD', amount: 50 };
|
||||||
const disableMaxKeyFee = !(daemonSettings && daemonSettings.max_key_fee);
|
const disableMaxKeyFee = !(daemonSettings && daemonSettings.max_key_fee);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -229,7 +227,7 @@ class SettingsPage extends React.PureComponent<Props, State> {
|
||||||
checked={!disableMaxKeyFee}
|
checked={!disableMaxKeyFee}
|
||||||
onChange={() => {
|
onChange={() => {
|
||||||
this.onKeyFeeDisableChange(false);
|
this.onKeyFeeDisableChange(false);
|
||||||
this.onKeyFeeChange(localMaxKeyFee);
|
this.onKeyFeeChange(defaultMaxKeyFee);
|
||||||
}}
|
}}
|
||||||
postfix={__('Choose limit')}
|
postfix={__('Choose limit')}
|
||||||
/>
|
/>
|
||||||
|
@ -239,7 +237,9 @@ class SettingsPage extends React.PureComponent<Props, State> {
|
||||||
label="Max purchase price"
|
label="Max purchase price"
|
||||||
min={0}
|
min={0}
|
||||||
onChange={this.onKeyFeeChange}
|
onChange={this.onKeyFeeChange}
|
||||||
price={daemonSettings.max_key_fee ? daemonSettings.max_key_fee : localMaxKeyFee}
|
price={
|
||||||
|
daemonSettings.max_key_fee ? daemonSettings.max_key_fee : defaultMaxKeyFee
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -10,11 +10,6 @@ function getLocalStorageSetting(setting, fallback) {
|
||||||
const reducers = {};
|
const reducers = {};
|
||||||
const defaultState = {
|
const defaultState = {
|
||||||
clientSettings: {
|
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]: getLocalStorageSetting(
|
||||||
SETTINGS.INSTANT_PURCHASE_ENABLED,
|
SETTINGS.INSTANT_PURCHASE_ENABLED,
|
||||||
false
|
false
|
||||||
|
|
Loading…
Reference in a new issue