diff --git a/iOS/Article/ContextMenuPreviewViewController.swift b/iOS/Article/ContextMenuPreviewViewController.swift
index 24b7d364f..cf321c732 100644
--- a/iOS/Article/ContextMenuPreviewViewController.swift
+++ b/iOS/Article/ContextMenuPreviewViewController.swift
@@ -9,24 +9,34 @@
import UIKit
import Articles
-class ContextMenuPreviewViewController: UIViewController {
+/// Used in the WebView when in full screen mode.
+final class ContextMenuPreviewViewController: UIViewController {
@IBOutlet weak var blogNameLabel: UILabel!
@IBOutlet weak var blogAuthorLabel: UILabel!
@IBOutlet weak var articleTitleLabel: UILabel!
@IBOutlet weak var dateTimeLabel: UILabel!
- var article: Article!
+ var article: Article?
+
+ init(article: Article?) {
+ self.article = article
+ super.init(nibName: "ContextMenuPreviewViewController", bundle: nil)
+ }
+
+ required init?(coder: NSCoder) {
+ super.init(coder: coder)
+ }
override func viewDidLoad() {
super.viewDidLoad()
- blogNameLabel.text = article.feed?.nameForDisplay ?? ""
- blogAuthorLabel.text = article.byline()
- articleTitleLabel.text = article.title ?? ""
-
+ blogNameLabel.text = article?.feed?.nameForDisplay ?? ""
+ blogAuthorLabel.text = article?.byline()
+ articleTitleLabel.text = article?.title ?? ""
+
let icon = IconView()
- icon.iconImage = article.iconImage()
+ icon.iconImage = article?.iconImage()
icon.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(icon)
@@ -40,8 +50,10 @@ class ContextMenuPreviewViewController: UIViewController {
let dateFormatter = DateFormatter()
dateFormatter.dateStyle = .long
dateFormatter.timeStyle = .medium
- dateTimeLabel.text = dateFormatter.string(from: article.logicalDatePublished)
-
+ if let article {
+ dateTimeLabel.text = dateFormatter.string(from: article.logicalDatePublished)
+ }
+
// When in landscape the context menu preview will force this controller into a tiny
// view space. If it is documented anywhere what that is, I haven't found it. This
// set of magic numbers is what I worked out by testing a variety of phones.
diff --git a/iOS/Article/ContextMenuPreviewViewController.xib b/iOS/Article/ContextMenuPreviewViewController.xib
new file mode 100644
index 000000000..67e1f9d0f
--- /dev/null
+++ b/iOS/Article/ContextMenuPreviewViewController.xib
@@ -0,0 +1,103 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/iOS/Article/WebViewController.swift b/iOS/Article/WebViewController.swift
index 75fead013..64c78aa94 100644
--- a/iOS/Article/WebViewController.swift
+++ b/iOS/Article/WebViewController.swift
@@ -720,9 +720,7 @@ private extension WebViewController {
}
func contextMenuPreviewProvider() -> UIViewController {
- let previewProvider = UIStoryboard.main.instantiateController(ofType: ContextMenuPreviewViewController.self)
- previewProvider.article = article
- return previewProvider
+ ContextMenuPreviewViewController(article: article)
}
func prevArticleAction() -> UIAction? {
diff --git a/iOS/Base.lproj/Main.storyboard b/iOS/Base.lproj/Main.storyboard
index 350a30424..84c7b87db 100644
--- a/iOS/Base.lproj/Main.storyboard
+++ b/iOS/Base.lproj/Main.storyboard
@@ -232,93 +232,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -333,12 +246,6 @@
-
-
-
-
-
-