Skip to content
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

refactor!: Add CDVSettingsDictionary class #1458

Merged
merged 1 commit into from
Aug 20, 2024
Merged

Conversation

dpogue
Copy link
Member

@dpogue dpogue commented Aug 15, 2024

Platforms affected

iOS

Motivation and Context

This will replace the extension category on NSDictionary, which has always felt a little bit hacky and has caused issues in weird circumstances due to requiring special build flags to work properly.

Description

Add a new CDVSettingsDictionary class that is used for accessing preferences.

Yes, subclassing NSDictionary is generally considered a bad idea because the internal implementation details are weird and cause problems. However, in this case we're essentially wrapping a real NSMutableDictionary and proxying everything to it, so this should work the way we'd expect it to.

Testing

Added new unit test providing coverage for all the CDVSettingsDictionary methods.

Added a test file to check Swift behaviour as well, but adding it to the test suite project doesn't work (weird Xcode swift errors). I'd like to refactor the test project setup as well, but I'll deal with that after getting through the main CordovaLib project...

Checklist

  • I've run the tests to see all new and existing tests pass
  • I added automated test coverage as appropriate for this change

@dpogue dpogue added this to the 8.0.0 milestone Aug 15, 2024
@codecov-commenter
Copy link

codecov-commenter commented Aug 15, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 78.31%. Comparing base (98cca7f) to head (a4b4e75).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1458   +/-   ##
=======================================
  Coverage   78.31%   78.31%           
=======================================
  Files          16       16           
  Lines        1826     1826           
=======================================
  Hits         1430     1430           
  Misses        396      396           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@dpogue dpogue marked this pull request as ready for review August 16, 2024 09:43
Copy link
Member

@erisu erisu left a comment

Choose a reason for hiding this comment

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

Code LGTM

This will replace the extension category on NSDictionary, which has
always felt a little bit hacky and has caused issues in weird
circumstances due to requiring special build flags to work properly.
@dpogue dpogue merged commit 3a426fd into apache:master Aug 20, 2024
10 checks passed
@dpogue dpogue deleted the refactor3 branch August 20, 2024 18:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants