diff --git a/iOS/Article/WebViewController.swift b/iOS/Article/WebViewController.swift index d8e59ff05..2aba0acb7 100644 --- a/iOS/Article/WebViewController.swift +++ b/iOS/Article/WebViewController.swift @@ -22,6 +22,7 @@ class WebViewController: UIViewController { private struct MessageName { static let imageWasClicked = "imageWasClicked" static let imageWasShown = "imageWasShown" + static let showFeedInspector = "showFeedInspector" } private var topShowBarsView: UIView! @@ -345,6 +346,10 @@ extension WebViewController: WKScriptMessageHandler { clickedImageCompletion?() case MessageName.imageWasClicked: imageWasClicked(body: message.body as? String) + case MessageName.showFeedInspector: + if let webFeed = article?.webFeed { + coordinator.showFeedInspector(for: webFeed) + } default: return } @@ -440,6 +445,7 @@ private extension WebViewController { webView.configuration.userContentController.add(WrapperScriptMessageHandler(self), name: MessageName.imageWasClicked) webView.configuration.userContentController.add(WrapperScriptMessageHandler(self), name: MessageName.imageWasShown) + webView.configuration.userContentController.add(WrapperScriptMessageHandler(self), name: MessageName.showFeedInspector) self.renderPage(webView) diff --git a/iOS/Resources/main_ios.js b/iOS/Resources/main_ios.js index a3dba0b9a..84508f002 100644 --- a/iOS/Resources/main_ios.js +++ b/iOS/Resources/main_ios.js @@ -96,7 +96,7 @@ class ImageViewer { // Add the click listener for images window.onclick = function(event) { - if (event.target.matches("img") && event.target.id != "nnwImageIcon") { + if (event.target.matches("img")) { if (activeImageViewer && activeImageViewer.img === event.target) { cancelImageLoad(); } else { @@ -130,6 +130,13 @@ function showClickedImage() { window.webkit.messageHandlers.imageWasShown.postMessage(""); } +function showFeedInspectorSetup() { + document.getElementById("nnwImageIcon").onclick = function(event) { + window.webkit.messageHandlers.showFeedInspector.postMessage(""); + } +} + function postRenderProcessing() { ImageViewer.init(); + showFeedInspectorSetup(); }