1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-28 12:45:45 +01:00

try revert getAppPath

This commit is contained in:
Chad Scharf 2020-05-14 14:44:11 -04:00
parent 10e04580d7
commit d5ab36e577
2 changed files with 17 additions and 0 deletions

View File

@ -133,6 +133,16 @@ export class BrowserApi {
} }
} }
static getAssetUrl(path: string): Promise<string> {
if (BrowserApi.isChromeApi) {
return Promise.resolve(chrome.extension.getURL(path));
} else if (BrowserApi.isSafariApi) {
return SafariApp.sendMessageToApp('getAppPath');
} else {
return Promise.resolve(null);
}
}
static messageListener(name: string, callback: (message: any, sender: any, response: any) => void) { static messageListener(name: string, callback: (message: any, sender: any, response: any) => void) {
if (BrowserApi.isChromeApi) { if (BrowserApi.isChromeApi) {
chrome.runtime.onMessage.addListener((msg: any, sender: any, response: any) => { chrome.runtime.onMessage.addListener((msg: any, sender: any, response: any) => {

View File

@ -205,6 +205,13 @@ class SafariExtensionViewController: SFSafariExtensionViewController, WKScriptMe
} }
} }
} }
} else if command == "getAppPath" {
SFSafariExtension.getBaseURI(completionHandler: { uri in
if uri != nil {
m!.responseData = uri!.absoluteString
self.replyMessage(message: m!)
}
})
} }
} }