From 8533b5313a7897637470b83bf6e613cc961f4eaa Mon Sep 17 00:00:00 2001 From: Justin Baur <19896123+justindbaur@users.noreply.github.com> Date: Wed, 28 Sep 2022 14:51:09 -0400 Subject: [PATCH] Remove main.backgroun changes --- .../browser/src/background/main.background.ts | 19 ++++++------------- apps/browser/src/globals.d.ts | 14 +++++--------- 2 files changed, 11 insertions(+), 22 deletions(-) diff --git a/apps/browser/src/background/main.background.ts b/apps/browser/src/background/main.background.ts index 7138733becd0..9a39ef0b481d 100644 --- a/apps/browser/src/background/main.background.ts +++ b/apps/browser/src/background/main.background.ts @@ -109,9 +109,6 @@ import RuntimeBackground from "./runtime.background"; import TabsBackground from "./tabs.background"; import WebRequestBackground from "./webRequest.background"; -type CommonSidebarAction = typeof chrome.sidebarAction | OperaSidebarAction; -type BrowserOrSidebarAction = typeof chrome.browserAction | CommonSidebarAction; - export default class MainBackground { messagingService: MessagingServiceAbstraction; storageService: AbstractStorageService; @@ -177,7 +174,7 @@ export default class MainBackground { private tabsBackground: TabsBackground; private webRequestBackground: WebRequestBackground; - private sidebarAction: CommonSidebarAction; + private sidebarAction: any; private buildingContextMenu: boolean; private menuOptionsLoaded: any[] = []; private syncTimeout: any; @@ -467,7 +464,7 @@ export default class MainBackground { ? null : typeof opr !== "undefined" && opr.sidebarAction ? opr.sidebarAction - : window.chrome.sidebarAction; + : (window as any).chrome.sidebarAction; // Background this.runtimeBackground = new RuntimeBackground( @@ -999,11 +996,7 @@ export default class MainBackground { }); } - private async actionSetIcon( - theAction: BrowserOrSidebarAction, - suffix: string, - windowId?: number - ): Promise { + private async actionSetIcon(theAction: any, suffix: string, windowId?: number): Promise { if (!theAction || !theAction.setIcon) { return; } @@ -1029,8 +1022,8 @@ export default class MainBackground { } } - private actionSetBadgeBackgroundColor(action: BrowserOrSidebarAction) { - if (action && "setBadgeBackgroundColor" in action) { + private actionSetBadgeBackgroundColor(action: any) { + if (action && action.setBadgeBackgroundColor) { action.setBadgeBackgroundColor({ color: "#294e5f" }); } } @@ -1049,7 +1042,7 @@ export default class MainBackground { return; } - if ("setBadgeText" in this.sidebarAction) { + if (this.sidebarAction.setBadgeText) { this.sidebarAction.setBadgeText({ text: text, tabId: tabId, diff --git a/apps/browser/src/globals.d.ts b/apps/browser/src/globals.d.ts index 753c6fd9b10c..9662c3d71b9a 100644 --- a/apps/browser/src/globals.d.ts +++ b/apps/browser/src/globals.d.ts @@ -1,5 +1,3 @@ -export {}; - declare function escape(s: string): string; declare function unescape(s: string): string; /** @@ -126,13 +124,11 @@ declare namespace chrome { | undefined; } +interface Window { + opr: Opera | undefined; + opera: unknown; +} + declare let opr: Opera | undefined; declare let opera: unknown | undefined; declare let safari: any; - -declare global { - interface Window { - opr: Opera | undefined; - opera: unknown; - } -}