From c75c384754909e7ef090426497697a9ab3d7d99c Mon Sep 17 00:00:00 2001
From: Chris McGraw <2454408+wargcm@users.noreply.github.com>
Date: Thu, 9 May 2024 19:44:56 -0400
Subject: [PATCH] Update `ReaderTagCell` to new UI
---
.../Reader/ReaderPost+Display.swift | 4 +-
.../Reader/ReaderTagCardCell.swift | 8 +-
.../ViewRelated/Reader/ReaderTagCell.swift | 3 +
.../ViewRelated/Reader/ReaderTagCell.xib | 93 ++++++++++++-------
4 files changed, 69 insertions(+), 39 deletions(-)
diff --git a/WordPress/Classes/ViewRelated/Reader/ReaderPost+Display.swift b/WordPress/Classes/ViewRelated/Reader/ReaderPost+Display.swift
index fc4a935209f8..7945bb1b50c2 100644
--- a/WordPress/Classes/ViewRelated/Reader/ReaderPost+Display.swift
+++ b/WordPress/Classes/ViewRelated/Reader/ReaderPost+Display.swift
@@ -24,7 +24,7 @@ extension ReaderPost {
}
func summaryForDisplay(isPad: Bool = false) -> String? {
- if featuredImageURLForDisplay() == nil || isPad {
+ if isPad {
let content = contentForDisplay()?
.stringByDecodingXMLCharacters()
.replacingOccurrences(of: "
", with: "\n")
@@ -33,7 +33,7 @@ extension ReaderPost {
.replacingOccurrences(of: "\n{2,}", with: "\n\n", options: .regularExpression)
.trim()
if let content {
- let maxContentLength = isPad ? 4000 : 500
+ let maxContentLength = 3000
return String(content.prefix(maxContentLength))
}
}
diff --git a/WordPress/Classes/ViewRelated/Reader/ReaderTagCardCell.swift b/WordPress/Classes/ViewRelated/Reader/ReaderTagCardCell.swift
index 24d6f7639dac..08206fc32844 100644
--- a/WordPress/Classes/ViewRelated/Reader/ReaderTagCardCell.swift
+++ b/WordPress/Classes/ViewRelated/Reader/ReaderTagCardCell.swift
@@ -84,10 +84,10 @@ class ReaderTagCardCell: UITableViewCell {
}
struct Constants {
- static let phoneDefaultCellSize = CGSize(width: 240, height: 297)
- static let phoneLargeCellSize = CGSize(width: 240, height: 500)
- static let padDefaultCellSize = CGSize(width: 480, height: 600)
- static let padLargeCellSize = CGSize(width: 480, height: 900)
+ static let phoneDefaultCellSize = CGSize(width: 300, height: 150)
+ static let phoneLargeCellSize = CGSize(width: 300, height: 300)
+ static let padDefaultCellSize = CGSize(width: 600, height: 300)
+ static let padLargeCellSize = CGSize(width: 600, height: 600)
}
}
diff --git a/WordPress/Classes/ViewRelated/Reader/ReaderTagCell.swift b/WordPress/Classes/ViewRelated/Reader/ReaderTagCell.swift
index 59e55baf4d97..25532ad3294c 100644
--- a/WordPress/Classes/ViewRelated/Reader/ReaderTagCell.swift
+++ b/WordPress/Classes/ViewRelated/Reader/ReaderTagCell.swift
@@ -10,6 +10,7 @@ class ReaderTagCell: UICollectionViewCell {
@IBOutlet private weak var postDateLabel: UILabel!
@IBOutlet private weak var titleLabel: UILabel!
@IBOutlet private weak var summaryLabel: UILabel!
+ @IBOutlet private weak var featuredImageViewContainer: UIView!
@IBOutlet private weak var featuredImageView: CachedAnimatedImageView!
@IBOutlet private weak var countsLabel: UILabel!
@IBOutlet private weak var likeButton: UIButton!
@@ -90,6 +91,7 @@ private extension ReaderTagCell {
func loadFeaturedImage(with post: ReaderPost) {
guard let url = post.featuredImageURLForDisplay() else {
+ featuredImageViewContainer.isHidden = true
featuredImageView.isHidden = true
return
}
@@ -105,6 +107,7 @@ private extension ReaderTagCell {
siteLabel.isHidden = false
titleLabel.isHidden = false
summaryLabel.isHidden = false
+ featuredImageViewContainer.isHidden = false
featuredImageView.isHidden = false
countsLabel.isHidden = false
likeButton.isHidden = false
diff --git a/WordPress/Classes/ViewRelated/Reader/ReaderTagCell.xib b/WordPress/Classes/ViewRelated/Reader/ReaderTagCell.xib
index fe227266f4a1..14e8aa7832d6 100644
--- a/WordPress/Classes/ViewRelated/Reader/ReaderTagCell.xib
+++ b/WordPress/Classes/ViewRelated/Reader/ReaderTagCell.xib
@@ -1,6 +1,6 @@
-
+
@@ -12,23 +12,23 @@
-
+
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
+