remove ols safari api dependencies
This commit is contained in:
parent
d585c21c38
commit
80d0bd68f1
|
@ -9,7 +9,6 @@ import { PasswordGenerationService } from 'jslib/abstractions/passwordGeneration
|
|||
import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
|
||||
|
||||
export default class CommandsBackground {
|
||||
private commands: any;
|
||||
private isSafari: boolean;
|
||||
private isEdge: boolean;
|
||||
private isVivaldi: boolean;
|
||||
|
@ -20,22 +19,17 @@ export default class CommandsBackground {
|
|||
this.isSafari = this.platformUtilsService.isSafari();
|
||||
this.isEdge = this.platformUtilsService.isEdge();
|
||||
this.isVivaldi = this.platformUtilsService.isVivaldi();
|
||||
this.commands = this.isSafari ? safari.application : chrome.commands;
|
||||
}
|
||||
|
||||
async init() {
|
||||
if (!this.commands && !this.isEdge) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.isSafari || this.isEdge || this.isVivaldi) {
|
||||
BrowserApi.messageListener(async (msg: any, sender: any, sendResponse: any) => {
|
||||
if (msg.command === 'keyboardShortcutTriggered' && msg.shortcut) {
|
||||
await this.processCommand(msg.shortcut, sender);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.commands.onCommand.addListener(async (command: any) => {
|
||||
} else if (chrome && chrome.commands && !this.isEdge) {
|
||||
chrome.commands.onCommand.addListener(async (command: any) => {
|
||||
await this.processCommand(command);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -367,6 +367,10 @@ export default class MainBackground {
|
|||
|
||||
async openPopup() {
|
||||
// Chrome APIs cannot open popup
|
||||
|
||||
// TODO: Do we need to open this popup?
|
||||
|
||||
/*
|
||||
if (!this.isSafari || !safari.extension.toolbarItems || !safari.extension.toolbarItems.length) {
|
||||
return;
|
||||
}
|
||||
|
@ -378,6 +382,7 @@ export default class MainBackground {
|
|||
if (activeToolBars && activeToolBars.length) {
|
||||
activeToolBars[0].showPopover();
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
async reseedStorage() {
|
||||
|
|
|
@ -39,7 +39,7 @@ export default class RuntimeBackground {
|
|||
private analytics: Analytics, private notificationsService: NotificationsService,
|
||||
private systemService: SystemService, private lockService: LockService) {
|
||||
this.isSafari = this.platformUtilsService.isSafari();
|
||||
this.runtime = this.isSafari ? safari.application : chrome.runtime;
|
||||
this.runtime = this.isSafari ? {} : chrome.runtime;
|
||||
|
||||
// onInstalled listener must be wired up before anything else, so we do it in the ctor
|
||||
if (!this.isSafari) {
|
||||
|
@ -56,6 +56,8 @@ export default class RuntimeBackground {
|
|||
|
||||
if (this.isSafari) {
|
||||
// Reload the popup when it's opened
|
||||
// TODO
|
||||
/*
|
||||
this.runtime.addEventListener('popover', (event: any) => {
|
||||
const win: Window = event.target.contentWindow;
|
||||
let href = win.location.href;
|
||||
|
@ -69,6 +71,7 @@ export default class RuntimeBackground {
|
|||
win.location.href = href;
|
||||
}
|
||||
}, true);
|
||||
*/
|
||||
}
|
||||
|
||||
await this.checkOnInstalled();
|
||||
|
|
|
@ -8,7 +8,7 @@ export default class TabsBackground {
|
|||
|
||||
constructor(private main: MainBackground, private platformUtilsService: PlatformUtilsService) {
|
||||
this.isSafari = this.platformUtilsService.isSafari();
|
||||
this.tabs = this.isSafari ? safari.application : chrome.tabs;
|
||||
this.tabs = this.isSafari ? null : chrome.tabs;
|
||||
}
|
||||
|
||||
async init() {
|
||||
|
@ -17,6 +17,7 @@ export default class TabsBackground {
|
|||
}
|
||||
|
||||
if (this.isSafari) {
|
||||
/*
|
||||
this.tabs.addEventListener('activate', async (ev: any) => {
|
||||
await this.main.refreshBadgeAndMenu();
|
||||
}, true);
|
||||
|
@ -25,6 +26,7 @@ export default class TabsBackground {
|
|||
await this.main.checkNotificationQueue();
|
||||
await this.main.refreshBadgeAndMenu();
|
||||
}, true);
|
||||
*/
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue