record file view when clicking the download button #1901
5 changed files with 24 additions and 2 deletions
|
@ -21,5 +21,6 @@ module.name_mapper='^rewards\(.*\)$' -> '<PROJECT_ROOT>/src/renderer/rewards\1'
|
||||||
module.name_mapper='^modal\(.*\)$' -> '<PROJECT_ROOT>/src/renderer/modal\1'
|
module.name_mapper='^modal\(.*\)$' -> '<PROJECT_ROOT>/src/renderer/modal\1'
|
||||||
module.name_mapper='^app\(.*\)$' -> '<PROJECT_ROOT>/src/renderer/app\1'
|
module.name_mapper='^app\(.*\)$' -> '<PROJECT_ROOT>/src/renderer/app\1'
|
||||||
module.name_mapper='^native\(.*\)$' -> '<PROJECT_ROOT>/src/renderer/native\1'
|
module.name_mapper='^native\(.*\)$' -> '<PROJECT_ROOT>/src/renderer/native\1'
|
||||||
|
module.name_mapper='^analytics\(.*\)$' -> '<PROJECT_ROOT>/src/renderer/analytics\1'
|
||||||
|
|
||||||
[strict]
|
[strict]
|
||||||
|
|
|
@ -4,6 +4,7 @@ import {
|
||||||
makeSelectDownloadingForUri,
|
makeSelectDownloadingForUri,
|
||||||
makeSelectLoadingForUri,
|
makeSelectLoadingForUri,
|
||||||
makeSelectCostInfoForUri,
|
makeSelectCostInfoForUri,
|
||||||
|
makeSelectClaimForUri,
|
||||||
} from 'lbry-redux';
|
} from 'lbry-redux';
|
||||||
import { doOpenFileInShell } from 'redux/actions/file';
|
import { doOpenFileInShell } from 'redux/actions/file';
|
||||||
import { doPurchaseUri, doStartDownload } from 'redux/actions/content';
|
import { doPurchaseUri, doStartDownload } from 'redux/actions/content';
|
||||||
|
@ -16,6 +17,7 @@ const select = (state, props) => ({
|
||||||
downloading: makeSelectDownloadingForUri(props.uri)(state),
|
downloading: makeSelectDownloadingForUri(props.uri)(state),
|
||||||
costInfo: makeSelectCostInfoForUri(props.uri)(state),
|
costInfo: makeSelectCostInfoForUri(props.uri)(state),
|
||||||
loading: makeSelectLoadingForUri(props.uri)(state),
|
loading: makeSelectLoadingForUri(props.uri)(state),
|
||||||
|
claim: makeSelectClaimForUri(props.uri)(state),
|
||||||
});
|
});
|
||||||
|
|
||||||
const perform = dispatch => ({
|
const perform = dispatch => ({
|
||||||
|
@ -25,4 +27,7 @@ const perform = dispatch => ({
|
||||||
doPause: () => dispatch(doPause()),
|
doPause: () => dispatch(doPause()),
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(select, perform)(FileDownloadLink);
|
export default connect(
|
||||||
|
select,
|
||||||
|
perform
|
||||||
|
)(FileDownloadLink);
|
||||||
|
|
|
@ -3,8 +3,11 @@ import React from 'react';
|
||||||
import Button from 'component/button';
|
import Button from 'component/button';
|
||||||
import * as icons from 'constants/icons';
|
import * as icons from 'constants/icons';
|
||||||
import ToolTip from 'component/common/tooltip';
|
import ToolTip from 'component/common/tooltip';
|
||||||
|
import analytics from 'analytics';
|
||||||
|
import type { Claim } from 'types/claim';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
|
claim: Claim,
|
||||||
uri: string,
|
uri: string,
|
||||||
downloading: boolean,
|
downloading: boolean,
|
||||||
fileInfo: ?{
|
fileInfo: ?{
|
||||||
|
@ -48,6 +51,7 @@ class FileDownloadLink extends React.PureComponent<Props> {
|
||||||
costInfo,
|
costInfo,
|
||||||
loading,
|
loading,
|
||||||
doPause,
|
doPause,
|
||||||
|
claim,
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
const openFile = () => {
|
const openFile = () => {
|
||||||
|
@ -80,6 +84,12 @@ class FileDownloadLink extends React.PureComponent<Props> {
|
||||||
iconColor="green"
|
iconColor="green"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
purchaseUri(uri);
|
purchaseUri(uri);
|
||||||
|
|
||||||
|
const { name, claim_id: claimId, nout, txid } = claim;
|
||||||
|
// // ideally outpoint would exist inside of claim information
|
||||||
|
// // we can use it after https://github.com/lbryio/lbry/issues/1306 is addressed
|
||||||
|
const outpoint = `${txid}:${nout}`;
|
||||||
|
analytics.apiLogView(`${name}#${claimId}`, outpoint, claimId);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</ToolTip>
|
</ToolTip>
|
||||||
|
|
|
@ -46,6 +46,7 @@ class MediaPlayer extends React.PureComponent {
|
||||||
|
|
||||||
const loadedMetadata = () => {
|
const loadedMetadata = () => {
|
||||||
this.setState({ hasMetadata: true, startedPlaying: true });
|
this.setState({ hasMetadata: true, startedPlaying: true });
|
||||||
|
|
||||||
if (startedPlayingCb) {
|
if (startedPlayingCb) {
|
||||||
startedPlayingCb();
|
startedPlayingCb();
|
||||||
}
|
}
|
||||||
|
|
|
@ -146,7 +146,12 @@ class FileViewer extends React.PureComponent<Props> {
|
||||||
}
|
}
|
||||||
|
|
||||||
playContent() {
|
playContent() {
|
||||||
const { play, uri } = this.props;
|
const { play, uri, fileInfo, isDownloading, isLoading } = this.props;
|
||||||
|
|
||||||
|
if (fileInfo || isDownloading || isLoading) {
|
||||||
|
// User may have pressed download before clicking play
|
||||||
|
this.startedPlayingCb = null;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.startedPlayingCb) {
|
if (this.startedPlayingCb) {
|
||||||
this.startTime = Date.now();
|
this.startTime = Date.now();
|
||||||
|
|
Loading…
Reference in a new issue