Fixes for text logic

Moved settings check above setting text, also added send message when settings is changed
Now when settings is changed, current tab badge is changed immediately, and other tabs do so in milliseconds after switch
This commit is contained in:
Vlad 2021-03-06 19:18:11 +03:00
parent 2a4f71625f
commit 518722c781
2 changed files with 14 additions and 12 deletions

View File

@ -532,22 +532,23 @@ export default class MainBackground {
});
}
const disableBadgeCounter = await this.storageService.get<boolean>(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+';
} else {
if (contextMenuEnabled) {
await this.loadNoLoginsContextMenuOptions(this.i18nService.t('noMatchingLogins'));
}
}
}
const disableBadgeCounter = await this.storageService.get<boolean>(ConstantsService.disableBadgeCounterKey);
if (!disableBadgeCounter) {
this.sidebarActionSetBadgeText(theText, tabId);
this.browserActionSetBadgeText(theText, tabId);
}
this.sidebarActionSetBadgeText(theText, tabId);
this.browserActionSetBadgeText(theText, tabId);
return;
} catch { }

View File

@ -135,6 +135,7 @@ export class OptionsComponent implements OnInit {
async updateDisableBadgeCounter() {
await this.storageService.save(ConstantsService.disableBadgeCounterKey, this.disableBadgeCounter);
await this.stateService.save(ConstantsService.disableBadgeCounterKey, this.disableBadgeCounter);
this.messagingService.send('bgUpdateContextMenu');
}
async updateShowCards() {