Do not log to api when dianostic sharing is off
This commit is contained in:
parent
539dea931a
commit
a8ce782894
2 changed files with 13 additions and 5 deletions
|
@ -1,5 +1,6 @@
|
|||
// @flow
|
||||
import mixpanel from 'mixpanel-browser';
|
||||
import Lbryio from 'lbryio';
|
||||
|
||||
mixpanel.init('691723e855cabb9d27a7a79002216967');
|
||||
|
||||
|
@ -7,6 +8,7 @@ type Analytics = {
|
|||
track: (string, ?Object) => void,
|
||||
setUser: Object => void,
|
||||
toggle: (boolean, ?boolean) => void,
|
||||
apiLog: (string, string, string) => void,
|
||||
};
|
||||
|
||||
let analyticsEnabled: boolean = false;
|
||||
|
@ -37,6 +39,15 @@ const analytics: Analytics = {
|
|||
}
|
||||
analyticsEnabled = enabled;
|
||||
},
|
||||
apiLog: (uri: string, outpoint: string, claim_id: string): void => {
|
||||
if(analyticsEnabled) {
|
||||
Lbryio.call('file', 'view', {
|
||||
uri,
|
||||
outpoint: outpoint,
|
||||
claim_id: claim_id,
|
||||
}).catch(() => {});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export default analytics;
|
||||
|
|
|
@ -21,6 +21,7 @@ import { selectBalance } from 'redux/selectors/wallet';
|
|||
import batchActions from 'util/batchActions';
|
||||
import setBadge from 'util/setBadge';
|
||||
import setProgressBar from 'util/setProgressBar';
|
||||
import analytics from 'analytics';
|
||||
|
||||
const DOWNLOAD_POLL_INTERVAL = 250;
|
||||
|
||||
|
@ -226,11 +227,7 @@ export function doDownloadFile(uri, streamInfo) {
|
|||
return dispatch => {
|
||||
dispatch(doStartDownload(uri, streamInfo.outpoint));
|
||||
|
||||
Lbryio.call('file', 'view', {
|
||||
uri,
|
||||
outpoint: streamInfo.outpoint,
|
||||
claim_id: streamInfo.claim_id,
|
||||
}).catch(() => {});
|
||||
analytics.apiLog(uri, streamInfo.output, streamInfo.claim_id);
|
||||
|
||||
dispatch(doClaimEligiblePurchaseRewards());
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue