diff --git a/src/_locales/en/messages.json b/src/_locales/en/messages.json index 8665d2c325..e5a0593644 100644 --- a/src/_locales/en/messages.json +++ b/src/_locales/en/messages.json @@ -945,6 +945,12 @@ "disableFaviconDesc": { "message": "Website Icons provide a recognizable image next to each login item in your vault." }, + "disableBadgeCounter": { + "message": "Disable Badge Counter" + }, + "disableBadgeCounterDesc": { + "message": "Badge counter indicates how many logins you have for the current page in your vault." + }, "cardholderName": { "message": "Cardholder Name" }, diff --git a/src/background/main.background.ts b/src/background/main.background.ts index b01a5d9ac4..7d251d7fad 100644 --- a/src/background/main.background.ts +++ b/src/background/main.background.ts @@ -532,19 +532,24 @@ export default class MainBackground { }); } + const disableBadgeCounter = await this.storageService.get(ConstantsService.disableBadgeCounterKey); let theText = ''; - if (ciphers.length > 0 && ciphers.length <= 9) { - theText = ciphers.length.toString(); - } else if (ciphers.length > 0) { - theText = '9+'; - } else { - if (contextMenuEnabled) { - await this.loadNoLoginsContextMenuOptions(this.i18nService.t('noMatchingLogins')); + + if (!disableBadgeCounter) { + if (ciphers.length > 0 && ciphers.length <= 9) { + theText = ciphers.length.toString(); + } else if (ciphers.length > 0) { + theText = '9+'; } } - this.browserActionSetBadgeText(theText, tabId); + if (contextMenuEnabled && ciphers.length === 0) { + await this.loadNoLoginsContextMenuOptions(this.i18nService.t('noMatchingLogins')); + } + this.sidebarActionSetBadgeText(theText, tabId); + this.browserActionSetBadgeText(theText, tabId); + return; } catch { } } diff --git a/src/popup/services/services.module.ts b/src/popup/services/services.module.ts index 497ade9381..210b14a40b 100644 --- a/src/popup/services/services.module.ts +++ b/src/popup/services/services.module.ts @@ -90,9 +90,12 @@ export function initFactory(platformUtilsService: PlatformUtilsService, i18nServ } if (BrowserApi.getBackgroundPage() != null) { - stateService.save(ConstantsService.disableFaviconKey, + await stateService.save(ConstantsService.disableFaviconKey, await storageService.get(ConstantsService.disableFaviconKey)); + await stateService.save(ConstantsService.disableBadgeCounterKey, + await storageService.get(ConstantsService.disableBadgeCounterKey)); + let theme = await storageService.get(ConstantsService.themeKey); if (theme == null) { theme = platformUtilsService.getDefaultSystemTheme(); diff --git a/src/popup/settings/options.component.html b/src/popup/settings/options.component.html index 938bcd756e..d0888604d9 100644 --- a/src/popup/settings/options.component.html +++ b/src/popup/settings/options.component.html @@ -115,6 +115,15 @@ +
+
+
+ + +
+
+ +
diff --git a/src/popup/settings/options.component.ts b/src/popup/settings/options.component.ts index e5cf6322bb..dc2bea76ba 100644 --- a/src/popup/settings/options.component.ts +++ b/src/popup/settings/options.component.ts @@ -22,6 +22,7 @@ import { ConstantsService } from 'jslib/services/constants.service'; }) export class OptionsComponent implements OnInit { disableFavicon = false; + disableBadgeCounter = false; enableAutoFillOnPageLoad = false; disableAutoTotpCopy = false; disableContextMenuItem = false; @@ -86,6 +87,8 @@ export class OptionsComponent implements OnInit { this.disableFavicon = await this.storageService.get(ConstantsService.disableFaviconKey); + this.disableBadgeCounter = await this.storageService.get(ConstantsService.disableBadgeCounterKey); + this.theme = await this.storageService.get(ConstantsService.themeKey); const defaultUriMatch = await this.storageService.get(ConstantsService.defaultUriMatch); @@ -129,6 +132,12 @@ export class OptionsComponent implements OnInit { this.callAnalytics('Favicon', !this.disableFavicon); } + async updateDisableBadgeCounter() { + await this.storageService.save(ConstantsService.disableBadgeCounterKey, this.disableBadgeCounter); + await this.stateService.save(ConstantsService.disableBadgeCounterKey, this.disableBadgeCounter); + this.messagingService.send('bgUpdateContextMenu'); + } + async updateShowCards() { await this.storageService.save(ConstantsService.dontShowCardsCurrentTab, this.dontShowCards); await this.stateService.save(ConstantsService.dontShowCardsCurrentTab, this.dontShowCards);