Merge pull request #2129 from bitwarden/reduce-binking-of-notificationBar
Reduce blinking of notification bar
This commit is contained in:
commit
581e0421ca
|
@ -94,6 +94,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"jslib/common": {
|
"jslib/common": {
|
||||||
|
"name": "@bitwarden/jslib-common",
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|
|
@ -2,24 +2,21 @@ import MainBackground from './main.background';
|
||||||
import NotificationBackground from './notification.background';
|
import NotificationBackground from './notification.background';
|
||||||
|
|
||||||
export default class TabsBackground {
|
export default class TabsBackground {
|
||||||
private tabs: any;
|
|
||||||
|
|
||||||
constructor(private main: MainBackground, private notificationBackground: NotificationBackground) {
|
constructor(private main: MainBackground, private notificationBackground: NotificationBackground) {
|
||||||
this.tabs = chrome.tabs;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async init() {
|
async init() {
|
||||||
if (!this.tabs) {
|
if (!chrome.tabs) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.tabs.onActivated.addListener(async (activeInfo: any) => {
|
chrome.tabs.onActivated.addListener(async (activeInfo: chrome.tabs.TabActiveInfo) => {
|
||||||
await this.main.refreshBadgeAndMenu();
|
await this.main.refreshBadgeAndMenu();
|
||||||
this.main.messagingService.send('tabActivated');
|
this.main.messagingService.send('tabActivated');
|
||||||
this.main.messagingService.send('tabChanged');
|
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) {
|
if (this.main.onReplacedRan) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -30,12 +27,12 @@ export default class TabsBackground {
|
||||||
this.main.messagingService.send('tabChanged');
|
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) {
|
if (this.main.onUpdatedRan) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.main.onUpdatedRan = true;
|
this.main.onUpdatedRan = true;
|
||||||
await this.notificationBackground.checkNotificationQueue();
|
await this.notificationBackground.checkNotificationQueue(tab);
|
||||||
await this.main.refreshBadgeAndMenu();
|
await this.main.refreshBadgeAndMenu();
|
||||||
this.main.messagingService.send('tabUpdated');
|
this.main.messagingService.send('tabUpdated');
|
||||||
this.main.messagingService.send('tabChanged');
|
this.main.messagingService.send('tabChanged');
|
||||||
|
|
|
@ -467,6 +467,7 @@ document.addEventListener('DOMContentLoaded', event => {
|
||||||
const iframe = document.createElement('iframe');
|
const iframe = document.createElement('iframe');
|
||||||
iframe.style.cssText = 'height: 42px; width: 100%; border: 0; min-height: initial;';
|
iframe.style.cssText = 'height: 42px; width: 100%; border: 0; min-height: initial;';
|
||||||
iframe.id = 'bit-notification-bar-iframe';
|
iframe.id = 'bit-notification-bar-iframe';
|
||||||
|
iframe.src = barPageUrl;
|
||||||
|
|
||||||
const frameDiv = document.createElement('div');
|
const frameDiv = document.createElement('div');
|
||||||
frameDiv.setAttribute('aria-live', 'polite');
|
frameDiv.setAttribute('aria-live', 'polite');
|
||||||
|
|
Loading…
Reference in New Issue