From bf427fe29a131fa7b8c603cb8b754579a3defb7a Mon Sep 17 00:00:00 2001 From: Tony Li Date: Tue, 25 Nov 2025 14:43:58 +1300 Subject: [PATCH 1/2] Reader: Show error description when failing to load posts Fixes https://linear.app/a8c/issue/CMM-815 --- .../Reader/Detail/ReaderDetailCoordinator.swift | 4 ++-- .../Reader/Detail/ReaderDetailViewController.swift | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/WordPress/Classes/ViewRelated/Reader/Detail/ReaderDetailCoordinator.swift b/WordPress/Classes/ViewRelated/Reader/Detail/ReaderDetailCoordinator.swift index bc20c638dcee..adc05fc6e104 100644 --- a/WordPress/Classes/ViewRelated/Reader/Detail/ReaderDetailCoordinator.swift +++ b/WordPress/Classes/ViewRelated/Reader/Detail/ReaderDetailCoordinator.swift @@ -347,7 +347,7 @@ class ReaderDetailCoordinator { self?.post = post self?.renderPostAndBumpStats() }, failure: { [weak self] error in - self?.postURL == nil ? self?.showError(error: error) : self?.view?.showErrorWithWebAction() + self?.postURL == nil ? self?.showError(error: error) : self?.view?.showErrorWithWebAction(error: error?.localizedDescription) self?.reportPostLoadFailure() }) } @@ -363,7 +363,7 @@ class ReaderDetailCoordinator { self?.renderPostAndBumpStats() }, failure: { [weak self] error in DDLogError("Error fetching post for detail: \(String(describing: error?.localizedDescription))") - self?.postURL == nil ? self?.showError(error: error) : self?.view?.showErrorWithWebAction() + self?.postURL == nil ? self?.showError(error: error) : self?.view?.showErrorWithWebAction(error: error?.localizedDescription) self?.reportPostLoadFailure() }) } diff --git a/WordPress/Classes/ViewRelated/Reader/Detail/ReaderDetailViewController.swift b/WordPress/Classes/ViewRelated/Reader/Detail/ReaderDetailViewController.swift index fa815c1bd501..a459fca42dca 100644 --- a/WordPress/Classes/ViewRelated/Reader/Detail/ReaderDetailViewController.swift +++ b/WordPress/Classes/ViewRelated/Reader/Detail/ReaderDetailViewController.swift @@ -14,7 +14,7 @@ protocol ReaderDetailView: AnyObject { func renderRelatedPosts(_ posts: [RemoteReaderSimplePost]) func showLoading() func showError(subtitle: String?) - func showErrorWithWebAction() + func showErrorWithWebAction(error: String?) func scroll(to: String) func updateHeader() func updateLikesView(with viewModel: ReaderDetailLikesViewModel) @@ -399,8 +399,8 @@ class ReaderDetailViewController: UIViewController, ReaderDetailView { } /// Shown an error with a button to open the post on the browser - func showErrorWithWebAction() { - displayLoadingViewWithWebAction(title: LoadingText.errorLoadingTitle) + func showErrorWithWebAction(error: String?) { + displayLoadingViewWithWebAction(title: LoadingText.errorLoadingTitle, subtitle: error) } /// Scroll the content to a given #hash @@ -1122,9 +1122,10 @@ private extension ReaderDetailViewController { showLoadingView() } - func displayLoadingViewWithWebAction(title: String, accessoryView: UIView? = nil) { + func displayLoadingViewWithWebAction(title: String, subtitle: String? = nil, accessoryView: UIView? = nil) { noResultsViewController.configure(title: title, buttonTitle: LoadingText.errorLoadingPostURLButtonTitle, + subtitle: subtitle, accessoryView: accessoryView) showLoadingView() } From 55fb2339f91efdd8d4bf362069cccd04436d4cca Mon Sep 17 00:00:00 2001 From: Tony Li Date: Tue, 25 Nov 2025 15:06:27 +1300 Subject: [PATCH 2/2] Fix unit tests --- .../Tests/Reader/ReaderDetailCoordinatorTests.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/KeystoneTests/Tests/Reader/ReaderDetailCoordinatorTests.swift b/Tests/KeystoneTests/Tests/Reader/ReaderDetailCoordinatorTests.swift index 1d47ae3af672..fcb0f3047cfb 100644 --- a/Tests/KeystoneTests/Tests/Reader/ReaderDetailCoordinatorTests.swift +++ b/Tests/KeystoneTests/Tests/Reader/ReaderDetailCoordinatorTests.swift @@ -330,7 +330,7 @@ private class ReaderDetailViewMock: UIViewController, ReaderDetailView { didCallShowError = true } - func showErrorWithWebAction() { + func showErrorWithWebAction(error: String?) { didCallShowErrorWithWebAction = true }