From 8defddfdd1c73a0472fac4ccebec6e2768abe1ba Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Tue, 20 Aug 2019 23:12:35 -0400 Subject: [PATCH] set app version in query string --- .../desktop/safari/SafariExtensionViewController.swift | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/safari/app/desktop/safari/SafariExtensionViewController.swift b/src/safari/app/desktop/safari/SafariExtensionViewController.swift index 64fca079a7..91b4c33085 100644 --- a/src/safari/app/desktop/safari/SafariExtensionViewController.swift +++ b/src/safari/app/desktop/safari/SafariExtensionViewController.swift @@ -24,12 +24,13 @@ class SafariExtensionViewController: SFSafariExtensionViewController, WKScriptMe if initedWebView { return } + let version = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String initedWebView = true let parentHeight = SafariExtensionViewController.shared.preferredContentSize.height let parentWidth = SafariExtensionViewController.shared.preferredContentSize.width let webViewConfig = WKWebViewConfiguration() let bundleURL = Bundle.main.resourceURL!.absoluteURL - let html = bundleURL.appendingPathComponent("app/popup/index.html") + let html = bundleURL.appendingPathComponent("app/popup/index.html?appVersion=\(version!)") webViewConfig.preferences.setValue(true, forKey: "allowFileAccessFromFileURLs") webViewConfig.preferences.setValue(true, forKey: "developerExtrasEnabled") webViewConfig.userContentController.add(self, name: "bitwardenApp") @@ -69,8 +70,9 @@ class SafariExtensionViewController: SFSafariExtensionViewController, WKScriptMe let command = m!.command // print(command) if command == "windowLoaded" { - let version = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String - webView.evaluateJavaScript("window.bitwardenApplicationVersion = '\(version)';", completionHandler: nil) + // let version = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String + // webView.evaluateJavaScript("window.bitwardenApplicationVersion = '\(version!)';", completionHandler: nil) + // Set things } else if command == "storage_get" { let obj = UserDefaults.standard.string(forKey: m!.data!) m!.responseData = obj