-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Translate post types to Swift #25056
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
| App Name | WordPress | |
| Configuration | Release-Alpha | |
| Build Number | 30131 | |
| Version | PR #25056 | |
| Bundle ID | org.wordpress.alpha | |
| Commit | 2cfc79a | |
| Installation URL | 2avgu0lg69us0 |
|
| App Name | Jetpack | |
| Configuration | Release-Alpha | |
| Build Number | 30131 | |
| Version | PR #25056 | |
| Bundle ID | com.jetpack.alpha | |
| Commit | 2cfc79a | |
| Installation URL | 5egj01rl6oam0 |
13f529a to
3e0e4d9
Compare
Generated by 🚫 Danger |
|
|
||
| // A ReaderCard can have either a post, or a list of topics, but not both. | ||
| // Since this card has a post, we can confidently set `topics` to NULL. | ||
| if responds(to: #selector(getter: card)), let managedObjectContext, let firstCard = card?.first { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd double-check if this works, and check if it's needed in the first place and if there are ways to refactor it. I can't say I have a lot of confidence in these types of Swift and Objective-C interactions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep. I have double-checked. The responds(to:) in the new Swift code returns true, and the if branch is executed. I'm pretty certain the card is always available in practice. The original Objective-C code was introduced in #17117. Since the commit message mentioned migration, I thought I'd be extra careful here and keep the original code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! I'm sure there is more similar stuff to remove. A lot of these methods were added to satisfy interfaces that were only ever used on regular (not Reader) posts.
| return content.isEmpty || content == emptyGBParagraph | ||
| } | ||
|
|
||
| public func contentPreviewForDisplay() -> String? { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(nit) It would be ideal to remove it. I don't think we need it for ReaderPost.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call. Removed in 2cfc79a
|





Description
It should be straightforward to review commits by commit.
You can test by editing posts & pages, viewing posts and comments in the Reader.