diff --git a/Shared/Article Rendering/ArticleRenderer.swift b/Shared/Article Rendering/ArticleRenderer.swift index f7572be05..4eca6c0c2 100644 --- a/Shared/Article Rendering/ArticleRenderer.swift +++ b/Shared/Article Rendering/ArticleRenderer.swift @@ -141,7 +141,7 @@ private extension ArticleRenderer { d["title"] = title d["body"] = body - d["avatars"] = ""; + d["avatars"] = ""; var feedLink = "" if let feedTitle = article.webFeed?.nameForDisplay { diff --git a/Shared/Article Rendering/main.js b/Shared/Article Rendering/main.js index 6261daa6f..22a7a8442 100644 --- a/Shared/Article Rendering/main.js +++ b/Shared/Article Rendering/main.js @@ -21,6 +21,11 @@ function convertImgSrc() { }); } +function reloadArticleImage() { + var image = document.getElementById("nnwImageIcon"); + image.src = "nnwImageIcon://"; +} + function error() { document.body.innerHTML = "error"; } diff --git a/iOS/Article/ArticleViewController.swift b/iOS/Article/ArticleViewController.swift index ad24be8f1..3f8689d9c 100644 --- a/iOS/Article/ArticleViewController.swift +++ b/iOS/Article/ArticleViewController.swift @@ -100,6 +100,9 @@ class ArticleViewController: UIViewController { NotificationCenter.default.addObserver(self, selector: #selector(unreadCountDidChange(_:)), name: .UnreadCountDidChange, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(statusesDidChange(_:)), name: .StatusesDidChange, object: nil) + NotificationCenter.default.addObserver(self, selector: #selector(webFeedIconDidBecomeAvailable(_:)), name: .WebFeedIconDidBecomeAvailable, object: nil) + NotificationCenter.default.addObserver(self, selector: #selector(avatarDidBecomeAvailable(_:)), name: .AvatarDidBecomeAvailable, object: nil) + NotificationCenter.default.addObserver(self, selector: #selector(faviconDidBecomeAvailable(_:)), name: .FaviconDidBecomeAvailable, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(contentSizeCategoryDidChange(_:)), name: UIContentSizeCategory.didChangeNotification, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(willEnterForeground(_:)), name: UIApplication.willEnterForegroundNotification, object: nil) @@ -211,6 +214,18 @@ class ArticleViewController: UIViewController { } } + @objc func webFeedIconDidBecomeAvailable(_ note: Notification) { + reloadArticleImage() + } + + @objc func avatarDidBecomeAvailable(_ note: Notification) { + reloadArticleImage() + } + + @objc func faviconDidBecomeAvailable(_ note: Notification) { + reloadArticleImage() + } + @objc func contentSizeCategoryDidChange(_ note: Notification) { reloadHTML() } @@ -427,6 +442,10 @@ private struct ImageClickMessage: Codable { private extension ArticleViewController { + func reloadArticleImage() { + webView?.evaluateJavaScript("reloadArticleImage()") + } + func imageWasClicked(body: String?) { guard let body = body, let data = body.data(using: .utf8), diff --git a/iOS/UIKit Extensions/ThemedNavigationController.swift b/iOS/UIKit Extensions/ThemedNavigationController.swift deleted file mode 100644 index 7b87fb2d0..000000000 --- a/iOS/UIKit Extensions/ThemedNavigationController.swift +++ /dev/null @@ -1,50 +0,0 @@ -// -// ThemedNavigationController.swift -// NetNewsWire -// -// Created by Maurice Parker on 8/22/19. -// Copyright © 2019 Ranchero Software. All rights reserved. -// - -import UIKit - -class ThemedNavigationController: UINavigationController { - - static func template() -> UINavigationController { - let navController = ThemedNavigationController() - navController.configure() - return navController - } - - static func template(rootViewController: UIViewController) -> UINavigationController { - let navController = ThemedNavigationController(rootViewController: rootViewController) - navController.configure() - return navController - } - - override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) { - super.traitCollectionDidChange(previousTraitCollection) - if traitCollection.userInterfaceStyle != previousTraitCollection?.userInterfaceStyle { - configure() - } - } - - private func configure() { - isToolbarHidden = false - view.backgroundColor = AppAssets.barBackgroundColor - - let navigationAppearance = UINavigationBarAppearance() - navigationAppearance.backgroundColor = AppAssets.barBackgroundColor - navigationAppearance.titleTextAttributes = [.foregroundColor: UIColor.label] - navigationAppearance.largeTitleTextAttributes = [.foregroundColor: UIColor.label] - navigationBar.standardAppearance = navigationAppearance - navigationBar.tintColor = AppAssets.primaryAccentColor - - let toolbarAppearance = UIToolbarAppearance() - toolbarAppearance.backgroundColor = AppAssets.barBackgroundColor - toolbar.standardAppearance = toolbarAppearance - toolbar.compactAppearance = toolbarAppearance - toolbar.tintColor = AppAssets.primaryAccentColor - } - -}