Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-1798: Update Unknown category to include Ad Blocker unknowns #433

Merged
merged 10 commits into from Aug 2, 2019

Only count requests modified by tracker, update browser button

  • Loading branch information
Eden12345 committed Jul 31, 2019
commit daff71e04cb6741c530fc82b4c50c44fbefc9632
@@ -327,7 +327,7 @@ class Summary extends React.Component {
enable_ad_block,
} = this.props;

return enable_ad_block && adBlock && adBlock.totalCount || 0;
return enable_ad_block && adBlock && adBlock.unknownTrackerCount || 0;
}

_antiTrackUnsafe() {
@@ -336,19 +336,19 @@ class Summary extends React.Component {
enable_anti_tracking,
} = this.props;

return enable_anti_tracking && antiTracking && antiTracking.totalUnsafeCount || 0;
}

_totalTrackersFound() {
const { trackerCounts, antiTracking } = this.props;

return (trackerCounts.allowed + trackerCounts.blocked + antiTracking.unknownTrackerCount) || 0;
return enable_anti_tracking && antiTracking && antiTracking.unknownTrackerCount || 0;
}

_requestsModifiedCount() {
return this._antiTrackUnsafe() + this._adBlockBlocked();
}

_totalTrackersFound() {
const { trackerCounts } = this.props;

return (trackerCounts.allowed + trackerCounts.blocked + this._requestsModifiedCount()) || 0;
}

_sbBlocked() {
const { smartBlock, trackerCounts } = this.props;

@@ -145,8 +145,8 @@ class BrowserButton {
}

const { appsCount, appsAlertCount } = this._getTrackerCount(tabId);
const adBlockingCount = getCliqzAdBlockingCount(tabId).totalCount;
const antiTrackingCount = getCliqzAntiTrackingData(tabId).totalUnsafeCount;
const adBlockingCount = getCliqzAdBlockingCount(tabId).unknownTrackerCount;
const antiTrackingCount = getCliqzAntiTrackingData(tabId).unknownTrackerCount;

alert = (appsAlertCount > 0);
trackerCount = (appsCount + antiTrackingCount + adBlockingCount).toString();
@@ -105,11 +105,13 @@ export function getCliqzAdBlockingCount(tabId) {
}

const adBlockInfo = adblocker.background.actions.getAdBlockInfoForTab(tabId);
const { others } = adblocker.background.actions.getGhosteryStats(tabId);
const { bugs, others } = adblocker.background.actions.getGhosteryStats(tabId);
const bugCount = bugs ? Object.keys(bugs).length : 0;
const otherCount = others ? Object.keys(others).length : 0;

return {
totalCount: adBlockInfo ? adBlockInfo.totalCount : 0,
unknownTrackerCount: others ? Object.keys(others).length : 0,
unknownTrackerCount: bugCount + otherCount,
};
}

ProTip! Use n and p to navigate between commits in a pull request.