Skip to content
This repository was archived by the owner on Sep 15, 2025. It is now read-only.

Conversation

@ealeksandrov
Copy link
Contributor

@ealeksandrov ealeksandrov commented Aug 6, 2021

Description

This PR updates deployment target to iOS 13 in line with other libraries, WP-iOS and WC-iOS.
The main reason for immediate upgrade is CocoaPods issue here - wordpress-mobile/WordPressAuthenticator-iOS#612 (comment)

It also fixes all new deprecation warnings.

Due to issues with "boot simulator" CI step I had to also update Xcode and iOS versions in CircleCI config.

Testing Details

Build and run unit tests. Please check code for deprecation updates closely since they are not covered by unit tests.

@ealeksandrov ealeksandrov added the enhancement New feature or request label Aug 6, 2021
@ealeksandrov ealeksandrov self-assigned this Aug 6, 2021
@ealeksandrov ealeksandrov requested a review from dvdchr August 6, 2021 12:42
Copy link
Contributor

@mokagio mokagio left a comment

Choose a reason for hiding this comment

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

Thank you @ealeksandrov 🙌

I particularly appreciate how you went ahead and updated everything that was necessary and like your 1 warning fix per commit approach 👍


Sorry for not getting onto this earlier. Now you have a little conflict on the pod version because I released 4.39.0 stable as part of the WordPress iOS 18.0 code freeze.

DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = WordPressKit/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
Copy link
Contributor

Choose a reason for hiding this comment

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

It's not clear in this diff, but by opening the project in Xcode I saw you decided to remove the target-level deployment setting, making them all use the project-level one.

Great idea 👍

_ = scanUpToString(quoteString)
_ = scanString(quoteString)
quote = scanUpToString(quoteString)
_ = scanUpToString(quoteString)
Copy link
Contributor

Choose a reason for hiding this comment

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

This change looks good.

It's understandably out of scope for this PR, I wish there had been already a test to verify it 😞

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree. I've spent some time digging in and:

  • Looks like this extension is broken (or I don't understand the logic behind it in my tests).
  • WP-iOS has its own very similar extensions for NSScanner and NSAttributedString.
  • This Scanner extension used only in NSMutableAttributedString extension which is unused in library and declared internal.

I've decided to decouple this issue into separate branch (and remove duplicated code from WP there):
https://github.com/wordpress-mobile/WordPressKit-iOS/tree/update/quotes-attributes-extension

Copy link
Contributor

@mokagio mokagio Aug 9, 2021

Choose a reason for hiding this comment

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

Great digging! Keep me posted on in please. Now I'm curious to see how the cleanup will evolve 🍿

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Latest update: unused extension removed from lib in #449 + WP part refactored with tests in wordpress-mobile/WordPress-iOS#17259

Comment on lines 333 to 336
var evaluationError: CFError?
_ = SecTrustEvaluateWithError(serverTrust, &evaluationError)
var result = SecTrustResultType.invalid
let certificateStatus = SecTrustEvaluate(serverTrust, &result)
let certificateStatus = SecTrustGetTrustResult(serverTrust, &result)
Copy link
Contributor

Choose a reason for hiding this comment

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

Again, I don't think improving this code is necessarily in scope for this PR, but I noticed two things.

  • evaluationError is unused. I guess we don't get a warning from the compiler because of the assignment in line 334, but the code itself never reads it. Is there any kind of error handling that we should do here? Maybe previous authors have more insight on the kind of treatment this code deserves? cc @jleandroperez @astralbodies
  • While there is a test for the class (🎉) it might not be enough to cover this scenario. I overrode result with .invalid after this line and the test still passed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right, I was also experimenting with it, but decided to keep exact same logic as before. Any additional input on this would be nice!
Removed unused error var in 4669e9f.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hey there folks! I'm afraid I can't recall working on this code, too many years :(

That being said, if there's a Trust evaluation error, I doubt there's much we can do. Fallback to "default handling", and the URL Request should fail IMO

Copy link
Contributor

@dvdchr dvdchr left a comment

Choose a reason for hiding this comment

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

LGTM! thank you for updating this. :shipit:

(Note: as Gio has mentioned, since 4.39.0 has been released here's a friendly reminder to update the pod version to 4.40.0-beta.1 🙂 )

@ealeksandrov
Copy link
Contributor Author

ealeksandrov commented Aug 9, 2021

Thanks @mokagio and @dvdchr! I've added few updates to dev dependencies as part of general cleanup and will merge it as 4.40.1-beta.1 🎉

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants