Merge pull request #1349 from bitwarden/fix/safar-completion-handler-nil
Added logging and completion handler for JS
This commit is contained in:
commit
5861a51d54
|
@ -96,7 +96,12 @@ class SafariExtensionViewController: SFSafariExtensionViewController, WKScriptMe
|
||||||
let messagesUrl = bundleUrl.appendingPathComponent("app/_locales/\(language)/messages.json")
|
let messagesUrl = bundleUrl.appendingPathComponent("app/_locales/\(language)/messages.json")
|
||||||
do {
|
do {
|
||||||
let json = try String(contentsOf: messagesUrl, encoding: .utf8)
|
let json = try String(contentsOf: messagesUrl, encoding: .utf8)
|
||||||
webView.evaluateJavaScript("window.bitwardenLocaleStrings = \(json);", completionHandler: nil)
|
webView.evaluateJavaScript("window.bitwardenLocaleStrings = \(json);", completionHandler: {(result, error) in
|
||||||
|
guard let err = error else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
NSLog("evaluateJavaScript error : %@", err.localizedDescription);
|
||||||
|
})
|
||||||
} catch {
|
} catch {
|
||||||
NSLog("ERROR on getLocaleStrings, \(error)")
|
NSLog("ERROR on getLocaleStrings, \(error)")
|
||||||
}
|
}
|
||||||
|
@ -236,7 +241,12 @@ class SafariExtensionViewController: SFSafariExtensionViewController, WKScriptMe
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
let json = (jsonSerialize(obj: message) ?? "null")
|
let json = (jsonSerialize(obj: message) ?? "null")
|
||||||
webView.evaluateJavaScript("window.bitwardenSafariAppMessageReceiver(\(json));", completionHandler: nil)
|
webView.evaluateJavaScript("window.bitwardenSafariAppMessageReceiver(\(json));", completionHandler: {(result, error) in
|
||||||
|
guard let err = error else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
NSLog("evaluateJavaScript error : %@", err.localizedDescription);
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue