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

feat: Add PFObject.isDataAvailableForKey to check if data is available for individual key #1756

Merged
merged 6 commits into from
Apr 6, 2024

Conversation

dplewis
Copy link
Member

@dplewis dplewis commented Oct 7, 2023

New Pull Request Checklist

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: #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

  • Add tests
  • Add changes to documentation (guides, repository pages, in-code descriptions)

@parse-github-assistant
Copy link

parse-github-assistant bot commented Oct 7, 2023

Thanks for opening this pull request!

  • 🎉 We are excited about your hands-on contribution!

@dplewis dplewis closed this Oct 7, 2023
@dplewis dplewis reopened this Oct 7, 2023
@mtrezza
Copy link
Member

mtrezza commented Oct 7, 2023

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
Copy link

codecov bot commented Oct 18, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 64.25%. Comparing base (b9239d7) to head (bf0234d).

❗ 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           

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

@dplewis
Copy link
Member Author

dplewis commented Oct 26, 2023

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.

@dplewis dplewis requested a review from mtrezza April 5, 2024 22:44
@dplewis
Copy link
Member Author

dplewis commented Apr 5, 2024

@mtrezza This is ready for review

@mtrezza mtrezza closed this Apr 5, 2024
@mtrezza mtrezza reopened this Apr 5, 2024
@mtrezza
Copy link
Member

mtrezza commented Apr 6, 2024

Test fails, flaky?

@dplewis
Copy link
Member Author

dplewis commented Apr 6, 2024

@mtrezza the CI is broken. Looks like an issue with Ruby and Bundler versioning. Can you fix it?

@mtrezza
Copy link
Member

mtrezza commented Apr 6, 2024

See #1777

@mtrezza
Copy link
Member

mtrezza commented Apr 6, 2024

It doesn't have a test, do you want to add one, or shall I merge without it?

@dplewis
Copy link
Member Author

dplewis commented Apr 6, 2024

The test exist when this was private. No additional test needed

@mtrezza
Copy link
Member

mtrezza commented Apr 6, 2024

The test exist when this was private.

What does that mean?

@dplewis
Copy link
Member Author

dplewis commented Apr 6, 2024

Sorry, I mean the test are there already. No need to write new ones

@mtrezza
Copy link
Member

mtrezza commented Apr 6, 2024

If the test is there already, why doesn't it fail without this PR?

@mtrezza
Copy link
Member

mtrezza commented Apr 6, 2024

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.

@dplewis
Copy link
Member Author

dplewis commented Apr 6, 2024

This is a feature

@mtrezza mtrezza changed the title feat: Expose PFObject isDataAvailableForKey feat: Add PFObject.isDataAvailableForKey to check if data is available for individual key Apr 6, 2024
@mtrezza mtrezza merged commit dd05d41 into parse-community:master Apr 6, 2024
11 checks passed
parseplatformorg pushed a commit that referenced this pull request Apr 8, 2024
# [3.0.0](2.7.3...3.0.0) (2024-04-08)

### Features

* Add `PFObject.isDataAvailableForKey` to check if data is available for individual key ([#1756](#1756)) ([dd05d41](dd05d41))
* Remove `ParseFacebookUtils` and `ParseTwitterUtils` ([#1779](#1779)) ([f1311ee](f1311ee))

### BREAKING CHANGES

* Removes convenience modules `ParseFacebookUtils` and `ParseTwitterUtils`, instead manually add the 3rd party authentication service SDK to log in and provide the authentication data to `PFUser.logInWithAuthType` to link the Parse User. ([f1311ee](f1311ee))
@parseplatformorg
Copy link
Contributor

🎉 This change has been released in version 3.0.0

@parseplatformorg parseplatformorg added the state:released Released as stable version label Apr 8, 2024
eeallen1 added a commit to eeallen1/Parse-SDK-iOS-OSX that referenced this pull request May 6, 2024
* commit 'ef9b00de9eeeca7fddfe9439141f5141ff5dac02': (86 commits)
  chore(release): 3.0.0 [skip ci]
  ci: Fix release workflow (parse-community#1782)
  feat: Remove `ParseFacebookUtils` and `ParseTwitterUtils` (parse-community#1779)
  feat: Add `PFObject.isDataAvailableForKey` to check if data is available for individual key (parse-community#1756)
  ci: Bump ip from 2.0.0 to 2.0.1 (parse-community#1772)
  ci: Fix failing CI by pinning bundler version (parse-community#1778)
  refactor: Remove Carthage dependency (parse-community#1763)
  refactor: Remove OCMock Carthage dependency (parse-community#1754)
  ci: Run CI on Xcode 15 and macOS 13 (parse-community#1753)
  refactor: Update ruby dependencies (parse-community#1752)
  refactor: Remove framework builder for assets (parse-community#1751)
  chore(release): 2.7.3 [skip ci]
  fix: Compilation errors in `ParseLiveQuery` using `Starscream` 4.0.6 (parse-community#1749)
  docs: Add changelog note about missing assets (parse-community#1750)
  chore(release): 2.7.2 [skip ci]
  fix: Compilation errors `Undefined symbol` and `SystemConfiguration not found` on watchOS (parse-community#1748)
  ci: Remove publishing release assets (parse-community#1745)
  ci: Fix and build Starter Projects (parse-community#1744)
  chore(release): 2.7.1 [skip ci]
  fix: Compilation error on macOS `Undefined symbol: OBJC_CLASS$_PFProductsRequestHandler` (parse-community#1739)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
state:released Released as stable version
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants