Skip to content

Commit

Permalink
Merge pull request #390 from potatojoayo/master
Browse files Browse the repository at this point in the history
fix: #389 [macOS] Terminating app due to uncaught exception 'NSIntern…
  • Loading branch information
darwin-morocho authored Feb 14, 2024
2 parents 0e8d308 + f4e3c13 commit 056b17f
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ public class WebViewController: NSViewController, WKNavigationDelegate {
var targetUriFragment: String?
var onComplete: ((String?) -> Void)?
var onDismissed: (() -> Void)?

var window: NSWindow?

public override func loadView() {
self.title = ""
let webView = WKWebView(frame: NSMakeRect(0, 0, 980, 720))
Expand All @@ -68,6 +69,10 @@ public class WebViewController: NSViewController, WKNavigationDelegate {

view = webView
}

public override func viewDidAppear() {
window = self.view.window!
}

func loadUrl(_ url: String) {
clearCookies()
Expand Down Expand Up @@ -99,7 +104,7 @@ public class WebViewController: NSViewController, WKNavigationDelegate {
if uriString.contains(targetUriFragment!) {
decisionHandler(.cancel)
onComplete!(uriString)
dismiss(self)
window?.performClose(nil);
} else {
decisionHandler(.allow)
}
Expand Down

0 comments on commit 056b17f

Please sign in to comment.