eleven / ocho Public

ios: fix macOS build — drop duplicate WKUIDelegate alert/confirm methods (#183)

PRs #93, #104 and #105 each added a JS panel handler to ChatFeedWebView's
Coordinator. #104 branched before the other two landed, so its squash-merge
re-declared both runJavaScriptAlertPanelWithMessage and
runJavaScriptConfirmPanelWithMessage — "invalid redeclaration" broke the
Build Native macOS App workflow on main.

Keep #104's sheet-based (beginSheetModal) implementations — non-blocking, so
they don't freeze the page's JS thread while a confirm()/alert() awaits its
answer — and delete the two older runModal()-based duplicates.
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Paul Campbell 3469b22e5a135b3ed84ae3a29d9bed2d7179607a parent 4f73889
1 file changed, +0 −27
  • ios/LChatMac/ChatFeedWebView.swift +0 −27
diff --git a/ios/LChatMac/ChatFeedWebView.swift b/ios/LChatMac/ChatFeedWebView.swift
index 461dc9d..f9b34e4 100644
--- a/ios/LChatMac/ChatFeedWebView.swift
+++ b/ios/LChatMac/ChatFeedWebView.swift
@@ -322,33 +322,6 @@ struct ChatFeedWebView: NSViewRepresentable {
}
}
- // chat.js reports failures (e.g. "couldn't add that file") with alert();
- // macOS WKWebView drops those silently unless the host shows the panel, so
- // real errors looked like nothing happening.
- func webView(_ webView: WKWebView,
- runJavaScriptAlertPanelWithMessage message: String,
- initiatedByFrame frame: WKFrameInfo,
- completionHandler: @escaping () -> Void) {
- let alert = NSAlert()
- alert.messageText = message
- alert.runModal()
- completionHandler()
- }
-
- // confirm() ("Delete this message for everyone?" …) needs a real answer:
- // without this hook WKWebView resolves it to false silently, so the tap
- // looks dead — the same failure alert() had above.
- func webView(_ webView: WKWebView,
- runJavaScriptConfirmPanelWithMessage message: String,
- initiatedByFrame frame: WKFrameInfo,
- completionHandler: @escaping (Bool) -> Void) {
- let alert = NSAlert()
- alert.messageText = message
- alert.addButton(withTitle: "OK")
- alert.addButton(withTitle: "Cancel")
- completionHandler(alert.runModal() == .alertFirstButtonReturn)
- }
-
// macOS WKWebView needs this hook or the composer's "+" file picker does
// nothing (unlike iOS).
func webView(_ webView: WKWebView,