Skip to content

Commit

Permalink
Update ReaderTagCell to new UI
Browse files Browse the repository at this point in the history
  • Loading branch information
wargcm committed May 9, 2024
1 parent 65bed38 commit c75c384
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 39 deletions.
4 changes: 2 additions & 2 deletions WordPress/Classes/ViewRelated/Reader/ReaderPost+Display.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ extension ReaderPost {
}

func summaryForDisplay(isPad: Bool = false) -> String? {
if featuredImageURLForDisplay() == nil || isPad {
if isPad {
let content = contentForDisplay()?
.stringByDecodingXMLCharacters()
.replacingOccurrences(of: "<br>", with: "\n")
Expand All @@ -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))
}
}
Expand Down
8 changes: 4 additions & 4 deletions WordPress/Classes/ViewRelated/Reader/ReaderTagCardCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

}
Expand Down
3 changes: 3 additions & 0 deletions WordPress/Classes/ViewRelated/Reader/ReaderTagCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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!
Expand Down Expand Up @@ -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
}
Expand All @@ -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
Expand Down
93 changes: 60 additions & 33 deletions WordPress/Classes/ViewRelated/Reader/ReaderTagCell.xib
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="32700.99.1234" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_12" orientation="portrait" appearance="light"/>
<device id="ipad12_9rounded" orientation="portrait" layout="fullscreen" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22684"/>
Expand All @@ -12,23 +12,23 @@
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="iN0-l3-epB" customClass="ReaderTagCell" customModule="WordPress" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="240" height="297"/>
<rect key="frame" x="0.0" y="0.0" width="600" height="300"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="4" translatesAutoresizingMaskIntoConstraints="NO" id="v9V-wn-SvM">
<rect key="frame" x="0.0" y="0.0" width="240" height="258"/>
<rect key="frame" x="0.0" y="0.0" width="600" height="261"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" verticalHuggingPriority="252" alignment="center" spacing="4" translatesAutoresizingMaskIntoConstraints="NO" id="N0b-ln-6rk">
<rect key="frame" x="0.0" y="0.0" width="240" height="20.333333333333332"/>
<rect key="frame" x="0.0" y="0.0" width="600" height="20.5"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="252" verticalHuggingPriority="252" text="Site Title" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="nBe-Ng-tUu">
<rect key="frame" x="0.0" y="0.0" width="66.333333333333329" height="20.333333333333332"/>
<rect key="frame" x="0.0" y="0.0" width="66.5" height="20.5"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="252" horizontalCompressionResistancePriority="751" text="Post Date" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="hSx-Fu-Ptn">
<rect key="frame" x="70.333333333333329" y="0.0" width="169.66666666666669" height="20.333333333333332"/>
<rect key="frame" x="70.5" y="0.0" width="529.5" height="20.5"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
Expand All @@ -38,39 +38,65 @@
<constraint firstItem="nBe-Ng-tUu" firstAttribute="height" secondItem="N0b-ln-6rk" secondAttribute="height" id="jXp-aM-FWa"/>
</constraints>
</stackView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="TopLeft" horizontalHuggingPriority="251" verticalCompressionResistancePriority="751" text="Title" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="DsY-TC-klp" userLabel="Title">
<rect key="frame" x="0.0" y="24.333333333333336" width="240" height="20.333333333333336"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="TopLeft" horizontalHuggingPriority="251" verticalHuggingPriority="249" text="Summary" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="5KT-0Z-POw" userLabel="Summary">
<rect key="frame" x="0.0" y="48.666666666666664" width="240" height="20.333333333333336"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="247" verticalCompressionResistancePriority="753" translatesAutoresizingMaskIntoConstraints="NO" id="Yfj-e7-Vti" customClass="CachedAnimatedImageView" customModule="WordPress" customModuleProvider="target">
<rect key="frame" x="0.0" y="73" width="240" height="150"/>
<constraints>
<constraint firstAttribute="height" constant="150" id="mXK-lY-civ">
<variation key="heightClass=regular-widthClass=regular" constant="300"/>
</constraint>
</constraints>
</imageView>
<view contentMode="scaleToFill" verticalHuggingPriority="248" verticalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="l2P-MZ-TCd" userLabel="Spacer">
<rect key="frame" x="0.0" y="227" width="240" height="6.6666666666666572"/>
</view>
<stackView opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="kbG-di-VIy">
<rect key="frame" x="0.0" y="24.5" width="600" height="212"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="6wc-NQ-auo">
<rect key="frame" x="0.0" y="0.0" width="440" height="212"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="TopLeft" horizontalHuggingPriority="251" verticalCompressionResistancePriority="751" text="Title" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="DsY-TC-klp" userLabel="Title">
<rect key="frame" x="0.0" y="0.0" width="440" height="20.5"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="TopLeft" horizontalHuggingPriority="251" verticalHuggingPriority="249" text="Summary" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="5KT-0Z-POw" userLabel="Summary">
<rect key="frame" x="0.0" y="20.5" width="440" height="20.5"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<view contentMode="scaleToFill" verticalHuggingPriority="248" verticalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="l2P-MZ-TCd" userLabel="Spacer">
<rect key="frame" x="0.0" y="41" width="440" height="171"/>
</view>
</subviews>
</stackView>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="4xC-jQ-qSx">
<rect key="frame" x="440" y="0.0" width="160" height="212"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="247" verticalCompressionResistancePriority="753" translatesAutoresizingMaskIntoConstraints="NO" id="Yfj-e7-Vti" customClass="CachedAnimatedImageView" customModule="WordPress" customModuleProvider="target">
<rect key="frame" x="16" y="42" width="128" height="128"/>
<constraints>
<constraint firstAttribute="height" constant="64" id="XBK-3t-dbs">
<variation key="heightClass=regular-widthClass=regular" constant="128"/>
</constraint>
<constraint firstAttribute="width" constant="64" id="w56-oE-UTR">
<variation key="heightClass=regular-widthClass=regular" constant="128"/>
</constraint>
</constraints>
</imageView>
</subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstAttribute="bottom" relation="greaterThanOrEqual" secondItem="Yfj-e7-Vti" secondAttribute="bottom" id="KBw-an-VIL"/>
<constraint firstItem="Yfj-e7-Vti" firstAttribute="centerY" secondItem="4xC-jQ-qSx" secondAttribute="centerY" id="LuZ-lC-ZId"/>
<constraint firstAttribute="trailing" secondItem="Yfj-e7-Vti" secondAttribute="trailing" constant="16" id="laL-w6-T4j"/>
<constraint firstItem="Yfj-e7-Vti" firstAttribute="leading" secondItem="4xC-jQ-qSx" secondAttribute="leading" constant="16" id="oxv-Ga-1sZ"/>
<constraint firstItem="Yfj-e7-Vti" firstAttribute="top" relation="greaterThanOrEqual" secondItem="4xC-jQ-qSx" secondAttribute="top" id="qlz-me-zhX"/>
</constraints>
</view>
</subviews>
</stackView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" verticalCompressionResistancePriority="752" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="TWL-MA-3CF" userLabel="Counts">
<rect key="frame" x="0.0" y="237.66666666666666" width="240" height="20.333333333333343"/>
<rect key="frame" x="0.0" y="240.5" width="600" height="20.5"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="1nC-hH-hbw">
<rect key="frame" x="0.0" y="253" width="240" height="44"/>
<rect key="frame" x="0.0" y="256" width="600" height="44"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="252" verticalHuggingPriority="251" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="B3r-hf-7wD">
<rect key="frame" x="0.0" y="0.0" width="52" height="44"/>
Expand All @@ -86,10 +112,10 @@
</connections>
</button>
<view contentMode="scaleToFill" verticalHuggingPriority="249" horizontalCompressionResistancePriority="749" translatesAutoresizingMaskIntoConstraints="NO" id="0q4-yh-1OL" userLabel="Spacer">
<rect key="frame" x="52" y="0.0" width="144" height="44"/>
<rect key="frame" x="52" y="0.0" width="504" height="44"/>
</view>
<button opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="RMF-3Z-42A">
<rect key="frame" x="196" y="0.0" width="44" height="44"/>
<rect key="frame" x="556" y="0.0" width="44" height="44"/>
<constraints>
<constraint firstAttribute="width" constant="44" id="lnk-h8-Ngi"/>
<constraint firstAttribute="height" constant="44" id="o9C-UX-9Am"/>
Expand Down Expand Up @@ -120,6 +146,7 @@
<outlet property="countsLabel" destination="TWL-MA-3CF" id="SLO-VX-N94"/>
<outlet property="countsLabelSpacerView" destination="l2P-MZ-TCd" id="8QA-n2-RoI"/>
<outlet property="featuredImageView" destination="Yfj-e7-Vti" id="BCL-Ej-cp3"/>
<outlet property="featuredImageViewContainer" destination="4xC-jQ-qSx" id="rAQ-lq-Xsz"/>
<outlet property="headerStackView" destination="N0b-ln-6rk" id="9VK-Sj-aYS"/>
<outlet property="likeButton" destination="B3r-hf-7wD" id="Jua-cj-3ZZ"/>
<outlet property="menuButton" destination="RMF-3Z-42A" id="O3N-Cs-hjz"/>
Expand Down

0 comments on commit c75c384

Please sign in to comment.