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

Make sure to only pass complete account details to the account setup complete closure #79

Merged
merged 6 commits into from
Dec 9, 2024

Conversation

Supereg
Copy link
Member

@Supereg Supereg commented Nov 24, 2024

Make sure to only pass complete account details to the account setup complete closure

♻️ Current situation & Problem

The AccountSetup accepts a setupComplete closure that will get called once the setup is completed giving the parent view the opportunity to perform additional checks or navigation steps based on the outcome. While a AccountService always calls an ExternalStorageProvider before submitting account details to Account, they have been decoupled in v2.0.0 and an ExternalStorageProvider must always return immediacy from its load call. In scenarios where account details are not locally cached yet, an ExternalStorageProvider returns details that are marked as incomplete.
AccountSetup didn't check for this flag and forwarded incomplete details to the setupComplete closure. This PR fixes this issue and updates the behavior to only forward account details that are also marked as complete.

⚙️ Release Notes

  • Fixed an issue where AccountSetup would forward incomplete account details and didn't wait for an ExternalStorageProvider to load externally stored account details.
  • Fixed an issue where flags wouldn't be copied between account details.

📚 Documentation

We improved some of the documentation discoverability.

✅ Testing

Added UI tests to verify that the incomplete details are not passed to the setupComplete closure.

📝 Code of Conduct & Contributing Guidelines

By submitting creating this pull request, you agree to follow our Code of Conduct and Contributing Guidelines:

Copy link

codecov bot commented Nov 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 83.84%. Comparing base (7ffb73d) to head (e8698a3).
Report is 2 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #79      +/-   ##
==========================================
+ Coverage   83.79%   83.84%   +0.05%     
==========================================
  Files         122      121       -1     
  Lines        5204     5251      +47     
==========================================
+ Hits         4360     4402      +42     
- Misses        844      849       +5     
Files with missing lines Coverage Δ
Sources/SpeziAccount/AccountConfiguration.swift 64.22% <ø> (ø)
Sources/SpeziAccount/AccountSetup.swift 91.52% <100.00%> (-0.55%) ⬇️
Sources/SpeziAccount/AccountStorageProvider.swift 100.00% <ø> (ø)
...ount/AccountValue/Collections/AccountDetails.swift 75.17% <100.00%> (+1.34%) ⬆️
...ccount/AccountValue/Keys/AccountDetailsFlags.swift 75.52% <ø> (+4.09%) ⬆️
...ces/SpeziAccount/Mock/InMemoryAccountService.swift 91.90% <ø> (+3.25%) ⬆️
...iAccount/Mock/InMemoryAccountStorageProvider.swift 100.00% <100.00%> (+28.21%) ⬆️
...ountSetup/SetupProvider/AccountServiceButton.swift 72.10% <ø> (ø)
...untSetup/SetupProvider/SignInWithAppleButton.swift 39.07% <ø> (ø)
...es/SpeziAccountMacros/SpeziAccountDiagnostic.swift 72.23% <ø> (ø)

... and 7 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0e4dcc7...e8698a3. Read the comment docs.

Copy link
Member

@PSchmiedmayer PSchmiedmayer 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 for all the improvements here @Supereg; great to see this merged & incorporated in our apps 🚀

@PSchmiedmayer PSchmiedmayer added the bug Something isn't working label Dec 9, 2024
@Supereg Supereg merged commit 37df11e into main Dec 9, 2024
11 checks passed
@Supereg Supereg deleted the fix/wait-for-complete-details branch December 9, 2024 17:45
Supereg added a commit to StanfordSpezi/SpeziFirebase that referenced this pull request Dec 9, 2024
…49)

# Always notify Account when FirestoreAccountStorage receives snapshot

## ♻️ Current situation & Problem
With StanfordSpezi/SpeziAccount#79 we only
forward "complete" account details to the `setupComplete` closure of the
`AccountSetup` view. This requires that the StorageProvider always
updates the account details (to clear the incomplete flag) even if there
aren't any keys stored in the storage provider. This wasn't the case for
FirestoreAccountStorage resulting in the `setupComplete` closure to
never be called and the `incomplete` flag to never be cleared.


## ⚙️ Release Notes 
* Fixed an issue where the `incomplete` flag would never be cleared if
there weren't any details stored for an account.


## 📚 Documentation
--


## ✅ Testing
--

## 📝 Code of Conduct & Contributing Guidelines 

By submitting creating this pull request, you agree to follow our [Code
of
Conduct](https://github.com/StanfordSpezi/.github/blob/main/CODE_OF_CONDUCT.md)
and [Contributing
Guidelines](https://github.com/StanfordSpezi/.github/blob/main/CONTRIBUTING.md):
- [x] I agree to follow the [Code of
Conduct](https://github.com/StanfordSpezi/.github/blob/main/CODE_OF_CONDUCT.md)
and [Contributing
Guidelines](https://github.com/StanfordSpezi/.github/blob/main/CONTRIBUTING.md).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants