1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-07 09:31:31 +01:00

compile fixes

This commit is contained in:
Kyle Spearrin 2019-08-13 11:40:54 -04:00
parent 58a73bcb0f
commit 384f3f1e47
2 changed files with 8 additions and 6 deletions

View File

@ -1,3 +1,5 @@
import { SafariApp } from './safariApp';
export class BrowserApi { export class BrowserApi {
static isWebExtensionsApi: boolean = (typeof browser !== 'undefined'); static isWebExtensionsApi: boolean = (typeof browser !== 'undefined');
static isSafariApi: boolean = (window as any).safariAppExtension === true; static isSafariApi: boolean = (window as any).safariAppExtension === true;
@ -222,7 +224,7 @@ export class BrowserApi {
} else if (BrowserApi.isWebExtensionsApi || BrowserApi.isChromeApi) { } else if (BrowserApi.isWebExtensionsApi || BrowserApi.isChromeApi) {
win.close(); win.close();
} else if (BrowserApi.isSafariApi && safari.extension.popovers && safari.extension.popovers.length > 0) { } else if (BrowserApi.isSafariApi && safari.extension.popovers && safari.extension.popovers.length > 0) {
BrowserApi.sendSafariMessageToApp({ command: 'hideWindow' }); SafariApp.sendMessageToApp('hideWindow');
} }
} }
@ -286,7 +288,7 @@ export class BrowserApi {
if (win != null) { if (win != null) {
return win.location.reload(true); return win.location.reload(true);
} else if (BrowserApi.isSafariApi) { } else if (BrowserApi.isSafariApi) {
BrowserApi.sendSafariMessageToApp({ command: 'reloadWindow' }); SafariApp.sendMessageToApp('reloadWindow');
} else if (!BrowserApi.isSafariApi) { } else if (!BrowserApi.isSafariApi) {
return chrome.runtime.reload(); return chrome.runtime.reload();
} }

View File

@ -1,14 +1,14 @@
import { BrowserApi } from '../browser/browserApi'; import { BrowserApi } from '../browser/browserApi';
import { SafariApp } from '../browser/safariApp';
import { MessagingService } from 'jslib/abstractions'; import { MessagingService } from 'jslib/abstractions/messaging.service';
export default class BrowserMessagingService implements MessagingService { export default class BrowserMessagingService implements MessagingService {
send(subscriber: string, arg: any = {}) { send(subscriber: string, arg: any = {}) {
const message = Object.assign({}, { command: subscriber }, arg);
if (BrowserApi.isSafariApi) { if (BrowserApi.isSafariApi) {
BrowserApi.sendSafariMessageToApp(message); SafariApp.sendMessageToApp(subscriber, arg);
} else { } else {
const message = Object.assign({}, { command: subscriber }, arg);
chrome.runtime.sendMessage(message); chrome.runtime.sendMessage(message);
} }
} }