Support 0.31 SDK, vrooom #2277
6 changed files with 40 additions and 34 deletions
|
@ -135,7 +135,7 @@
|
|||
"yarn": "^1.3"
|
||||
},
|
||||
"lbrySettings": {
|
||||
"lbrynetDaemonVersion": "0.30.4",
|
||||
"lbrynetDaemonVersion": "0.31.0",
|
||||
"lbrynetDaemonUrlTemplate": "https://github.com/lbryio/lbry/releases/download/vDAEMONVER/lbrynet-OSNAME.zip",
|
||||
"lbrynetDaemonDir": "static/daemon",
|
||||
"lbrynetDaemonFileName": "lbrynet"
|
||||
|
|
|
@ -62,7 +62,14 @@ class FileDetails extends PureComponent<Props> {
|
|||
const { description, language, license } = metadata;
|
||||
|
||||
const mediaType = contentType || 'unknown';
|
||||
const downloadPath = fileInfo ? path.normalize(fileInfo.download_path) : null;
|
||||
let downloadPath =
|
||||
fileInfo && fileInfo.download_path ? path.normalize(fileInfo.download_path) : null;
|
||||
let downloadNote;
|
||||
// If the path is blank, file is not avialable. Create path from name so the folder opens on click.
|
||||
if (fileInfo && fileInfo.download_path === null) {
|
||||
downloadPath = `${fileInfo.download_directory}/${fileInfo.file_name}`;
|
||||
downloadNote = 'This file may have been moved or deleted';
|
||||
}
|
||||
|
||||
return (
|
||||
<Fragment>
|
||||
|
@ -99,7 +106,7 @@ class FileDetails extends PureComponent<Props> {
|
|||
<Button
|
||||
button="link"
|
||||
onClick={() => openFolder(downloadPath)}
|
||||
label={downloadPath}
|
||||
label={downloadNote || downloadPath}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
|
|
@ -58,15 +58,13 @@ class FilePage extends React.Component<Props> {
|
|||
];
|
||||
|
||||
componentDidMount() {
|
||||
const { uri, fileInfo, fetchFileInfo, fetchCostInfo, setViewed, isSubscribed } = this.props;
|
||||
const { uri, fetchFileInfo, fetchCostInfo, setViewed, isSubscribed } = this.props;
|
||||
|
||||
if (isSubscribed) {
|
||||
this.removeFromSubscriptionNotifications();
|
||||
}
|
||||
|
||||
if (fileInfo === undefined) {
|
||||
// always refresh file info when entering file page
|
||||
fetchFileInfo(uri);
|
||||
}
|
||||
|
||||
// See https://github.com/lbryio/lbry-desktop/pull/1563 for discussion
|
||||
fetchCostInfo(uri);
|
||||
|
|
|
@ -12,16 +12,17 @@ export type Price = {
|
|||
amount: number,
|
||||
};
|
||||
|
||||
type SetDaemonSettingArg = boolean | string | number | Price;
|
||||
|
||||
type DaemonSettings = {
|
||||
download_directory: string,
|
||||
disable_max_key_fee: boolean,
|
||||
download_dir: string,
|
||||
share_usage_data: boolean,
|
||||
max_key_fee?: Price,
|
||||
};
|
||||
|
||||
type Props = {
|
||||
setDaemonSetting: (string, boolean | string | Price) => void,
|
||||
setClientSetting: (string, boolean | string | number | Price) => void,
|
||||
setDaemonSetting: (string, ?SetDaemonSettingArg) => void,
|
||||
setClientSetting: (string, SetDaemonSettingArg) => void,
|
||||
clearCache: () => Promise<any>,
|
||||
getThemes: () => void,
|
||||
daemonSettings: DaemonSettings,
|
||||
|
@ -54,6 +55,7 @@ class SettingsPage extends React.PureComponent<Props, State> {
|
|||
|
||||
(this: any).onDownloadDirChange = this.onDownloadDirChange.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).onShowNsfwChange = this.onShowNsfwChange.bind(this);
|
||||
(this: any).onShareDataChange = this.onShareDataChange.bind(this);
|
||||
|
@ -80,7 +82,7 @@ class SettingsPage extends React.PureComponent<Props, State> {
|
|||
}
|
||||
|
||||
|
||||
onDownloadDirChange(newDirectory: string) {
|
||||
this.setDaemonSetting('download_directory', newDirectory);
|
||||
this.setDaemonSetting('download_dir', newDirectory);
|
||||
}
|
||||
|
||||
onKeyFeeChange(newValue: Price) {
|
||||
|
@ -88,7 +90,7 @@ class SettingsPage extends React.PureComponent<Props, State> {
|
|||
}
|
||||
|
||||
onKeyFeeDisableChange(isDisabled: boolean) {
|
||||
this.setDaemonSetting('disable_max_key_fee', isDisabled);
|
||||
if (isDisabled) this.setDaemonSetting('max_key_fee');
|
||||
}
|
||||
|
||||
onThemeChange(event: SyntheticInputEvent<*>) {
|
||||
|
@ -138,7 +140,7 @@ class SettingsPage extends React.PureComponent<Props, State> {
|
|||
this.props.setClientSetting(SETTINGS.OS_NOTIFICATIONS_ENABLED, event.target.checked);
|
||||
}
|
||||
|
||||
setDaemonSetting(name: string, value: boolean | string | Price) {
|
||||
setDaemonSetting(name: string, value: ?SetDaemonSettingArg): void {
|
||||
this.props.setDaemonSetting(name, value);
|
||||
}
|
||||
|
||||
|
@ -173,6 +175,9 @@ class SettingsPage extends React.PureComponent<Props, State> {
|
|||
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 (
|
||||
<Page>
|
||||
{noDaemonSettings ? (
|
||||
|
@ -190,7 +195,7 @@ class SettingsPage extends React.PureComponent<Props, State> {
|
|||
<div className="card__content">
|
||||
<FileSelector
|
||||
type="openDirectory"
|
||||
currentPath={daemonSettings.download_directory}
|
||||
currentPath={daemonSettings.download_dir}
|
||||
onFileChosen={this.onDownloadDirChange}
|
||||
/>
|
||||
</div>
|
||||
|
@ -210,7 +215,7 @@ class SettingsPage extends React.PureComponent<Props, State> {
|
|||
<FormField
|
||||
type="radio"
|
||||
name="no_max_purchase_limit"
|
||||
checked={daemonSettings.disable_max_key_fee}
|
||||
checked={disableMaxKeyFee}
|
||||
postfix={__('No Limit')}
|
||||
onChange={() => {
|
||||
this.onKeyFeeDisableChange(true);
|
||||
|
@ -219,22 +224,21 @@ class SettingsPage extends React.PureComponent<Props, State> {
|
|||
<FormField
|
||||
type="radio"
|
||||
name="max_purchase_limit"
|
||||
checked={!disableMaxKeyFee}
|
||||
onChange={() => {
|
||||
this.onKeyFeeDisableChange(false);
|
||||
this.onKeyFeeChange(defaultMaxKeyFee);
|
||||
}}
|
||||
checked={!daemonSettings.disable_max_key_fee}
|
||||
postfix={__('Choose limit')}
|
||||
/>
|
||||
{!daemonSettings.disable_max_key_fee && (
|
||||
{!disableMaxKeyFee && (
|
||||
<FormFieldPrice
|
||||
name="max_key_fee"
|
||||
label="Max purchase price"
|
||||
min={0}
|
||||
onChange={this.onKeyFeeChange}
|
||||
price={
|
||||
daemonSettings.max_key_fee
|
||||
? daemonSettings.max_key_fee
|
||||
: { currency: 'USD', amount: 50 }
|
||||
daemonSettings.max_key_fee ? daemonSettings.max_key_fee : defaultMaxKeyFee
|
||||
}
|
||||
/>
|
||||
)}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// @flow
|
||||
import type { Dispatch, GetState } from 'types/redux';
|
||||
import type { Source, Metadata } from 'types/claim';
|
||||
import type { Metadata } from 'types/claim';
|
||||
import type {
|
||||
UpdatePublishFormData,
|
||||
UpdatePublishFormAction,
|
||||
|
@ -226,7 +226,6 @@ export const doPublish = (params: PublishParams) => (
|
|||
contentIsFree,
|
||||
price,
|
||||
uri,
|
||||
sources,
|
||||
} = params;
|
||||
|
||||
// get the claim id from the channel name, we will use that instead
|
||||
|
@ -250,7 +249,6 @@ export const doPublish = (params: PublishParams) => (
|
|||
bid: ?number,
|
||||
metadata: ?Metadata,
|
||||
file_path?: string,
|
||||
sources?: Source,
|
||||
} = {
|
||||
name,
|
||||
channel_id: channelId,
|
||||
|
@ -264,12 +262,8 @@ export const doPublish = (params: PublishParams) => (
|
|||
amount: creditsToString(fee.amount),
|
||||
};
|
||||
}
|
||||
|
||||
if (filePath) {
|
||||
publishPayload.file_path = filePath;
|
||||
} else {
|
||||
publishPayload.sources = sources;
|
||||
}
|
||||
// only pass file on new uploads, not metadata only edits.
|
||||
if (filePath) publishPayload.file_path = filePath;
|
||||
|
||||
dispatch({ type: ACTIONS.PUBLISH_START });
|
||||
|
||||
|
|
|
@ -22,8 +22,10 @@ export function doFetchDaemonSettings() {
|
|||
|
||||
export function doSetDaemonSetting(key, value) {
|
||||
return dispatch => {
|
||||
const newSettings = {};
|
||||
newSettings[key] = value;
|
||||
const newSettings = {
|
||||
key,
|
||||
value: !value && value !== false ? null : value,
|
||||
};
|
||||
Lbry.settings_set(newSettings).then(newSettings);
|
||||
Lbry.settings_get().then(settings => {
|
||||
analytics.toggle(settings.share_usage_data, true);
|
||||
|
@ -71,7 +73,8 @@ export function doUpdateIsNight() {
|
|||
export function doUpdateIsNightAsync() {
|
||||
return dispatch => {
|
||||
dispatch(doUpdateIsNight());
|
||||
const updateIsNightInterval = setInterval(
|
||||
|
||||
setInterval(
|
||||
() => dispatch(doUpdateIsNight()),
|
||||
UPDATE_IS_NIGHT_INTERVAL
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue
This shouldn't need a client setting either.