Skip to content

Conversation

@crazytonyli
Copy link
Contributor

Description

The majority of the changes are translated, without much of the swiftification. I made small improvements here and there, but not a lot.

Testing instructions

The best way to test this change is to run the trunk branch and this branch on the iPad and iPhone simulators. Go to a WP.com site and a self-hosted site. You should not notice any difference in the blog details, which can be

  • the left part of the split screen on the home screen on an iPad.
  • WP.com site -> My Sites -> More
  • The home screen of self-hosted sites.

@crazytonyli crazytonyli added this to the 26.6 milestone Nov 11, 2025
@crazytonyli crazytonyli requested a review from jkmassel November 11, 2025 03:22
@dangermattic
Copy link
Collaborator

2 Warnings
⚠️ View files have been modified, but no screenshot or video is included in the pull request. Consider adding some for clarity.
⚠️ This PR is larger than 500 lines of changes. Please consider splitting it into smaller PRs for easier and faster reviews.

Generated by 🚫 Danger

@wpmobilebot
Copy link
Contributor

wpmobilebot commented Nov 11, 2025

App Icon📲 You can test the changes from this Pull Request in WordPress by scanning the QR code below to install the corresponding build.
App NameWordPress
ConfigurationRelease-Alpha
Build Number30050
VersionPR #24981
Bundle IDorg.wordpress.alpha
Commit0b06d52
Installation URL1homnrvpvsq8o
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@wpmobilebot
Copy link
Contributor

wpmobilebot commented Nov 11, 2025

App Icon📲 You can test the changes from this Pull Request in Jetpack by scanning the QR code below to install the corresponding build.
App NameJetpack
ConfigurationRelease-Alpha
Build Number30050
VersionPR #24981
Bundle IDcom.jetpack.alpha
Commit0b06d52
Installation URL42fcsnqcue0qg
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@crazytonyli crazytonyli requested a review from kean December 1, 2025 20:28
Copy link
Contributor

@kean kean left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I smoke-tested the changes on iPhone and iPad and it worked as expected. Left a couple of comments.

}
}

@objc public final class BlogDetailsTableViewModel: NSObject {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of this code typically belongs to the ViewController: cell registration, cell configuration, sections, delegate & data source, scrolling, etc. Would it be feasible to move it to the ViewController?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The structure is mainly a byproduct of the gradual ObjC code to Swift translation. We can probably move things around and refine the structure. But I think that can be done later if needed. The purpose of this PR is to make the view controller a Swift implementation, so that we don't have to jump between ObjC and Swift code when adding a row or something to the blog details screen.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But I think that can be done later if needed.

That sounds good. This code definitely doesn't belong to a ViewModel though. I would appreciate if you could create a follow up PR to clean things up a bit. Approving as is for now.

static func home(viewController: BlogDetailsViewController?) -> Row {
Row(
kind: .home,
title: NSLocalizedString("Home", comment: "Noun. Links to a blog's dashboard screen."),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(nit) It'd be great to add namespace-based keys for this file

title: BlogDetailsViewController.Strings.subscribers,
image: UIImage(named: "wpl-mail"),
action: { [weak viewController] _ in
MainActor.assumeIsolated {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(nit) MainActor.assumeIsolated seems unnecessary. if it is, I'd suggest making action @MainActor.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The assumeIsolated is added to fix a compilation issue due to SubscribersBlog being bound to the main actor.

}

@objc public func shouldAddJetpackSection() -> Bool {
public func shouldAddJetpackSection() -> Bool {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These methods look particularly out of place with most of the UI code in the ViewModel (see previous comment). This code actually does seem that it might belong to a ViewModel.

(nit) I'd suggest to put these in a single shouldShow(_ section: Section) method.

}
enum Strings {
static let contentSectionTitle = NSLocalizedString(
"my-site.menu.content.section.title",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(nit) It should be camelCase (mySite.*). Marking as nit as it's the existing code.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated in 0b06d52

@crazytonyli crazytonyli enabled auto-merge December 2, 2025 21:47
@sonarqubecloud
Copy link

sonarqubecloud bot commented Dec 2, 2025

@kean kean self-requested a review December 2, 2025 22:13
Copy link
Contributor

@kean kean left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved with one outstanding comments regarding the ViewModel.

@crazytonyli crazytonyli added this pull request to the merge queue Dec 2, 2025
Merged via the queue into trunk with commit 0111945 Dec 2, 2025
30 of 32 checks passed
@crazytonyli crazytonyli deleted the blog-details-view-controller-swift branch December 2, 2025 22:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants