mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Remove some nonisolated marks from methods that are annotated as @MainActor as of Xcode 16.2b1.
This commit is contained in:
@@ -389,7 +389,7 @@ extension WebViewController: UIContextMenuInteractionDelegate {
|
||||
|
||||
extension WebViewController: WKNavigationDelegate {
|
||||
|
||||
nonisolated func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) {
|
||||
func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping @MainActor @Sendable(WKNavigationActionPolicy) -> Void) {
|
||||
|
||||
guard navigationAction.navigationType == .linkActivated else {
|
||||
decisionHandler(.allow)
|
||||
@@ -426,16 +426,13 @@ extension WebViewController: WKNavigationDelegate {
|
||||
}
|
||||
}
|
||||
|
||||
nonisolated func webViewWebContentProcessDidTerminate(_ webView: WKWebView) {
|
||||
func webViewWebContentProcessDidTerminate(_ webView: WKWebView) {
|
||||
|
||||
Task { @MainActor in
|
||||
fullReload()
|
||||
}
|
||||
}
|
||||
|
||||
nonisolated private func openURLInBrowser(_ url: URL) {
|
||||
private func openURLInBrowser(_ url: URL) {
|
||||
|
||||
Task { @MainActor in
|
||||
if AppDefaults.shared.useSystemBrowser {
|
||||
UIApplication.shared.open(url, options: [:])
|
||||
} else {
|
||||
@@ -448,11 +445,9 @@ extension WebViewController: WKNavigationDelegate {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
nonisolated private func openEmailAddressURL(_ url: URL) {
|
||||
private func openEmailAddressURL(_ url: URL) {
|
||||
|
||||
Task { @MainActor in
|
||||
if UIApplication.shared.canOpenURL(url) {
|
||||
UIApplication.shared.open(url, options: [.universalLinksOnly : false], completionHandler: nil)
|
||||
} else {
|
||||
@@ -461,53 +456,45 @@ extension WebViewController: WKNavigationDelegate {
|
||||
self.present(alert, animated: true, completion: nil)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
nonisolated private func openTelURL(_ url: URL) {
|
||||
private func openTelURL(_ url: URL) {
|
||||
|
||||
Task { @MainActor in
|
||||
if UIApplication.shared.canOpenURL(url) {
|
||||
UIApplication.shared.open(url, options: [.universalLinksOnly : false], completionHandler: nil)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: WKUIDelegate
|
||||
|
||||
extension WebViewController: WKUIDelegate {
|
||||
|
||||
nonisolated func webView(_ webView: WKWebView, contextMenuForElement elementInfo: WKContextMenuElementInfo, willCommitWithAnimator animator: UIContextMenuInteractionCommitAnimating) {
|
||||
func webView(_ webView: WKWebView, contextMenuForElement elementInfo: WKContextMenuElementInfo, willCommitWithAnimator animator: UIContextMenuInteractionCommitAnimating) {
|
||||
// We need to have at least an unimplemented WKUIDelegate assigned to the WKWebView. This makes the
|
||||
// link preview launch Safari when the link preview is tapped. In theory, you should be able to get
|
||||
// the link from the elementInfo above and transition to SFSafariViewController instead of launching
|
||||
// Safari. As the time of this writing, the link in elementInfo is always nil. ¯\_(ツ)_/¯
|
||||
}
|
||||
|
||||
nonisolated func webView(_ webView: WKWebView, createWebViewWith configuration: WKWebViewConfiguration, for navigationAction: WKNavigationAction, windowFeatures: WKWindowFeatures) -> WKWebView? {
|
||||
func webView(_ webView: WKWebView, createWebViewWith configuration: WKWebViewConfiguration, for navigationAction: WKNavigationAction, windowFeatures: WKWindowFeatures) -> WKWebView? {
|
||||
guard let url = navigationAction.request.url else {
|
||||
return nil
|
||||
}
|
||||
|
||||
Task { @MainActor in
|
||||
openURL(url)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// MARK: WKScriptMessageHandler
|
||||
|
||||
extension WebViewController: WKScriptMessageHandler {
|
||||
|
||||
nonisolated func userContentController(_ userContentController: WKUserContentController, didReceive message: WKScriptMessage) {
|
||||
func userContentController(_ userContentController: WKUserContentController, didReceive message: WKScriptMessage) {
|
||||
|
||||
let name = message.name
|
||||
let body = message.body as? String
|
||||
|
||||
Task { @MainActor in
|
||||
switch name {
|
||||
case MessageName.imageWasShown:
|
||||
clickedImageCompletion?()
|
||||
@@ -523,8 +510,6 @@ extension WebViewController: WKScriptMessageHandler {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// MARK: UIViewControllerTransitioningDelegate
|
||||
|
||||
extension WebViewController: UIViewControllerTransitioningDelegate {
|
||||
|
||||
Reference in New Issue
Block a user