Parse-SDK-iOS-OSX
Parse-SDK-iOS-OSX copied to clipboard
feat: Expose `PFObject` `isDataAvailableForKey`
New Pull Request Checklist
- [ ] I am not disclosing a vulnerability.
- [ ] I am creating this PR in reference to an issue.
Issue Description
This PR avoid crashing when we try to get data from key which is not fetched. You can check if data is available for a PFObject but not by individual key.
Closes: https://github.com/parse-community/Parse-SDK-iOS-OSX/pull/1595
Approach
if user.isDataAvailable(forKey: "username") {
// ok
}
or
if let username = user["username"] {
// username is available
}
else {
// username is unavailable, please fetch it
}
TODOs before merging
- [x] Add tests
- [x] Add changes to documentation (guides, repository pages, in-code descriptions)
Thanks for opening this pull request!
- 🎉 We are excited about your hands-on contribution!
This is in case a key value may exist in the DB, but the key value is not fetched on the SDK side, so the SDK doesn't know the current key value?
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 64.25%. Comparing base (
b9239d7) to head (bf0234d).
:exclamation: Current head bf0234d differs from pull request most recent head 0dd9a83. Consider uploading reports for the commit 0dd9a83 to get more accurate results
Additional details and impacted files
@@ Coverage Diff @@
## master #1756 +/- ##
=======================================
Coverage 64.25% 64.25%
=======================================
Files 201 201
Lines 23233 23233
=======================================
Hits 14928 14928
Misses 8305 8305
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
This is in case a key value may exist in the DB, but the key value is not fetched on the SDK side, so the SDK doesn't know the current key value?
This is correct. I've updated the PR to remove the objectForKey changes.
@mtrezza This is ready for review
Test fails, flaky?
@mtrezza the CI is broken. Looks like an issue with Ruby and Bundler versioning. Can you fix it?
See https://github.com/parse-community/Parse-SDK-iOS-OSX/issues/1777
It doesn't have a test, do you want to add one, or shall I merge without it?
The test exist when this was private. No additional test needed
The test exist when this was private.
What does that mean?
Sorry, I mean the test are there already. No need to write new ones
If the test is there already, why doesn't it fail without this PR?
Is this a bug fix? From the description is seems so...
This PR avoid crashing when we try to get data from key which is not fetched.
But the PR title seems to be feature.
This is a feature
🎉 This change has been released in version 3.0.0