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

View file

@ -314,14 +314,6 @@ lbry.removeFile = function(sdHash, name, deleteTargetFile=true, callback) { // N
}, callback); }, 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) { lbry.getFileInfoWhenListed = function(name, callback, timeoutCallback, tryNum=0) {
function scheduleNextCheckOrTimeout() { function scheduleNextCheckOrTimeout() {
if (timeoutCallback && tryNum > 200) { if (timeoutCallback && tryNum > 200) {