Skip to content

Commit

Permalink
Fixlint
Browse files Browse the repository at this point in the history
  • Loading branch information
BPerlakiH authored and kelson42 committed Nov 1, 2024
1 parent f85839d commit 017315a
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions ViewModel/BrowserViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,7 @@ final class BrowserViewModel: NSObject, ObservableObject,
// MARK: - New Tab Creation

#if os(macOS)
@MainActor
private func createNewWindow(with url: URL) -> Bool {
guard let currentWindow = NSApp.keyWindow,
let windowController = currentWindow.windowController else { return false }
Expand Down Expand Up @@ -536,6 +537,7 @@ final class BrowserViewModel: NSObject, ObservableObject,
return nil
}
#else
@MainActor
func webView(
_ webView: WKWebView,
createWebViewWith configuration: WKWebViewConfiguration,
Expand All @@ -550,7 +552,6 @@ final class BrowserViewModel: NSObject, ObservableObject,
externalURL = newURL
return nil
}
NotificationCenter.openURL(newURL, inNewTab: true)
return nil
}
#endif
Expand All @@ -572,21 +573,23 @@ final class BrowserViewModel: NSObject, ObservableObject,
return WebViewController(webView: webView)
},
actionProvider: { [weak self] _ in
guard let self = self else { return UIMenu(children: []) }
guard let self else { return UIMenu(children: []) }
var actions = [UIAction]()

// open url
actions.append(
UIAction(title: "common.dialog.button.open".localized,
image: UIImage(systemName: "doc.text")) { _ in
webView.load(URLRequest(url: url))
image: UIImage(systemName: "doc.text")) { [weak self] _ in
self?.webView.load(URLRequest(url: url))
}
)
actions.append(
UIAction(title: "common.dialog.button.open_in_new_tab".localized,
image: UIImage(systemName: "doc.badge.plus")) { [weak self] _ in
guard let self = self else { return }
NotificationCenter.openURL(url, inNewTab: true)
guard let self else { return }
Task { @MainActor in
NotificationCenter.openURL(url, inNewTab: true)
}
}
)

Expand Down

0 comments on commit 017315a

Please sign in to comment.