Skip to content
This repository has been archived by the owner on Jun 6, 2019. It is now read-only.

Commit

Permalink
Set shields badge count for active tab only
Browse files Browse the repository at this point in the history
  • Loading branch information
petemill committed Aug 27, 2018
1 parent 21d8bd9 commit eb9bb8a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions app/background/api/browserActionAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,12 @@ export function init () {
* Sets the badge text
* @param {string} text - The text to put on the badge
*/
export const setBadgeText = (text: string) => {
export const setBadgeText = (tabId: number, text: string) => {
if (chrome.browserAction) {
chrome.browserAction.setBadgeText({ text: String(text) })
chrome.browserAction.setBadgeText({
tabId,
text: String(text)
})
}
}

Expand Down
2 changes: 1 addition & 1 deletion app/background/reducers/shieldsPanelReducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const updateBadgeText = (state: State) => {
if (tab) {
const total = tab.adsBlocked + tab.trackersBlocked + tab.javascriptBlocked + tab.fingerprintingBlocked + tab.httpsRedirected
// do not show any badge if there are no blocked items
setBadgeText(total > 99 ? '99+' : total > 0 ? total.toString() : '')
setBadgeText(tabId, total > 99 ? '99+' : total > 0 ? total.toString() : '')
}
}

Expand Down

0 comments on commit eb9bb8a

Please sign in to comment.