Skip to content

Conversation

@kean
Copy link
Contributor

@kean kean commented Jun 24, 2025

Closes https://linear.app/a8c/issue/CMM-530/settingsselectionviewcontroller-objc

A mechanical rewrite from Objective-C to Swift. No functional changes.

Simulator.Screen.Recording.-.iPhone.16.Pro.-.2025-06-24.at.15.35.45.mov

@dangermattic
Copy link
Collaborator

dangermattic commented Jun 24, 2025

1 Warning
⚠️ This PR is assigned to the milestone 26.0. The due date for this milestone has already passed.
Please assign it to a milestone with a later deadline or check whether the release for this milestone has already been finished.

Generated by 🚫 Danger

Post *post = self.post;
NSArray *titles = post.blog.sortedPostFormatNames;

if (![self.internetReachability isReachable] && self.formatsList.count == 0) {
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 only significant logic change is here – it will no longer stop you from opening the app if the app thinks it's offline and there are not synced formats. In this case, it will open and show an EmptyStateView with an error and a way to refresh.

import WordPressUI

@MainActor
struct PostFormatPicker: View {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

If there will be more similar use cases, I'll look into generalizing this.

// Readonly Properties
@property (nonatomic, weak, readonly, nullable) NSArray *sortedPostFormatNames;
@property (nonatomic, weak, readonly, nullable) NSArray *sortedPostFormats;
@property (nonatomic, weak, readonly, nullable) NSArray *sortedConnections;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Claude rewrote these too, so I went with it.

@kean kean force-pushed the task/add-post-format-picker branch from 82f3b98 to 67773de Compare June 24, 2025 19:44
@kean kean requested a review from crazytonyli June 24, 2025 19:44
@kean kean added this to the 26.0 milestone Jun 24, 2025
@kean kean force-pushed the task/add-post-format-picker branch from 67773de to 9bdf328 Compare June 24, 2025 19:46
@sonarqubecloud
Copy link

@wpmobilebot
Copy link
Contributor

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 Number27975
VersionPR #24620
Bundle IDorg.wordpress.alpha
Commit9bdf328
Installation URL0rg4eqv06ojjg
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@wpmobilebot
Copy link
Contributor

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 Number27975
VersionPR #24620
Bundle IDcom.jetpack.alpha
Commit9bdf328
Installation URL1nrvthrsmqtho
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

self.blog = post.blog
let formats = post.blog.sortedPostFormatNames
self._formats = State(initialValue: formats)
self._selction = State(initialValue: post.postFormatText() ?? "")
Copy link
Contributor

Choose a reason for hiding this comment

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

I was going to suggest moving this to onAppear like you did in #24597 (comment). However, I just realised that changes to these properties may get reverted when the onAppear method is called again (see #24597 (comment)).

@kean kean changed the base branch from trunk to feature/post-settings June 26, 2025 14:13
@kean kean merged commit 4295235 into feature/post-settings Jun 26, 2025
32 of 34 checks passed
@kean kean deleted the task/add-post-format-picker branch June 26, 2025 14:13
@kean kean mentioned this pull request Jun 26, 2025
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