diff --git a/package.json b/package.json index 521ed8189..e70423482 100644 --- a/package.json +++ b/package.json @@ -125,7 +125,7 @@ "jsmediatags": "^3.8.1", "json-loader": "^0.5.4", "lbry-format": "https://github.com/lbryio/lbry-format.git", - "lbry-redux": "lbryio/lbry-redux#66f70c7745d23e79f9e8ec9ca32ef9d3a576688e", + "lbry-redux": "lbryio/lbry-redux#d2c0d999d6909a6ebb80a318052d0358e12048ee", "lbryinc": "lbryio/lbryinc#a93596c51c8fb0a226cb84df04c26a6bb60a45fb", "lint-staged": "^7.0.2", "localforage": "^1.7.1", diff --git a/src/ui/component/fileActions/view.jsx b/src/ui/component/fileActions/view.jsx index fe82a3df6..d060e91b1 100644 --- a/src/ui/component/fileActions/view.jsx +++ b/src/ui/component/fileActions/view.jsx @@ -5,24 +5,18 @@ import React from 'react'; import Button from 'component/button'; import Tooltip from 'component/common/tooltip'; -type FileInfo = { - claim_id: string, -}; - type Props = { uri: string, claimId: string, openModal: (id: string, { uri: string }) => void, claimIsMine: boolean, - fileInfo: FileInfo, + fileInfo: FileListItem, }; class FileActions extends React.PureComponent { render() { const { fileInfo, uri, openModal, claimIsMine, claimId } = this.props; - const showDelete = claimIsMine || (fileInfo && Object.keys(fileInfo).length > 0); - // fix me - // const showDelete = claimIsMine || (fileInfo && fileInfo.writtenBytes > 0 || fileInfo.blobs_completed; + const showDelete = claimIsMine || (fileInfo && (fileInfo.written_bytes > 0 || fileInfo.blobs_completed === true)); return ( diff --git a/src/ui/component/fileDownloadLink/index.js b/src/ui/component/fileDownloadLink/index.js index 97a420f8a..2481ef9e8 100644 --- a/src/ui/component/fileDownloadLink/index.js +++ b/src/ui/component/fileDownloadLink/index.js @@ -4,10 +4,9 @@ import { makeSelectDownloadingForUri, makeSelectLoadingForUri, makeSelectClaimIsMine, - makeSelectUriIsStreamable, } from 'lbry-redux'; import { doOpenModal } from 'redux/actions/app'; -import { doSetPlayingUri } from 'redux/actions/content'; +import { doSetPlayingUri, doPlayUri } from 'redux/actions/content'; import FileDownloadLink from './view'; const select = (state, props) => ({ @@ -15,12 +14,12 @@ const select = (state, props) => ({ downloading: makeSelectDownloadingForUri(props.uri)(state), loading: makeSelectLoadingForUri(props.uri)(state), claimIsMine: makeSelectClaimIsMine(props.uri)(state), - isStreamable: makeSelectUriIsStreamable(props.uri)(state), }); const perform = dispatch => ({ openModal: (modal, props) => dispatch(doOpenModal(modal, props)), pause: () => dispatch(doSetPlayingUri(null)), + download: uri => dispatch(doPlayUri(uri, false, true)), }); export default connect( diff --git a/src/ui/component/fileDownloadLink/view.jsx b/src/ui/component/fileDownloadLink/view.jsx index 150bca323..1a31c7ed8 100644 --- a/src/ui/component/fileDownloadLink/view.jsx +++ b/src/ui/component/fileDownloadLink/view.jsx @@ -6,19 +6,21 @@ import Button from 'component/button'; import ToolTip from 'component/common/tooltip'; type Props = { + uri: string, claimIsMine: boolean, downloading: boolean, loading: boolean, isStreamable: boolean, - fileInfo: ?FileInfo, + fileInfo: ?FileListItem, openModal: (id: string, { path: string }) => void, pause: () => void, + download: string => void, }; function FileDownloadLink(props: Props) { - const { fileInfo, downloading, loading, openModal, pause, claimIsMine, isStreamable } = props; + const { fileInfo, downloading, loading, openModal, pause, claimIsMine, download, uri } = props; - if (!isStreamable && (loading || downloading)) { + if (loading || downloading) { const progress = fileInfo && fileInfo.written_bytes > 0 ? (fileInfo.written_bytes / fileInfo.total_bytes) * 100 : 0; const label = fileInfo && fileInfo.written_bytes > 0 @@ -32,6 +34,7 @@ function FileDownloadLink(props: Props) { return (