Merge pull request #2129 from bitwarden/reduce-binking-of-notificationBar

Reduce blinking of notification bar
This commit is contained in:
Daniel James Smith 2021-10-20 15:22:17 +02:00 committed by GitHub
commit 581e0421ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 8 deletions

1
package-lock.json generated
View File

@ -94,6 +94,7 @@
}
},
"jslib/common": {
"name": "@bitwarden/jslib-common",
"version": "0.0.0",
"license": "GPL-3.0",
"dependencies": {

View File

@ -2,24 +2,21 @@ import MainBackground from './main.background';
import NotificationBackground from './notification.background';
export default class TabsBackground {
private tabs: any;
constructor(private main: MainBackground, private notificationBackground: NotificationBackground) {
this.tabs = chrome.tabs;
}
async init() {
if (!this.tabs) {
if (!chrome.tabs) {
return;
}
this.tabs.onActivated.addListener(async (activeInfo: any) => {
chrome.tabs.onActivated.addListener(async (activeInfo: chrome.tabs.TabActiveInfo) => {
await this.main.refreshBadgeAndMenu();
this.main.messagingService.send('tabActivated');
this.main.messagingService.send('tabChanged');
});
this.tabs.onReplaced.addListener(async (addedTabId: any, removedTabId: any) => {
chrome.tabs.onReplaced.addListener(async (addedTabId: number, removedTabId: number) => {
if (this.main.onReplacedRan) {
return;
}
@ -30,12 +27,12 @@ export default class TabsBackground {
this.main.messagingService.send('tabChanged');
});
this.tabs.onUpdated.addListener(async (tabId: any, changeInfo: any, tab: any) => {
chrome.tabs.onUpdated.addListener(async (tabId: number, changeInfo: chrome.tabs.TabChangeInfo, tab: chrome.tabs.Tab) => {
if (this.main.onUpdatedRan) {
return;
}
this.main.onUpdatedRan = true;
await this.notificationBackground.checkNotificationQueue();
await this.notificationBackground.checkNotificationQueue(tab);
await this.main.refreshBadgeAndMenu();
this.main.messagingService.send('tabUpdated');
this.main.messagingService.send('tabChanged');

View File

@ -467,6 +467,7 @@ document.addEventListener('DOMContentLoaded', event => {
const iframe = document.createElement('iframe');
iframe.style.cssText = 'height: 42px; width: 100%; border: 0; min-height: initial;';
iframe.id = 'bit-notification-bar-iframe';
iframe.src = barPageUrl;
const frameDiv = document.createElement('div');
frameDiv.setAttribute('aria-live', 'polite');