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

Provide more flexible Account Service interactions #39

Merged
merged 27 commits into from
Aug 20, 2024

Conversation

Supereg
Copy link
Member

@Supereg Supereg commented Jul 24, 2024

Provide more flexible Account Service interactions

♻️ Current situation & Problem

StanfordSpezi/SpeziAccount#62 simplified the overall SpeziAccount design and made a lot of interactions easier. This PR updates SpeziFirebaseAccount to this latest SpeziAccount release and improves the overall design of SpeziFirebaseAccount.

A list of changes can be found in the next section.

⚙️ Release Notes

  • SpeziFirebaseAccount exposes now a single account service: FirebaseAccountService that includes both the password and Sign in with Apple provider.
    • The old FirebaseAccountConfiguration was removed. Configuration is now passed directly to the FirebaseAccountService instance which in turn is passed to the AccountConfiguration of SpeziAccount.
  • The FirestoreAccountStorage was updated to the new AccountStorageProvider protocol and is now passed as an initializer argument to the AccountConfiguration. You do no longer need to make it a dependency of your Standard to forward all calls (the old constraint as removed).

🚨 Breaking Schema Changes

SpeziAccount 2.0 changes the identifiers of account keys. Instead of relying on the type names the identifier mirrors the lower-camel-case name of the swift properties. For example "GenderIdentityKey" is now named "genderIdentity". Similar the "DateOfBirthKey" got renamed to "dateOfBirth". If you have an existing application using the FirestoreAccountStorage, you might want to use the new mapping initializer argument to provide a backwards compatibility identifier mapping.

📚 Documentation

All documentation was updated to reflect the new behavior. Some additional adjustments have been made to improve the general structure of the SpeziFirebase documentation catalogs.

✅ Testing

Existing test cases were used to protect against regressions. Slightly reduced test execution time.

📝 Code of Conduct & Contributing Guidelines

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

@Supereg Supereg changed the title First draft to upgrade to SpeziAccount 2.0 Provide more flexible account service interactions Aug 9, 2024
@Supereg Supereg marked this pull request as ready for review August 9, 2024 13:50
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.

Really cool to see how these things are coming together @Supereg; thanks for all the work here.

I only had a few smaller comments, really happy to see this merged and great to see the simplification in the Firebase Account Service!

Package.swift Outdated Show resolved Hide resolved
Sources/SpeziFirestore/DocumentReference+AsyncAwait.swift Outdated Show resolved Hide resolved
@Supereg Supereg changed the title Provide more flexible account service interactions Provide more flexible Account Service interactions Aug 16, 2024
Copy link

codecov bot commented Aug 16, 2024

Codecov Report

Attention: Patch coverage is 72.96954% with 213 lines in your changes missing coverage. Please review.

Project coverage is 66.61%. Comparing base (e381b7d) to head (ce64630).
Report is 1 commits behind head on main.

Files Patch % Lines
.../SpeziFirebaseAccount/FirebaseAccountService.swift 71.43% 188 Missing ⚠️
...iFirebaseAccount/Models/FirebaseAccountError.swift 63.34% 11 Missing ⚠️
...eAccount/Keys/AccountDetails+FirebaseMetdata.swift 50.00% 6 Missing ⚠️
.../SpeziFirebaseAccount/Models/FirebaseContext.swift 0.00% 3 Missing ⚠️
...count/Models/ReauthenticationOperationResult.swift 76.93% 3 Missing ⚠️
...count/Models/ValidationRule+FirebasePassword.swift 92.31% 1 Missing ⚠️
...eAccount/Views/FirebaseAnonymousSignInButton.swift 95.24% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #39      +/-   ##
==========================================
+ Coverage   63.02%   66.61%   +3.60%     
==========================================
  Files          19       19              
  Lines        1122     1087      -35     
==========================================
+ Hits          707      724      +17     
+ Misses        415      363      -52     
Files Coverage Δ
...s/SpeziFirebaseAccount/FirebaseAuthProviders.swift 100.00% <100.00%> (ø)
...iFirebaseAccount/Models/FirebaseAccountModel.swift 100.00% <100.00%> (ø)
...irebaseAccount/Views/FirebaseAccountModifier.swift 100.00% <100.00%> (ø)
...SpeziFirebaseAccount/Views/FirebaseLoginView.swift 100.00% <100.00%> (ø)
...iFirebaseAccount/Views/FirebaseSecurityAlert.swift 96.23% <100.00%> (ø)
...eAccount/Views/FirebaseSignInWithAppleButton.swift 100.00% <100.00%> (+29.63%) ⬆️
...ziFirebaseConfiguration/ConfigureFirebaseApp.swift 100.00% <ø> (ø)
.../SpeziFirestore/DocumentReference+AsyncAwait.swift 58.34% <ø> (ø)
Sources/SpeziFirestore/Firestore.swift 72.73% <ø> (ø)
Sources/SpeziFirestore/FirestoreError.swift 0.00% <ø> (ø)
... and 8 more

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 e381b7d...ce64630. 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 the updates and securing the Firestore call!

Tests/UITests/TestAppUITests/FirebaseClient.swift Outdated Show resolved Hide resolved
@PSchmiedmayer PSchmiedmayer added the enhancement New feature or request label Aug 16, 2024
@Supereg Supereg merged commit 7855a91 into main Aug 20, 2024
8 checks passed
@Supereg Supereg deleted the feature/spezi-account-2.0 branch August 20, 2024 08:26
@Supereg Supereg mentioned this pull request Aug 28, 2024
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants