When user hits "Watch", don't check balance if download already started
This commit is contained in:
parent
a24c6ed281
commit
fb421cdd79
2 changed files with 25 additions and 14 deletions
|
@ -18,7 +18,7 @@ Web UI version numbers should always match the corresponding version of LBRY App
|
||||||
*
|
*
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
*
|
* When user hits "Watch," don't check balance if download already started
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
|
|
||||||
|
|
|
@ -10,23 +10,32 @@ import {DropDownMenu, DropDownMenuItem} from './menu.js';
|
||||||
let WatchLink = React.createClass({
|
let WatchLink = React.createClass({
|
||||||
propTypes: {
|
propTypes: {
|
||||||
streamName: React.PropTypes.string,
|
streamName: React.PropTypes.string,
|
||||||
|
downloadStarted: React.PropTypes.bool,
|
||||||
|
},
|
||||||
|
startVideo: function() {
|
||||||
|
window.location = '?watch=' + this.props.streamName;
|
||||||
},
|
},
|
||||||
handleClick: function() {
|
handleClick: function() {
|
||||||
this.setState({
|
this.setState({
|
||||||
loading: true,
|
loading: true,
|
||||||
})
|
|
||||||
lbry.getCostInfoForName(this.props.streamName, ({cost}) => {
|
|
||||||
lbry.getBalance((balance) => {
|
|
||||||
if (cost > balance) {
|
|
||||||
this.setState({
|
|
||||||
modal: 'notEnoughCredits',
|
|
||||||
loading: false,
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
window.location = '?watch=' + this.props.streamName;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (this.props.downloadStarted) {
|
||||||
|
this.startVideo();
|
||||||
|
} else {
|
||||||
|
lbry.getCostInfoForName(this.props.streamName, ({cost}) => {
|
||||||
|
lbry.getBalance((balance) => {
|
||||||
|
if (cost > balance) {
|
||||||
|
this.setState({
|
||||||
|
modal: 'notEnoughCredits',
|
||||||
|
loading: false,
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.startVideo();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
getInitialState: function() {
|
getInitialState: function() {
|
||||||
return {
|
return {
|
||||||
|
@ -190,7 +199,9 @@ let FileActionsRow = React.createClass({
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{(this.props.metadata.content_type && this.props.metadata.content_type.startsWith('video/')) ? <WatchLink streamName={this.props.streamName} /> : null}
|
{this.props.metadata.content_type && this.props.metadata.content_type.startsWith('video/')
|
||||||
|
? <WatchLink streamName={this.props.streamName} downloadStarted={!!this.state.fileInfo} />
|
||||||
|
: null}
|
||||||
{this.state.fileInfo !== null || this.state.fileInfo.isMine
|
{this.state.fileInfo !== null || this.state.fileInfo.isMine
|
||||||
? linkBlock
|
? linkBlock
|
||||||
: null}
|
: null}
|
||||||
|
|
Loading…
Reference in a new issue