Skip to content

Commit 7df0df4

Browse files
committed
Remove curent featured image
1 parent e64a372 commit 7df0df4

File tree

3 files changed

+5
-194
lines changed

3 files changed

+5
-194
lines changed

WordPress/Classes/ViewRelated/Reader/Detail/ReaderDetailCoordinator.swift

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -534,20 +534,6 @@ class ReaderDetailCoordinator {
534534
scrollToHashIfNeeded()
535535
}
536536

537-
/// Show the featured image fullscreen
538-
///
539-
private func showFeaturedImage(_ sender: AsyncImageView) {
540-
guard let post, let imageURL = post.featuredImage.flatMap(URL.init) else {
541-
return
542-
}
543-
let lightboxVC = LightboxViewController(sourceURL: imageURL, host: MediaHost(post))
544-
MainActor.assumeIsolated {
545-
lightboxVC.thumbnail = sender.image
546-
}
547-
lightboxVC.configureZoomTransition(sourceView: sender)
548-
viewController?.present(lightboxVC, animated: true)
549-
}
550-
551537
private func followSite(completion: @escaping () -> Void) {
552538
guard let post else {
553539
return
@@ -729,12 +715,6 @@ extension ReaderDetailCoordinator: ReaderDetailHeaderViewDelegate {
729715

730716
}
731717

732-
extension ReaderDetailCoordinator: ReaderDetailFeaturedImageViewDelegate {
733-
func didTapFeaturedImage(_ sender: AsyncImageView) {
734-
showFeaturedImage(sender)
735-
}
736-
}
737-
738718
extension ReaderDetailCoordinator: ReaderDetailLikesViewDelegate {
739719
func didTapLikesView() {
740720
showLikesList()

WordPress/Classes/ViewRelated/Reader/Detail/ReaderDetailViewController.storyboard

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="24412" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="24765" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
33
<device id="retina6_1" orientation="portrait" appearance="light"/>
44
<dependencies>
5-
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="24405"/>
5+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="24743"/>
66
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
77
<capability name="System colors in document resources" minToolsVersion="11.0"/>
88
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
@@ -17,7 +17,7 @@
1717
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
1818
<subviews>
1919
<scrollView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" layoutMarginsFollowReadableWidth="YES" alwaysBounceVertical="YES" translatesAutoresizingMaskIntoConstraints="NO" id="9JA-VQ-zzw">
20-
<rect key="frame" x="0.0" y="96" width="414" height="800"/>
20+
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
2121
<subviews>
2222
<view contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Xyq-y6-zPR">
2323
<rect key="frame" x="0.0" y="0.0" width="446" height="254.5"/>
@@ -134,7 +134,7 @@
134134
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
135135
<constraints>
136136
<constraint firstItem="ybg-ZD-3Ou" firstAttribute="width" secondItem="HkO-UB-8qv" secondAttribute="width" id="Flu-a4-g3F"/>
137-
<constraint firstItem="9JA-VQ-zzw" firstAttribute="top" secondItem="Tqp-x3-yXv" secondAttribute="top" id="JMy-49-ddC"/>
137+
<constraint firstItem="9JA-VQ-zzw" firstAttribute="top" secondItem="HkO-UB-8qv" secondAttribute="top" id="JMy-49-ddC"/>
138138
<constraint firstItem="9JA-VQ-zzw" firstAttribute="leading" secondItem="Tqp-x3-yXv" secondAttribute="leading" id="KOc-Yv-UWy"/>
139139
<constraint firstItem="Tqp-x3-yXv" firstAttribute="trailing" secondItem="9JA-VQ-zzw" secondAttribute="trailing" id="u3i-rm-kZv"/>
140140
<constraint firstItem="9JA-VQ-zzw" firstAttribute="bottom" secondItem="HkO-UB-8qv" secondAttribute="bottom" id="x0z-7E-pgA"/>
@@ -149,7 +149,6 @@
149149
<outlet property="likesContainerView" destination="qXQ-id-Ffz" id="DL3-un-wtF"/>
150150
<outlet property="relatedPostsTableView" destination="CpT-U7-bfv" id="Ndh-H4-FlR"/>
151151
<outlet property="scrollView" destination="9JA-VQ-zzw" id="lCO-o1-bLB"/>
152-
<outlet property="scrollViewTopConstraint" destination="JMy-49-ddC" id="l9q-Ed-ERC"/>
153152
<outlet property="webView" destination="iSu-TI-yew" id="DQy-Fd-C3y"/>
154153
<outlet property="webViewHeight" destination="ywz-kG-xyW" id="q3p-wI-yeb"/>
155154
</connections>

WordPress/Classes/ViewRelated/Reader/Detail/ReaderDetailViewController.swift

Lines changed: 1 addition & 169 deletions
Original file line numberDiff line numberDiff line change
@@ -68,23 +68,8 @@ class ReaderDetailViewController: UIViewController, ReaderDetailView {
6868
/// Attribution view for Discovery posts
6969
@IBOutlet weak var attributionView: ReaderCardDiscoverAttributionView!
7070

71-
@IBOutlet weak var scrollViewTopConstraint: NSLayoutConstraint!
72-
7371
private let activityIndicator = UIActivityIndicatorView(style: .medium)
7472

75-
/// The actual header
76-
private let featuredImageView = ReaderDetailFeaturedImageView()
77-
78-
private var heroView: ReaderHeroView?
79-
80-
private var isNewFeaturedImageEnabled: Bool {
81-
if #available(iOS 26, *) {
82-
return true
83-
} else {
84-
return false
85-
}
86-
}
87-
8873
/// The actual header
8974
private lazy var header = ReaderDetailHeaderHostingView()
9075

@@ -128,12 +113,6 @@ class ReaderDetailViewController: UIViewController, ReaderDetailView {
128113
}
129114
}
130115

131-
var currentPreferredStatusBarStyle = UIStatusBarStyle.lightContent {
132-
didSet {
133-
setNeedsStatusBarAppearanceUpdate()
134-
}
135-
}
136-
137116
override var hidesBottomBarWhenPushed: Bool {
138117
set { }
139118
get { true }
@@ -201,7 +180,6 @@ class ReaderDetailViewController: UIViewController, ReaderDetailView {
201180
configureNavigationBar()
202181
applyStyles()
203182
configureWebView()
204-
configureLegacyFeaturedImage()
205183
configureHeader()
206184
configureRelatedPosts()
207185
configureToolbar()
@@ -215,13 +193,6 @@ class ReaderDetailViewController: UIViewController, ReaderDetailView {
215193

216194
startObservingPost()
217195

218-
if #available(iOS 26, *) {
219-
scrollViewTopConstraint?.isActive = false
220-
scrollView.pinEdges(.top)
221-
222-
headerContainerView.clipsToBounds = true
223-
}
224-
225196
// Fixes swipe to go back not working when leftBarButtonItem is set
226197
navigationController?.interactivePopGestureRecognizer?.delegate = self
227198

@@ -249,18 +220,10 @@ class ReaderDetailViewController: UIViewController, ReaderDetailView {
249220
super.viewWillAppear(animated)
250221

251222
updateLeftBarButtonItem()
252-
setupFeaturedImage()
253223
updateFollowButtonState()
254224
toolbar.viewWillAppear()
255225

256-
if #unavailable(iOS 26) {
257-
DispatchQueue.main.asyncAfter(deadline: .now() + .milliseconds(100)) {
258-
// Workaround for tab bar dismiss iteraction
259-
self.navigationController?.setToolbarHidden(false, animated: animated)
260-
}
261-
} else {
262-
navigationController?.setToolbarHidden(false, animated: animated)
263-
}
226+
navigationController?.setToolbarHidden(false, animated: animated)
264227
}
265228

266229
override func viewWillDisappear(_ animated: Bool) {
@@ -270,23 +233,10 @@ class ReaderDetailViewController: UIViewController, ReaderDetailView {
270233
return
271234
}
272235

273-
if !isNewFeaturedImageEnabled {
274-
featuredImageView.viewWillDisappear()
275-
}
276236
toolbar.viewWillDisappear()
277237
navigationController?.setToolbarHidden(true, animated: animated)
278238
}
279239

280-
override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
281-
super.viewWillTransition(to: size, with: coordinator)
282-
283-
if !isNewFeaturedImageEnabled {
284-
coordinator.animate(alongsideTransition: { _ in
285-
self.featuredImageView.deviceDidRotate()
286-
})
287-
}
288-
}
289-
290240
override func accessibilityPerformEscape() -> Bool {
291241
navigationController?.popViewController(animated: true)
292242
return true
@@ -296,19 +246,9 @@ class ReaderDetailViewController: UIViewController, ReaderDetailView {
296246
scrollView
297247
}
298248

299-
override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
300-
super.traitCollectionDidChange(previousTraitCollection)
301-
302-
let isCompact = traitCollection.horizontalSizeClass == .compact
303-
headerContainerView.layer.cornerRadius = isCompact ? DesignConstants.radius(.large) : 0
304-
headerContainerView.layer.maskedCorners = isCompact ? [.layerMaxXMinYCorner, .layerMinXMinYCorner] : []
305-
}
306-
307249
func render(_ post: ReaderPost) {
308250
configureDiscoverAttribution(post)
309251

310-
setupHeroView()
311-
featuredImageView.configure(for: post, with: self)
312252
toolbar.configure(for: post, in: self)
313253
updateToolbarItems()
314254
header.configure(for: post)
@@ -328,10 +268,6 @@ class ReaderDetailViewController: UIViewController, ReaderDetailView {
328268
}
329269

330270
navigateToCommentIfNecessary()
331-
332-
if !isNewFeaturedImageEnabled && !featuredImageView.isLoaded {
333-
featuredImageView.load()
334-
}
335271
}
336272

337273
private func showPostContent(_ post: ReaderPost) {
@@ -557,9 +493,6 @@ class ReaderDetailViewController: UIViewController, ReaderDetailView {
557493
header.displaySetting = displaySetting
558494
}
559495

560-
// Featured image view
561-
featuredImageView.displaySetting = displaySetting
562-
563496
// Update Reader Post web view
564497
if let contentForDisplay = post?.contentForDisplay() {
565498
webView.displaySetting = displaySetting
@@ -615,95 +548,6 @@ class ReaderDetailViewController: UIViewController, ReaderDetailView {
615548
}
616549
}
617550

618-
private func setupFeaturedImage() {
619-
if isNewFeaturedImageEnabled {
620-
setupHeroView()
621-
} else {
622-
setupLegacyFeaturedImage()
623-
}
624-
}
625-
626-
override func viewDidLayoutSubviews() {
627-
super.viewDidLayoutSubviews()
628-
629-
layoutHeroView()
630-
}
631-
632-
private func setupHeroView() {
633-
guard isNewFeaturedImageEnabled else {
634-
return
635-
}
636-
guard let post, let imageURL = post.featuredImageURL,
637-
!post.contentIncludesFeaturedImage() else {
638-
return
639-
}
640-
if heroView == nil {
641-
let heroView = ReaderHeroView()
642-
heroView.configureTapGesture(in: scrollView) { [weak self] in
643-
self?.coordinator?.didTapFeaturedImage($0)
644-
}
645-
view.insertSubview(heroView, belowSubview: scrollView)
646-
self.heroView = heroView
647-
}
648-
if heroView?.imageURL != imageURL {
649-
heroView?.imageURL = imageURL
650-
heroView?.imageView.setImage(with: ImageRequest(url: imageURL, host: MediaHost(post)))
651-
}
652-
layoutHeroView()
653-
}
654-
655-
private func layoutHeroView() {
656-
guard let heroView else {
657-
return
658-
}
659-
let contentInsetTop = heroView.imageView.frame.height + heroView.estimatedStatusBarOffset - view.safeAreaInsets.top
660-
if contentInsetTop != scrollView.contentInset.top {
661-
// `contentInset` is automatically adjusted to include safeAreaInsets.top
662-
scrollView.contentInset.top = contentInsetTop
663-
}
664-
// DesignConstants.radius(.large) to extend a bit behind the header view
665-
let heroViewFrame = CGRect(x: 0, y: 0, width: view.bounds.width, height: max(0, -scrollView.contentOffset.y + heroView.bottomExtensionHeight))
666-
if heroViewFrame != heroView.frame {
667-
heroView.frame = heroViewFrame
668-
}
669-
}
670-
671-
private func setupLegacyFeaturedImage() {
672-
configureLegacyFeaturedImage()
673-
674-
featuredImageView.configure(
675-
scrollView: scrollView,
676-
navigationBar: navigationController?.navigationBar,
677-
navigationItem: navigationItem
678-
)
679-
680-
if !featuredImageView.isLoaded {
681-
featuredImageView.load()
682-
}
683-
}
684-
685-
private func configureLegacyFeaturedImage() {
686-
guard featuredImageView.superview == nil else {
687-
return
688-
}
689-
690-
if ReaderDisplaySettings.customizationEnabled {
691-
featuredImageView.displaySetting = displaySetting
692-
}
693-
694-
featuredImageView.delegate = coordinator
695-
696-
view.insertSubview(featuredImageView, belowSubview: scrollView)
697-
698-
NSLayoutConstraint.activate([
699-
featuredImageView.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: 0),
700-
featuredImageView.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: 0),
701-
featuredImageView.topAnchor.constraint(equalTo: view.topAnchor, constant: 0)
702-
])
703-
704-
headerContainerView.translatesAutoresizingMaskIntoConstraints = false
705-
}
706-
707551
private func configureHeader() {
708552
header.displaySetting = displaySetting
709553
header.delegate = coordinator
@@ -1072,7 +916,6 @@ extension ReaderDetailViewController: UIScrollViewDelegate {
1072916
toolbarHiddenDebouncer.send(false) // Scrolling up
1073917
}
1074918
lastContentOffset = currentOffset
1075-
layoutHeroView()
1076919
}
1077920

1078921
private func setNeedsToolbarHidden(_ isHidden: Bool) {
@@ -1215,17 +1058,6 @@ extension ReaderDetailViewController: ReaderCardDiscoverAttributionViewDelegate
12151058
}
12161059
}
12171060

1218-
// MARK: - UpdatableStatusBarStyle
1219-
extension ReaderDetailViewController: UpdatableStatusBarStyle {
1220-
func updateStatusBarStyle(to style: UIStatusBarStyle) {
1221-
guard style != currentPreferredStatusBarStyle else {
1222-
return
1223-
}
1224-
1225-
currentPreferredStatusBarStyle = style
1226-
}
1227-
}
1228-
12291061
// MARK: - Transitioning Delegate
12301062

12311063
extension ReaderDetailViewController: UIViewControllerTransitioningDelegate {

0 commit comments

Comments
 (0)