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.
This commit is contained in:
infinite-persistence 2021-07-31 11:55:02 +08:00 committed by jessopb
parent 34368760de
commit 1d6101ddd2
3 changed files with 13 additions and 6 deletions

View file

@ -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,
};
};

View file

@ -56,6 +56,7 @@ type Props = {
claimId: ?string,
userId: ?number,
allowPreRoll: ?boolean,
shareTelemetry: boolean,
};
// type VideoJSOptions = {
@ -193,6 +194,7 @@ export default React.memo<Props>(function VideoJs(props: Props) {
claimId,
userId,
// allowPreRoll,
shareTelemetry,
} = props;
const [reload, setReload] = useState('initial');
@ -564,11 +566,12 @@ export default React.memo<Props>(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

View file

@ -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}
/>
)}
</div>