Merge pull request #192 from lbryio/open-reveal-electron

Open and reveal files using Electron instead of daemon
This commit is contained in:
Jeremy Kauffman 2017-03-08 17:12:30 -05:00 committed by GitHub
commit d78aab14e8
3 changed files with 6 additions and 12 deletions

View file

@ -13,7 +13,7 @@ Web UI version numbers should always match the corresponding version of LBRY App
*
### Changed
*
* Open and reveal files using Electron instead of daemon
*
*

View file

@ -7,6 +7,8 @@ import FormField from './form.js';
import {ToolTip} from '../component/tooltip.js';
import {DropDownMenu, DropDownMenuItem} from './menu.js';
const {shell} = require('electron');
let WatchLink = React.createClass({
propTypes: {
streamName: React.PropTypes.string,
@ -123,8 +125,8 @@ let FileActionsRow = React.createClass({
}
},
onOpenClick: function() {
if (this.state.fileInfo && this.state.fileInfo.completed) {
lbry.openFile(this.props.sdHash);
if (this.state.fileInfo && this.state.fileInfo.download_path) {
shell.openItem(this.state.fileInfo.download_path);
}
},
handleDeleteCheckboxClicked: function(event) {
@ -134,7 +136,7 @@ let FileActionsRow = React.createClass({
},
handleRevealClicked: function() {
if (this.state.fileInfo && this.state.fileInfo.download_path) {
lbry.revealFile(this.props.sdHash);
shell.showItemInFolder(this.state.fileInfo.download_path);
}
},
handleRemoveClicked: function() {

View file

@ -314,14 +314,6 @@ lbry.removeFile = function(sdHash, name, deleteTargetFile=true, callback) { // N
}, callback);
}
lbry.openFile = function(sdHash, callback) {
lbry.call('open', {sd_hash: sdHash}, callback);
}
lbry.revealFile = function(sdHash, callback) {
lbry.call('reveal', {sd_hash: sdHash}, callback);
}
lbry.getFileInfoWhenListed = function(name, callback, timeoutCallback, tryNum=0) {
function scheduleNextCheckOrTimeout() {
if (timeoutCallback && tryNum > 200) {