Merge branch 'issue/708'
This commit is contained in:
commit
b8333db3bc
19 changed files with 341 additions and 262 deletions
|
@ -6,9 +6,8 @@ import {
|
||||||
selectActiveHistoryEntry,
|
selectActiveHistoryEntry,
|
||||||
} from "redux/selectors/navigation";
|
} from "redux/selectors/navigation";
|
||||||
import { selectUser } from "redux/selectors/user";
|
import { selectUser } from "redux/selectors/user";
|
||||||
import { doCheckUpgradeAvailable, doAlertError } from "redux/actions/app";
|
import { doAlertError } from "redux/actions/app";
|
||||||
import { doRecordScroll } from "redux/actions/navigation";
|
import { doRecordScroll } from "redux/actions/navigation";
|
||||||
import { doFetchRewardedContent } from "redux/actions/content";
|
|
||||||
import App from "./view";
|
import App from "./view";
|
||||||
|
|
||||||
const select = (state, props) => ({
|
const select = (state, props) => ({
|
||||||
|
@ -20,8 +19,6 @@ const select = (state, props) => ({
|
||||||
|
|
||||||
const perform = dispatch => ({
|
const perform = dispatch => ({
|
||||||
alertError: errorList => dispatch(doAlertError(errorList)),
|
alertError: errorList => dispatch(doAlertError(errorList)),
|
||||||
checkUpgradeAvailable: () => dispatch(doCheckUpgradeAvailable()),
|
|
||||||
fetchRewardedContent: () => dispatch(doFetchRewardedContent()),
|
|
||||||
recordScroll: scrollPosition => dispatch(doRecordScroll(scrollPosition)),
|
recordScroll: scrollPosition => dispatch(doRecordScroll(scrollPosition)),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -13,23 +13,11 @@ class App extends React.PureComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillMount() {
|
componentWillMount() {
|
||||||
const {
|
const { alertError } = this.props;
|
||||||
alertError,
|
|
||||||
checkUpgradeAvailable,
|
|
||||||
fetchRewardedContent,
|
|
||||||
} = this.props;
|
|
||||||
|
|
||||||
document.addEventListener("unhandledError", event => {
|
document.addEventListener("unhandledError", event => {
|
||||||
alertError(event.detail);
|
alertError(event.detail);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!this.props.upgradeSkipped) {
|
|
||||||
checkUpgradeAvailable();
|
|
||||||
}
|
|
||||||
|
|
||||||
fetchRewardedContent();
|
|
||||||
|
|
||||||
this.setTitleFromProps(this.props);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
|
|
|
@ -5,7 +5,8 @@ import { doFetchBlock } from "redux/actions/wallet";
|
||||||
import DateTime from "./view";
|
import DateTime from "./view";
|
||||||
|
|
||||||
const select = (state, props) => ({
|
const select = (state, props) => ({
|
||||||
date: !props.date && props.block
|
date:
|
||||||
|
!props.date && props.block
|
||||||
? makeSelectBlockDate(props.block)(state)
|
? makeSelectBlockDate(props.block)(state)
|
||||||
: props.date,
|
: props.date,
|
||||||
});
|
});
|
||||||
|
|
|
@ -12,18 +12,21 @@ import {
|
||||||
doHistoryForward,
|
doHistoryForward,
|
||||||
} from "redux/actions/navigation";
|
} from "redux/actions/navigation";
|
||||||
import Header from "./view";
|
import Header from "./view";
|
||||||
|
import { selectIsUpgradeAvailable } from "../../selectors/app";
|
||||||
|
import { doDownloadUpgrade } from "../../actions/app";
|
||||||
|
|
||||||
const select = state => ({
|
const select = state => ({
|
||||||
isBackDisabled: selectIsBackDisabled(state),
|
isBackDisabled: selectIsBackDisabled(state),
|
||||||
isForwardDisabled: selectIsForwardDisabled(state),
|
isForwardDisabled: selectIsForwardDisabled(state),
|
||||||
|
isUpgradeAvailable: selectIsUpgradeAvailable(state),
|
||||||
balance: formatCredits(selectBalance(state) || 0, 1),
|
balance: formatCredits(selectBalance(state) || 0, 1),
|
||||||
publish: __("Publish"),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const perform = dispatch => ({
|
const perform = dispatch => ({
|
||||||
navigate: path => dispatch(doNavigate(path)),
|
navigate: path => dispatch(doNavigate(path)),
|
||||||
back: () => dispatch(doHistoryBack()),
|
back: () => dispatch(doHistoryBack()),
|
||||||
forward: () => dispatch(doHistoryForward()),
|
forward: () => dispatch(doHistoryForward()),
|
||||||
|
downloadUpgrade: () => dispatch(doDownloadUpgrade()),
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(select, perform)(Header);
|
export default connect(select, perform)(Header);
|
||||||
|
|
|
@ -9,8 +9,9 @@ export const Header = props => {
|
||||||
forward,
|
forward,
|
||||||
isBackDisabled,
|
isBackDisabled,
|
||||||
isForwardDisabled,
|
isForwardDisabled,
|
||||||
|
isUpgradeAvailable,
|
||||||
navigate,
|
navigate,
|
||||||
publish,
|
downloadUpgrade,
|
||||||
} = props;
|
} = props;
|
||||||
return (
|
return (
|
||||||
<header id="header">
|
<header id="header">
|
||||||
|
@ -58,7 +59,7 @@ export const Header = props => {
|
||||||
onClick={() => navigate("/publish")}
|
onClick={() => navigate("/publish")}
|
||||||
button="primary button--flat"
|
button="primary button--flat"
|
||||||
icon="icon-upload"
|
icon="icon-upload"
|
||||||
label={publish}
|
label={__("Publish")}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="header__item">
|
<div className="header__item">
|
||||||
|
@ -77,6 +78,14 @@ export const Header = props => {
|
||||||
title={__("Settings")}
|
title={__("Settings")}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
{isUpgradeAvailable && (
|
||||||
|
<Link
|
||||||
|
onClick={() => downloadUpgrade()}
|
||||||
|
button="primary button--flat"
|
||||||
|
icon="icon-arrow-up"
|
||||||
|
label={__("Upgrade App")}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
</header>
|
</header>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -340,7 +340,8 @@ class PublishForm extends React.PureComponent {
|
||||||
handleFeePrefChange(feeEnabled) {
|
handleFeePrefChange(feeEnabled) {
|
||||||
this.setState({
|
this.setState({
|
||||||
isFee: feeEnabled,
|
isFee: feeEnabled,
|
||||||
feeAmount: this.state.feeAmount == ""
|
feeAmount:
|
||||||
|
this.state.feeAmount == ""
|
||||||
? this._defaultPaidPrice
|
? this._defaultPaidPrice
|
||||||
: this.state.feeAmount,
|
: this.state.feeAmount,
|
||||||
});
|
});
|
||||||
|
@ -556,9 +557,8 @@ class PublishForm extends React.PureComponent {
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
{!this.state.hasFile && !this.myClaimExists()
|
{!this.state.hasFile && !this.myClaimExists() ? null : (
|
||||||
? null
|
<div>
|
||||||
: <div>
|
|
||||||
<div className="card__content">
|
<div className="card__content">
|
||||||
<FormRow
|
<FormRow
|
||||||
ref="meta_title"
|
ref="meta_title"
|
||||||
|
@ -631,7 +631,8 @@ class PublishForm extends React.PureComponent {
|
||||||
<option value="1">{__("Adults Only")}</option>
|
<option value="1">{__("Adults Only")}</option>
|
||||||
</FormRow>
|
</FormRow>
|
||||||
</div>
|
</div>
|
||||||
</div>}
|
</div>
|
||||||
|
)}
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section className="card">
|
<section className="card">
|
||||||
|
@ -668,13 +669,14 @@ class PublishForm extends React.PureComponent {
|
||||||
onChange={val => this.handleFeeChange(val)}
|
onChange={val => this.handleFeeChange(val)}
|
||||||
/>
|
/>
|
||||||
</span>
|
</span>
|
||||||
{this.state.isFee && this.state.feeCurrency.toUpperCase() != "LBC"
|
{this.state.isFee &&
|
||||||
? <div className="form-field__helper">
|
this.state.feeCurrency.toUpperCase() != "LBC" ? (
|
||||||
|
<div className="form-field__helper">
|
||||||
{__(
|
{__(
|
||||||
"All content fees are charged in LBC. For non-LBC payment methods, the number of credits charged will be adjusted based on the value of LBRY credits at the time of purchase."
|
"All content fees are charged in LBC. For non-LBC payment methods, the number of credits charged will be adjusted based on the value of LBRY credits at the time of purchase."
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
: null}
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
<section className="card">
|
<section className="card">
|
||||||
|
@ -740,16 +742,12 @@ class PublishForm extends React.PureComponent {
|
||||||
"Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International"
|
"Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International"
|
||||||
)}
|
)}
|
||||||
</option>
|
</option>
|
||||||
<option value="copyright">
|
<option value="copyright">{__("Copyrighted...")}</option>
|
||||||
{__("Copyrighted...")}
|
<option value="other">{__("Other...")}</option>
|
||||||
</option>
|
|
||||||
<option value="other">
|
|
||||||
{__("Other...")}
|
|
||||||
</option>
|
|
||||||
</FormRow>
|
</FormRow>
|
||||||
|
|
||||||
{this.state.licenseType == "copyright"
|
{this.state.licenseType == "copyright" ? (
|
||||||
? <FormRow
|
<FormRow
|
||||||
label={__("Copyright notice")}
|
label={__("Copyright notice")}
|
||||||
type="text"
|
type="text"
|
||||||
name="copyright-notice"
|
name="copyright-notice"
|
||||||
|
@ -758,10 +756,10 @@ class PublishForm extends React.PureComponent {
|
||||||
this.handleCopyrightNoticeChange(event);
|
this.handleCopyrightNoticeChange(event);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
: null}
|
) : null}
|
||||||
|
|
||||||
{this.state.licenseType == "other"
|
{this.state.licenseType == "other" ? (
|
||||||
? <FormRow
|
<FormRow
|
||||||
label={__("License description")}
|
label={__("License description")}
|
||||||
type="text"
|
type="text"
|
||||||
name="other-license-description"
|
name="other-license-description"
|
||||||
|
@ -770,10 +768,10 @@ class PublishForm extends React.PureComponent {
|
||||||
this.handleOtherLicenseDescriptionChange(event);
|
this.handleOtherLicenseDescriptionChange(event);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
: null}
|
) : null}
|
||||||
|
|
||||||
{this.state.licenseType == "other"
|
{this.state.licenseType == "other" ? (
|
||||||
? <FormRow
|
<FormRow
|
||||||
label={__("License URL")}
|
label={__("License URL")}
|
||||||
type="text"
|
type="text"
|
||||||
name="other-license-url"
|
name="other-license-url"
|
||||||
|
@ -782,7 +780,7 @@ class PublishForm extends React.PureComponent {
|
||||||
this.handleOtherLicenseUrlChange(event);
|
this.handleOtherLicenseUrlChange(event);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
: null}
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
@ -798,8 +796,7 @@ class PublishForm extends React.PureComponent {
|
||||||
<div className="card__subtitle">
|
<div className="card__subtitle">
|
||||||
{__(
|
{__(
|
||||||
"This is the exact address where people find your content (ex. lbry://myvideo)."
|
"This is the exact address where people find your content (ex. lbry://myvideo)."
|
||||||
)}
|
)}{" "}
|
||||||
{" "}
|
|
||||||
<Link
|
<Link
|
||||||
label={__("Learn more")}
|
label={__("Learn more")}
|
||||||
href="https://lbry.io/faq/naming"
|
href="https://lbry.io/faq/naming"
|
||||||
|
@ -808,9 +805,11 @@ class PublishForm extends React.PureComponent {
|
||||||
</div>
|
</div>
|
||||||
<div className="card__content">
|
<div className="card__content">
|
||||||
<FormRow
|
<FormRow
|
||||||
prefix={`lbry://${this.state.channel === "anonymous"
|
prefix={`lbry://${
|
||||||
|
this.state.channel === "anonymous"
|
||||||
? ""
|
? ""
|
||||||
: `${this.state.channel}/`}`}
|
: `${this.state.channel}/`
|
||||||
|
}`}
|
||||||
type="text"
|
type="text"
|
||||||
ref="name"
|
ref="name"
|
||||||
placeholder="myname"
|
placeholder="myname"
|
||||||
|
@ -821,8 +820,8 @@ class PublishForm extends React.PureComponent {
|
||||||
helper={this.getNameBidHelpText()}
|
helper={this.getNameBidHelpText()}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
{this.state.rawName
|
{this.state.rawName ? (
|
||||||
? <div className="card__content">
|
<div className="card__content">
|
||||||
<FormRow
|
<FormRow
|
||||||
ref="bid"
|
ref="bid"
|
||||||
type="number"
|
type="number"
|
||||||
|
@ -838,7 +837,9 @@ class PublishForm extends React.PureComponent {
|
||||||
min="0"
|
min="0"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
: ""}
|
) : (
|
||||||
|
""
|
||||||
|
)}
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section className="card">
|
<section className="card">
|
||||||
|
@ -850,8 +851,7 @@ class PublishForm extends React.PureComponent {
|
||||||
ref="tosAgree"
|
ref="tosAgree"
|
||||||
label={
|
label={
|
||||||
<span>
|
<span>
|
||||||
{__("I agree to the")}
|
{__("I agree to the")}{" "}
|
||||||
{" "}
|
|
||||||
<Link
|
<Link
|
||||||
href="https://www.lbry.io/termsofservice"
|
href="https://www.lbry.io/termsofservice"
|
||||||
label={__("LBRY terms of service")}
|
label={__("LBRY terms of service")}
|
||||||
|
@ -897,8 +897,8 @@ class PublishForm extends React.PureComponent {
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<p>
|
<p>
|
||||||
{__("Your file has been published to LBRY at the address")}
|
{__("Your file has been published to LBRY at the address")}{" "}
|
||||||
{" "}<code>{this.state.uri}</code>!
|
<code>{this.state.uri}</code>!
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
{__(
|
{__(
|
||||||
|
|
|
@ -61,12 +61,16 @@ class UriIndicator extends React.PureComponent {
|
||||||
const inner = (
|
const inner = (
|
||||||
<span>
|
<span>
|
||||||
<span className="channel-name">{channelName}</span>{" "}
|
<span className="channel-name">{channelName}</span>{" "}
|
||||||
{!signatureIsValid
|
{!signatureIsValid ? (
|
||||||
? <Icon
|
<Icon
|
||||||
icon={icon}
|
icon={icon}
|
||||||
className={`channel-indicator__icon channel-indicator__icon--${modifier}`}
|
className={`channel-indicator__icon channel-indicator__icon--${
|
||||||
|
modifier
|
||||||
|
}`}
|
||||||
/>
|
/>
|
||||||
: ""}
|
) : (
|
||||||
|
""
|
||||||
|
)}
|
||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,12 @@ export const UPGRADE_DOWNLOAD_STARTED = "UPGRADE_DOWNLOAD_STARTED";
|
||||||
export const UPGRADE_DOWNLOAD_COMPLETED = "UPGRADE_DOWNLOAD_COMPLETED";
|
export const UPGRADE_DOWNLOAD_COMPLETED = "UPGRADE_DOWNLOAD_COMPLETED";
|
||||||
export const UPGRADE_DOWNLOAD_PROGRESSED = "UPGRADE_DOWNLOAD_PROGRESSED";
|
export const UPGRADE_DOWNLOAD_PROGRESSED = "UPGRADE_DOWNLOAD_PROGRESSED";
|
||||||
export const CHECK_UPGRADE_AVAILABLE = "CHECK_UPGRADE_AVAILABLE";
|
export const CHECK_UPGRADE_AVAILABLE = "CHECK_UPGRADE_AVAILABLE";
|
||||||
|
export const CHECK_UPGRADE_START = "CHECK_UPGRADE_START";
|
||||||
|
export const CHECK_UPGRADE_SUCCESS = "CHECK_UPGRADE_SUCCESS";
|
||||||
|
export const CHECK_UPGRADE_FAIL = "CHECK_UPGRADE_FAIL";
|
||||||
|
export const CHECK_UPGRADE_SUBSCRIBE = "CHECK_UPGRADE_SUBSCRIBE";
|
||||||
export const UPDATE_VERSION = "UPDATE_VERSION";
|
export const UPDATE_VERSION = "UPDATE_VERSION";
|
||||||
|
export const UPDATE_REMOTE_VERSION = "UPDATE_REMOTE_VERSION";
|
||||||
export const SKIP_UPGRADE = "SKIP_UPGRADE";
|
export const SKIP_UPGRADE = "SKIP_UPGRADE";
|
||||||
export const START_UPGRADE = "START_UPGRADE";
|
export const START_UPGRADE = "START_UPGRADE";
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,9 @@ jsonrpc.call = function(
|
||||||
|
|
||||||
function makeRequest(url, options) {
|
function makeRequest(url, options) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
fetch(url, options).then(resolve).catch(reject);
|
fetch(url, options)
|
||||||
|
.then(resolve)
|
||||||
|
.catch(reject);
|
||||||
|
|
||||||
if (timeout) {
|
if (timeout) {
|
||||||
const e = new Error(__("Protocol request timed out"));
|
const e = new Error(__("Protocol request timed out"));
|
||||||
|
|
|
@ -71,7 +71,10 @@ var init = function() {
|
||||||
|
|
||||||
ReactDOM.render(
|
ReactDOM.render(
|
||||||
<Provider store={store}>
|
<Provider store={store}>
|
||||||
<div><App /><SnackBar /></div>
|
<div>
|
||||||
|
<App />
|
||||||
|
<SnackBar />
|
||||||
|
</div>
|
||||||
</Provider>,
|
</Provider>,
|
||||||
canvas
|
canvas
|
||||||
);
|
);
|
||||||
|
|
|
@ -13,14 +13,15 @@ const ModalCreditIntro = props => {
|
||||||
<h3 className="modal__header">{__("Blockchain 101")}</h3>
|
<h3 className="modal__header">{__("Blockchain 101")}</h3>
|
||||||
<p>
|
<p>
|
||||||
LBRY is controlled and powered by a blockchain asset called{" "}
|
LBRY is controlled and powered by a blockchain asset called{" "}
|
||||||
<em><CurrencySymbol /></em>.{" "}
|
<em>
|
||||||
<CurrencySymbol />{" "}
|
<CurrencySymbol />
|
||||||
|
</em>. <CurrencySymbol />{" "}
|
||||||
{__(
|
{__(
|
||||||
"is used to publish content, to have a say in the network rules, and to access paid content."
|
"is used to publish content, to have a say in the network rules, and to access paid content."
|
||||||
)}
|
)}
|
||||||
</p>
|
</p>
|
||||||
{currentBalance <= 0
|
{currentBalance <= 0 ? (
|
||||||
? <div>
|
<div>
|
||||||
<p>
|
<p>
|
||||||
You currently have <CreditAmount amount={currentBalance} />, so
|
You currently have <CreditAmount amount={currentBalance} />, so
|
||||||
the actions you can take are limited.
|
the actions you can take are limited.
|
||||||
|
@ -28,21 +29,24 @@ const ModalCreditIntro = props => {
|
||||||
<p>
|
<p>
|
||||||
However, there are a variety of ways to get credits, including
|
However, there are a variety of ways to get credits, including
|
||||||
more than{" "}
|
more than{" "}
|
||||||
{totalRewardValue
|
{totalRewardValue ? (
|
||||||
? <CreditAmount amount={totalRewardRounded} />
|
<CreditAmount amount={totalRewardRounded} />
|
||||||
: <span className="credit-amount">{__("?? credits")}</span>}
|
) : (
|
||||||
{" "}{" "}
|
<span className="credit-amount">{__("?? credits")}</span>
|
||||||
|
)}{" "}
|
||||||
{__(
|
{__(
|
||||||
" in rewards available for being a proven human during the LBRY beta."
|
" in rewards available for being a proven human during the LBRY beta."
|
||||||
)}
|
)}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
: <div>
|
) : (
|
||||||
|
<div>
|
||||||
<p>
|
<p>
|
||||||
But you probably knew this, since you've already got{" "}
|
But you probably knew this, since you've already got{" "}
|
||||||
<CreditAmount amount={currentBalance} />.
|
<CreditAmount amount={currentBalance} />.
|
||||||
</p>
|
</p>
|
||||||
</div>}
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
<div className="modal__buttons">
|
<div className="modal__buttons">
|
||||||
<Link
|
<Link
|
||||||
|
|
|
@ -86,8 +86,7 @@ class ReportPage extends React.Component {
|
||||||
<section className="card">
|
<section className="card">
|
||||||
<div className="card__content">
|
<div className="card__content">
|
||||||
<h3>{__("Developer?")}</h3>
|
<h3>{__("Developer?")}</h3>
|
||||||
{__("You can also")}
|
{__("You can also")}{" "}
|
||||||
{" "}
|
|
||||||
<Link
|
<Link
|
||||||
href="https://github.com/lbryio/lbry/issues"
|
href="https://github.com/lbryio/lbry/issues"
|
||||||
label={__("submit an issue on GitHub")}
|
label={__("submit an issue on GitHub")}
|
||||||
|
|
|
@ -5,18 +5,23 @@ import {
|
||||||
selectUpgradeDownloadPath,
|
selectUpgradeDownloadPath,
|
||||||
selectUpgradeDownloadItem,
|
selectUpgradeDownloadItem,
|
||||||
selectUpgradeFilename,
|
selectUpgradeFilename,
|
||||||
|
selectIsUpgradeSkipped,
|
||||||
|
selectRemoteVersion,
|
||||||
} from "redux/selectors/app";
|
} from "redux/selectors/app";
|
||||||
import { doFetchDaemonSettings } from "redux/actions/settings";
|
import { doFetchDaemonSettings } from "redux/actions/settings";
|
||||||
import { doBalanceSubscribe } from "redux/actions/wallet";
|
import { doBalanceSubscribe } from "redux/actions/wallet";
|
||||||
import { doAuthenticate } from "redux/actions/user";
|
import { doAuthenticate } from "redux/actions/user";
|
||||||
import { doFetchFileInfosAndPublishedClaims } from "redux/actions/file_info";
|
import { doFetchFileInfosAndPublishedClaims } from "redux/actions/file_info";
|
||||||
import * as modals from "constants/modal_types";
|
import * as modals from "constants/modal_types";
|
||||||
|
import { doFetchRewardedContent } from "actions/content";
|
||||||
|
import { selectCurrentModal } from "../selectors/app";
|
||||||
|
|
||||||
const { remote, ipcRenderer, shell } = require("electron");
|
const { remote, ipcRenderer, shell } = require("electron");
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
const { download } = remote.require("electron-dl");
|
const { download } = remote.require("electron-dl");
|
||||||
const fs = remote.require("fs");
|
const fs = remote.require("fs");
|
||||||
const { lbrySettings: config } = require("../../../../app/package.json");
|
const { lbrySettings: config } = require("../../../../app/package.json");
|
||||||
|
const CHECK_UPGRADE_INTERVAL = 10 * 60 * 1000;
|
||||||
|
|
||||||
export function doOpenModal(modal, modalProps = {}) {
|
export function doOpenModal(modal, modalProps = {}) {
|
||||||
return {
|
return {
|
||||||
|
@ -71,11 +76,8 @@ export function doDownloadUpgrade() {
|
||||||
onProgress: p => dispatch(doUpdateDownloadProgress(Math.round(p * 100))),
|
onProgress: p => dispatch(doUpdateDownloadProgress(Math.round(p * 100))),
|
||||||
directory: dir,
|
directory: dir,
|
||||||
};
|
};
|
||||||
download(
|
download(remote.getCurrentWindow(), selectUpdateUrl(state), options).then(
|
||||||
remote.getCurrentWindow(),
|
downloadItem => {
|
||||||
selectUpdateUrl(state),
|
|
||||||
options
|
|
||||||
).then(downloadItem => {
|
|
||||||
/**
|
/**
|
||||||
* TODO: get the download path directly from the download object. It should just be
|
* TODO: get the download path directly from the download object. It should just be
|
||||||
* downloadItem.getSavePath(), but the copy on the main process is being garbage collected
|
* downloadItem.getSavePath(), but the copy on the main process is being garbage collected
|
||||||
|
@ -89,7 +91,8 @@ export function doDownloadUpgrade() {
|
||||||
path: path.join(dir, upgradeFilename),
|
path: path.join(dir, upgradeFilename),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
});
|
}
|
||||||
|
);
|
||||||
|
|
||||||
dispatch({
|
dispatch({
|
||||||
type: types.UPGRADE_DOWNLOAD_STARTED,
|
type: types.UPGRADE_DOWNLOAD_STARTED,
|
||||||
|
@ -129,15 +132,25 @@ export function doCancelUpgrade() {
|
||||||
export function doCheckUpgradeAvailable() {
|
export function doCheckUpgradeAvailable() {
|
||||||
return function(dispatch, getState) {
|
return function(dispatch, getState) {
|
||||||
const state = getState();
|
const state = getState();
|
||||||
|
|
||||||
lbry.getAppVersionInfo().then(({ remoteVersion, upgradeAvailable }) => {
|
|
||||||
if (upgradeAvailable) {
|
|
||||||
dispatch({
|
dispatch({
|
||||||
type: types.UPDATE_VERSION,
|
type: types.CHECK_UPGRADE_START,
|
||||||
|
});
|
||||||
|
|
||||||
|
const success = ({ remoteVersion, upgradeAvailable }) => {
|
||||||
|
dispatch({
|
||||||
|
type: types.CHECK_UPGRADE_SUCCESS,
|
||||||
data: {
|
data: {
|
||||||
version: remoteVersion,
|
upgradeAvailable,
|
||||||
|
remoteVersion,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (
|
||||||
|
upgradeAvailable &&
|
||||||
|
!selectCurrentModal(state) &&
|
||||||
|
(!selectIsUpgradeSkipped(state) ||
|
||||||
|
remoteVersion !== selectRemoteVersion(state))
|
||||||
|
) {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: types.OPEN_MODAL,
|
type: types.OPEN_MODAL,
|
||||||
data: {
|
data: {
|
||||||
|
@ -145,6 +158,30 @@ export function doCheckUpgradeAvailable() {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const fail = () => {
|
||||||
|
dispatch({
|
||||||
|
type: types.CHECK_UPGRADE_FAIL,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
lbry.getAppVersionInfo().then(success, fail);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Initiate a timer that will check for an app upgrade every 10 minutes.
|
||||||
|
*/
|
||||||
|
export function doCheckUpgradeSubscribe() {
|
||||||
|
return function(dispatch) {
|
||||||
|
const checkUpgradeTimer = setInterval(
|
||||||
|
() => dispatch(doCheckUpgradeAvailable()),
|
||||||
|
CHECK_UPGRADE_INTERVAL
|
||||||
|
);
|
||||||
|
dispatch({
|
||||||
|
type: types.CHECK_UPGRADE_SUBSCRIBE,
|
||||||
|
data: { checkUpgradeTimer },
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -153,7 +190,8 @@ export function doCheckDaemonVersion() {
|
||||||
return function(dispatch, getState) {
|
return function(dispatch, getState) {
|
||||||
lbry.version().then(({ lbrynet_version }) => {
|
lbry.version().then(({ lbrynet_version }) => {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: config.lbrynetDaemonVersion == lbrynet_version
|
type:
|
||||||
|
config.lbrynetDaemonVersion == lbrynet_version
|
||||||
? types.DAEMON_VERSION_MATCH
|
? types.DAEMON_VERSION_MATCH
|
||||||
: types.DAEMON_VERSION_MISMATCH,
|
: types.DAEMON_VERSION_MISMATCH,
|
||||||
});
|
});
|
||||||
|
@ -176,11 +214,18 @@ export function doAlertError(errorList) {
|
||||||
|
|
||||||
export function doDaemonReady() {
|
export function doDaemonReady() {
|
||||||
return function(dispatch, getState) {
|
return function(dispatch, getState) {
|
||||||
|
const state = getState();
|
||||||
|
|
||||||
dispatch(doAuthenticate());
|
dispatch(doAuthenticate());
|
||||||
dispatch({ type: types.DAEMON_READY });
|
dispatch({ type: types.DAEMON_READY });
|
||||||
dispatch(doFetchDaemonSettings());
|
dispatch(doFetchDaemonSettings());
|
||||||
dispatch(doBalanceSubscribe());
|
dispatch(doBalanceSubscribe());
|
||||||
dispatch(doFetchFileInfosAndPublishedClaims());
|
dispatch(doFetchFileInfosAndPublishedClaims());
|
||||||
|
dispatch(doFetchRewardedContent());
|
||||||
|
if (!selectIsUpgradeSkipped(state)) {
|
||||||
|
dispatch(doCheckUpgradeAvailable());
|
||||||
|
}
|
||||||
|
dispatch(doCheckUpgradeSubscribe());
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,8 +51,8 @@ export function doResolveUris(uris) {
|
||||||
certificate: null,
|
certificate: null,
|
||||||
};
|
};
|
||||||
|
|
||||||
const { claim, certificate, claims_in_channel } = uriResolveInfo &&
|
const { claim, certificate, claims_in_channel } =
|
||||||
!uriResolveInfo.error
|
uriResolveInfo && !uriResolveInfo.error
|
||||||
? uriResolveInfo
|
? uriResolveInfo
|
||||||
: fallbackResolveInfo;
|
: fallbackResolveInfo;
|
||||||
resolveInfo[uri] = { claim, certificate, claims_in_channel };
|
resolveInfo[uri] = { claim, certificate, claims_in_channel };
|
||||||
|
|
|
@ -45,7 +45,8 @@ export function doFetchCostInfoForUri(uri) {
|
||||||
}, reject);
|
}, reject);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const fee = claim.value && claim.value.stream && claim.value.stream.metadata
|
const fee =
|
||||||
|
claim.value && claim.value.stream && claim.value.stream.metadata
|
||||||
? claim.value.stream.metadata.fee
|
? claim.value.stream.metadata.fee
|
||||||
: undefined;
|
: undefined;
|
||||||
|
|
||||||
|
|
|
@ -93,12 +93,11 @@ export function doClaimEligiblePurchaseRewards() {
|
||||||
if (rewardsByType[rewards.TYPE_FIRST_STREAM]) {
|
if (rewardsByType[rewards.TYPE_FIRST_STREAM]) {
|
||||||
dispatch(doClaimRewardType(rewards.TYPE_FIRST_STREAM));
|
dispatch(doClaimRewardType(rewards.TYPE_FIRST_STREAM));
|
||||||
} else {
|
} else {
|
||||||
[
|
[rewards.TYPE_MANY_DOWNLOADS, rewards.TYPE_FEATURED_DOWNLOAD].forEach(
|
||||||
rewards.TYPE_MANY_DOWNLOADS,
|
type => {
|
||||||
rewards.TYPE_FEATURED_DOWNLOAD,
|
|
||||||
].forEach(type => {
|
|
||||||
dispatch(doClaimRewardType(type));
|
dispatch(doClaimRewardType(type));
|
||||||
});
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,7 +64,7 @@ reducers[types.SKIP_UPGRADE] = function(state, action) {
|
||||||
sessionStorage.setItem("upgradeSkipped", true);
|
sessionStorage.setItem("upgradeSkipped", true);
|
||||||
|
|
||||||
return Object.assign({}, state, {
|
return Object.assign({}, state, {
|
||||||
upgradeSkipped: true,
|
isUpgradeSkipped: true,
|
||||||
modal: null,
|
modal: null,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -75,6 +75,19 @@ reducers[types.UPDATE_VERSION] = function(state, action) {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
reducers[types.CHECK_UPGRADE_SUCCESS] = function(state, action) {
|
||||||
|
return Object.assign({}, state, {
|
||||||
|
isUpgradeAvailable: action.data.upgradeAvailable,
|
||||||
|
remoteVersion: action.data.remoteVersion,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
reducers[types.CHECK_UPGRADE_SUBSCRIBE] = function(state, action) {
|
||||||
|
return Object.assign({}, state, {
|
||||||
|
checkUpgradeTimer: action.data.checkUpgradeTimer,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
reducers[types.OPEN_MODAL] = function(state, action) {
|
reducers[types.OPEN_MODAL] = function(state, action) {
|
||||||
return Object.assign({}, state, {
|
return Object.assign({}, state, {
|
||||||
modal: action.data.modal,
|
modal: action.data.modal,
|
||||||
|
|
|
@ -20,13 +20,19 @@ export const selectUpdateUrl = createSelector(selectPlatform, platform => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
export const selectVersion = createSelector(_selectState, state => {
|
export const selectRemoteVersion = createSelector(
|
||||||
return state.version;
|
_selectState,
|
||||||
});
|
state => state.remoteVersion
|
||||||
|
);
|
||||||
|
|
||||||
|
export const selectIsUpgradeAvailable = createSelector(
|
||||||
|
_selectState,
|
||||||
|
state => state.isUpgradeAvailable
|
||||||
|
);
|
||||||
|
|
||||||
export const selectUpgradeFilename = createSelector(
|
export const selectUpgradeFilename = createSelector(
|
||||||
selectPlatform,
|
selectPlatform,
|
||||||
selectVersion,
|
selectRemoteVersion,
|
||||||
(platform, version) => {
|
(platform, version) => {
|
||||||
switch (platform) {
|
switch (platform) {
|
||||||
case "darwin":
|
case "darwin":
|
||||||
|
@ -56,9 +62,9 @@ export const selectDownloadComplete = createSelector(
|
||||||
state => state.upgradeDownloadCompleted
|
state => state.upgradeDownloadCompleted
|
||||||
);
|
);
|
||||||
|
|
||||||
export const selectUpgradeSkipped = createSelector(
|
export const selectIsUpgradeSkipped = createSelector(
|
||||||
_selectState,
|
_selectState,
|
||||||
state => state.upgradeSkipped
|
state => state.isUpgradeSkipped
|
||||||
);
|
);
|
||||||
|
|
||||||
export const selectUpgradeDownloadPath = createSelector(
|
export const selectUpgradeDownloadPath = createSelector(
|
||||||
|
|
Loading…
Reference in a new issue