Support 0.31 SDK, vrooom #2277
6 changed files with 26 additions and 13 deletions
|
@ -135,7 +135,7 @@
|
||||||
"yarn": "^1.3"
|
"yarn": "^1.3"
|
||||||
},
|
},
|
||||||
"lbrySettings": {
|
"lbrySettings": {
|
||||||
"lbrynetDaemonVersion": "0.31.0rc5",
|
"lbrynetDaemonVersion": "0.31.0",
|
||||||
"lbrynetDaemonUrlTemplate": "https://github.com/lbryio/lbry/releases/download/vDAEMONVER/lbrynet-OSNAME.zip",
|
"lbrynetDaemonUrlTemplate": "https://github.com/lbryio/lbry/releases/download/vDAEMONVER/lbrynet-OSNAME.zip",
|
||||||
"lbrynetDaemonDir": "static/daemon",
|
"lbrynetDaemonDir": "static/daemon",
|
||||||
"lbrynetDaemonFileName": "lbrynet"
|
"lbrynetDaemonFileName": "lbrynet"
|
||||||
|
|
|
@ -17,3 +17,5 @@ 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 DISABLE_MAX_KEY_FEE = 'disableMaxKeyFee';
|
||||||
|
export const LOCAL_MAX_KEY_FEE = 'localMaxKeyFee';
|
||||||
|
|
|
@ -31,6 +31,8 @@ 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),
|
||||||
|
disableMaxKeyFee: makeSelectClientSetting(settings.DISABLE_MAX_KEY_FEE)(state),
|
||||||
|
localMaxKeyFee: makeSelectClientSetting(settings.LOCAL_MAX_KEY_FEE)(state),
|
||||||
});
|
});
|
||||||
|
|
||||||
const perform = dispatch => ({
|
const perform = dispatch => ({
|
||||||
|
|
|
@ -14,7 +14,6 @@ export type Price = {
|
||||||
|
|
||||||
type DaemonSettings = {
|
type DaemonSettings = {
|
||||||
download_dir: string,
|
download_dir: string,
|
||||||
disable_max_key_fee: boolean,
|
|
||||||
share_usage_data: boolean,
|
share_usage_data: boolean,
|
||||||
max_key_fee?: Price,
|
max_key_fee?: Price,
|
||||||
};
|
};
|
||||||
|
@ -38,6 +37,8 @@ type Props = {
|
||||||
updateWalletStatus: () => void,
|
updateWalletStatus: () => void,
|
||||||
walletEncrypted: boolean,
|
walletEncrypted: boolean,
|
||||||
osNotificationsEnabled: boolean,
|
osNotificationsEnabled: boolean,
|
||||||
|
disableMaxKeyFee: boolean,
|
||||||
|
localMaxKeyFee: Price,
|
||||||
};
|
};
|
||||||
|
|
||||||
type State = {
|
type State = {
|
||||||
|
@ -54,6 +55,7 @@ class SettingsPage extends React.PureComponent<Props, State> {
|
||||||
|
|
||||||
(this: any).onDownloadDirChange = this.onDownloadDirChange.bind(this);
|
(this: any).onDownloadDirChange = this.onDownloadDirChange.bind(this);
|
||||||
(this: any).onKeyFeeChange = this.onKeyFeeChange.bind(this);
|
(this: any).onKeyFeeChange = this.onKeyFeeChange.bind(this);
|
||||||
|
(this: any).onKeyFeeDisableChange = this.onKeyFeeDisableChange.bind(this);
|
||||||
(this: any).onInstantPurchaseMaxChange = this.onInstantPurchaseMaxChange.bind(this);
|
(this: any).onInstantPurchaseMaxChange = this.onInstantPurchaseMaxChange.bind(this);
|
||||||
(this: any).onShowNsfwChange = this.onShowNsfwChange.bind(this);
|
(this: any).onShowNsfwChange = this.onShowNsfwChange.bind(this);
|
||||||
(this: any).onShareDataChange = this.onShareDataChange.bind(this);
|
(this: any).onShareDataChange = this.onShareDataChange.bind(this);
|
||||||
|
@ -84,11 +86,14 @@ 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
onKeyFeeDisableChange(isDisabled: boolean) {
|
onKeyFeeDisableChange(isDisabled: boolean) {
|
||||||
this.setDaemonSetting('disable_max_key_fee', isDisabled);
|
this.props.setClientSetting(SETTINGS.DISABLE_MAX_KEY_FEE, isDisabled);
|
||||||
|
// null is default value passed to clear key fee
|
||||||
|
if (isDisabled) this.setDaemonSetting('max_key_fee', '');
|
||||||
}
|
}
|
||||||
|
|
||||||
onThemeChange(event: SyntheticInputEvent<*>) {
|
onThemeChange(event: SyntheticInputEvent<*>) {
|
||||||
|
@ -138,7 +143,7 @@ class SettingsPage extends React.PureComponent<Props, State> {
|
||||||
this.props.setClientSetting(SETTINGS.OS_NOTIFICATIONS_ENABLED, event.target.checked);
|
this.props.setClientSetting(SETTINGS.OS_NOTIFICATIONS_ENABLED, event.target.checked);
|
||||||
}
|
}
|
||||||
|
|
||||||
setDaemonSetting(name: string, value: boolean | string | Price) {
|
setDaemonSetting(name: string, value: boolean | string | Price | ''): void {
|
||||||
this.props.setDaemonSetting(name, value);
|
this.props.setDaemonSetting(name, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -168,6 +173,8 @@ class SettingsPage extends React.PureComponent<Props, State> {
|
||||||
walletEncrypted,
|
walletEncrypted,
|
||||||
osNotificationsEnabled,
|
osNotificationsEnabled,
|
||||||
autoDownload,
|
autoDownload,
|
||||||
|
disableMaxKeyFee,
|
||||||
|
localMaxKeyFee,
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
const noDaemonSettings = !daemonSettings || Object.keys(daemonSettings).length === 0;
|
const noDaemonSettings = !daemonSettings || Object.keys(daemonSettings).length === 0;
|
||||||
|
@ -210,7 +217,7 @@ class SettingsPage extends React.PureComponent<Props, State> {
|
||||||
<FormField
|
<FormField
|
||||||
type="radio"
|
type="radio"
|
||||||
name="no_max_purchase_limit"
|
name="no_max_purchase_limit"
|
||||||
checked={daemonSettings.disable_max_key_fee}
|
checked={disableMaxKeyFee}
|
||||||
postfix={__('No Limit')}
|
postfix={__('No Limit')}
|
||||||
onChange={() => {
|
onChange={() => {
|
||||||
this.onKeyFeeDisableChange(true);
|
this.onKeyFeeDisableChange(true);
|
||||||
|
@ -219,23 +226,20 @@ class SettingsPage extends React.PureComponent<Props, State> {
|
||||||
<FormField
|
<FormField
|
||||||
type="radio"
|
type="radio"
|
||||||
name="max_purchase_limit"
|
name="max_purchase_limit"
|
||||||
|
checked={!disableMaxKeyFee}
|
||||||
onChange={() => {
|
onChange={() => {
|
||||||
this.onKeyFeeDisableChange(false);
|
this.onKeyFeeDisableChange(false);
|
||||||
|
this.onKeyFeeChange(localMaxKeyFee);
|
||||||
}}
|
}}
|
||||||
checked={!daemonSettings.disable_max_key_fee}
|
|
||||||
postfix={__('Choose limit')}
|
postfix={__('Choose limit')}
|
||||||
/>
|
/>
|
||||||
{!daemonSettings.disable_max_key_fee && (
|
{!disableMaxKeyFee && (
|
||||||
<FormFieldPrice
|
<FormFieldPrice
|
||||||
name="max_key_fee"
|
name="max_key_fee"
|
||||||
label="Max purchase price"
|
label="Max purchase price"
|
||||||
min={0}
|
min={0}
|
||||||
onChange={this.onKeyFeeChange}
|
onChange={this.onKeyFeeChange}
|
||||||
price={
|
price={daemonSettings.max_key_fee ? daemonSettings.max_key_fee : localMaxKeyFee}
|
||||||
daemonSettings.max_key_fee
|
|
||||||
? daemonSettings.max_key_fee
|
|
||||||
: { currency: 'USD', amount: 50 }
|
|
||||||
}
|
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -24,7 +24,7 @@ export function doSetDaemonSetting(key, value) {
|
||||||
return dispatch => {
|
return dispatch => {
|
||||||
const newSettings = {
|
const newSettings = {
|
||||||
key,
|
key,
|
||||||
value,
|
value: value || null,
|
||||||
};
|
};
|
||||||
Lbry.settings_set(newSettings).then(newSettings);
|
Lbry.settings_set(newSettings).then(newSettings);
|
||||||
Lbry.settings_get().then(settings => {
|
Lbry.settings_get().then(settings => {
|
||||||
|
|
|
@ -10,6 +10,11 @@ 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