Add code to show the Feed Inspector when the feed icon in the article view is pressed. Issue #1931

This commit is contained in:
Maurice Parker
2020-04-28 21:26:57 -05:00
parent 5e4ebb7298
commit a48cbfe1ca
2 changed files with 14 additions and 1 deletions

View File

@@ -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)