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

fix appversion query string

This commit is contained in:
Kyle Spearrin 2019-08-20 23:38:51 -04:00
parent 972fef9d50
commit c6be0b31c1

View File

@ -30,14 +30,15 @@ class SafariExtensionViewController: SFSafariExtensionViewController, WKScriptMe
let parentWidth = SafariExtensionViewController.shared.preferredContentSize.width
let webViewConfig = WKWebViewConfiguration()
let bundleURL = Bundle.main.resourceURL!.absoluteURL
let html = bundleURL.appendingPathComponent("app/popup/index.html?appVersion=\(version!)")
let html = bundleURL.appendingPathComponent("app/popup/index.html")
let url = URL(string: "\(html.absoluteString)?appVersion=\(version!)")
webViewConfig.preferences.setValue(true, forKey: "allowFileAccessFromFileURLs")
webViewConfig.preferences.setValue(true, forKey: "developerExtrasEnabled")
webViewConfig.userContentController.add(self, name: "bitwardenApp")
webView = WKWebView(frame: CGRect(x: 0, y: 0, width: parentWidth, height: parentHeight), configuration: webViewConfig)
webView.navigationDelegate = self
webView.allowsLinkPreview = false
webView.loadFileURL(html, allowingReadAccessTo: bundleURL)
webView.loadFileURL(url!, allowingReadAccessTo: bundleURL)
webView.alphaValue = 0.0
view.addSubview(webView)
}