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