mirror of
https://github.com/LBRYFoundation/lbry-desktop.git
synced 2025-08-29 16:31:33 +00:00
commit
662a74eaa6
2 changed files with 13 additions and 7 deletions
|
@ -921,5 +921,6 @@
|
||||||
"Your account": "Your account",
|
"Your account": "Your account",
|
||||||
"Channel profile picture": "Channel profile picture",
|
"Channel profile picture": "Channel profile picture",
|
||||||
"refreshing the app": "refreshing the app",
|
"refreshing the app": "refreshing the app",
|
||||||
"Follower": "Follower"
|
"Follower": "Follower",
|
||||||
|
"%repost_channel_link% reposted": "%repost_channel_link% reposted"
|
||||||
}
|
}
|
|
@ -1,8 +1,9 @@
|
||||||
// @flow
|
// @flow
|
||||||
import * as ICONS from 'constants/icons';
|
import * as ICONS from 'constants/icons';
|
||||||
import * as MODALS from 'constants/modal_types';
|
import * as MODALS from 'constants/modal_types';
|
||||||
import React from 'react';
|
import React, { useState } from 'react';
|
||||||
import Button from 'component/button';
|
import Button from 'component/button';
|
||||||
|
import { generateDownloadUrl } from 'util/lbrytv';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
uri: string,
|
uri: string,
|
||||||
|
@ -36,6 +37,8 @@ function FileDownloadLink(props: Props) {
|
||||||
hideOpenButton = false,
|
hideOpenButton = false,
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
|
const [viewEventSent, setViewEventSent] = useState(false);
|
||||||
|
|
||||||
const cost = costInfo ? Number(costInfo.cost) : 0;
|
const cost = costInfo ? Number(costInfo.cost) : 0;
|
||||||
const isPaidContent = cost > 0;
|
const isPaidContent = cost > 0;
|
||||||
if (!claim || (IS_WEB && isPaidContent)) {
|
if (!claim || (IS_WEB && isPaidContent)) {
|
||||||
|
@ -44,16 +47,18 @@ function FileDownloadLink(props: Props) {
|
||||||
|
|
||||||
const { name, claim_id: claimId, value } = claim;
|
const { name, claim_id: claimId, value } = claim;
|
||||||
const fileName = value && value.source && value.source.name;
|
const fileName = value && value.source && value.source.name;
|
||||||
const downloadUrl = `/$/download/${name}/${claimId}`;
|
const downloadUrl = generateDownloadUrl(name, claimId);
|
||||||
|
|
||||||
function handleDownload(e) {
|
function handleDownload(e) {
|
||||||
e.preventDefault();
|
|
||||||
|
|
||||||
// @if TARGET='app'
|
// @if TARGET='app'
|
||||||
|
e.preventDefault();
|
||||||
download(uri);
|
download(uri);
|
||||||
// @endif;
|
// @endif;
|
||||||
// @if TARGET='web'
|
// @if TARGET='web'
|
||||||
|
if (!viewEventSent) {
|
||||||
triggerViewEvent(uri);
|
triggerViewEvent(uri);
|
||||||
|
}
|
||||||
|
setViewEventSent(true);
|
||||||
// @endif;
|
// @endif;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue