From 1d6101ddd2088e117b3e16a70e9b9f88e38957ac Mon Sep 17 00:00:00 2001 From: infinite-persistence Date: Sat, 31 Jul 2021 11:55:02 +0800 Subject: [PATCH] Report recsys info when 'share_data_usage' is enabled. Previous: ~~Although it was collecting info for all platforms, the data is only sent for Odysee.~~ Correction: it became enabled for all platform after `master` became Odysee. New: Only send out the telemetry for `IS_WEB` or if there's user consent. --- ui/component/viewers/videoViewer/index.js | 3 ++- .../viewers/videoViewer/internal/videojs.jsx | 13 ++++++++----- ui/component/viewers/videoViewer/view.jsx | 3 +++ 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/ui/component/viewers/videoViewer/index.js b/ui/component/viewers/videoViewer/index.js index f7d8925a8..cae14b521 100644 --- a/ui/component/viewers/videoViewer/index.js +++ b/ui/component/viewers/videoViewer/index.js @@ -7,7 +7,7 @@ import { makeSelectContentPositionForUri } from 'redux/selectors/content'; import VideoViewer from './view'; import { withRouter } from 'react-router'; import { doClaimEligiblePurchaseRewards } from 'redux/actions/rewards'; -import { makeSelectClientSetting, selectHomepageData } from 'redux/selectors/settings'; +import { selectDaemonSettings, makeSelectClientSetting, selectHomepageData } from 'redux/selectors/settings'; import { toggleVideoTheaterMode, doSetClientSetting } from 'redux/actions/settings'; import { selectUserVerifiedEmail, selectUser } from 'redux/selectors/user'; @@ -31,6 +31,7 @@ const select = (state, props) => { homepageData: selectHomepageData(state), authenticated: selectUserVerifiedEmail(state), userId: userId, + shareTelemetry: IS_WEB || selectDaemonSettings(state).share_usage_data, }; }; diff --git a/ui/component/viewers/videoViewer/internal/videojs.jsx b/ui/component/viewers/videoViewer/internal/videojs.jsx index 8195a23ae..ef9725151 100644 --- a/ui/component/viewers/videoViewer/internal/videojs.jsx +++ b/ui/component/viewers/videoViewer/internal/videojs.jsx @@ -56,6 +56,7 @@ type Props = { claimId: ?string, userId: ?number, allowPreRoll: ?boolean, + shareTelemetry: boolean, }; // type VideoJSOptions = { @@ -193,6 +194,7 @@ export default React.memo(function VideoJs(props: Props) { claimId, userId, // allowPreRoll, + shareTelemetry, } = props; const [reload, setReload] = useState('initial'); @@ -564,11 +566,12 @@ export default React.memo(function VideoJs(props: Props) { }); // Add recsys plugin - // TODO: Add an if(odysee.com) around this function to only use recsys on odysee - player.recsys({ - videoId: claimId, - userId: userId, - }); + if (shareTelemetry) { + player.recsys({ + videoId: claimId, + userId: userId, + }); + } // set playsinline for mobile // TODO: make this better diff --git a/ui/component/viewers/videoViewer/view.jsx b/ui/component/viewers/videoViewer/view.jsx index 3665aa249..0619c9047 100644 --- a/ui/component/viewers/videoViewer/view.jsx +++ b/ui/component/viewers/videoViewer/view.jsx @@ -51,6 +51,7 @@ type Props = { authenticated: boolean, userId: number, homepageData?: { [string]: HomepageCat }, + shareTelemetry: boolean, }; /* @@ -84,6 +85,7 @@ function VideoViewer(props: Props) { homepageData, authenticated, userId, + shareTelemetry, } = props; const adApprovedChannelIds = homepageData ? getAllIds(homepageData) : []; @@ -319,6 +321,7 @@ function VideoViewer(props: Props) { claimId={claimId} userId={userId} allowPreRoll={!embedded && !authenticated} + shareTelemetry={shareTelemetry} /> )}