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

Model Account and AccountService as Spezi Module #60

Merged
merged 5 commits into from
Jul 22, 2024

Conversation

Supereg
Copy link
Member

@Supereg Supereg commented Jun 12, 2024

Model Account and AccountService as Spezi Module

♻️ Current situation & Problem

The Account model and AccountServices were introduced before Spezi had sophisticated support for Modules. Therefore, SpeziAccount provides infrastructure like the @AccountReference to access the Account model from certain places like an Account Service or from a Standard that conforms to a SpeziAccount constraint. Other than that, the Account model can only be accessed from within the SwiftUI view hierarchy.
This design is generally relatively inflexible and one has to find workarounds to (a) access Account from a Spezi Module and (b) access Spezi Modules from within an AccountService. Typically this involves nesting Account Services into basically empty Spezi Modules or injecting ViewModifiers into the global SwiftUI view hierarchy to get access to the Account.

This PR addresses the problem by making Account and AccountServices Spezi Modules that can be used with all Spezi infrastructure like the @Dependency property wrapper. This greatly improves flexibility when developing with SpeziAccount.

⚙️ Release Notes

  • Account is now a Spezi Module and can be accessed from Modules using the @Dependency property wrapper.
  • AccountServices are now Spezi Modules that can use Spezi infrastructure.

📚 Documentation

TBA

✅ Testing

--

📝 Code of Conduct & Contributing Guidelines

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

@Supereg Supereg force-pushed the feature/account-module branch 2 times, most recently from 23376d7 to 0605b23 Compare July 21, 2024 18:21
@Supereg Supereg force-pushed the feature/account-module branch from 0605b23 to f45fcf4 Compare July 21, 2024 18:27
Copy link

codecov bot commented Jul 21, 2024

Codecov Report

Attention: Patch coverage is 38.33333% with 74 lines in your changes missing coverage. Please review.

Project coverage is 73.12%. Comparing base (2de0720) to head (66d71c1).
Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #60      +/-   ##
==========================================
- Coverage   76.12%   73.12%   -3.00%     
==========================================
  Files         116      115       -1     
  Lines        4020     4065      +45     
==========================================
- Hits         3060     2972      -88     
- Misses        960     1093     +133     
Files Coverage Δ
Sources/SpeziAccount/AccountHeader.swift 0.00% <ø> (ø)
...s/SpeziAccount/AccountService/AccountService.swift 80.00% <ø> (ø)
...Account/AccountService/AccountServiceBuilder.swift 100.00% <100.00%> (+100.00%) ⬆️
...e/Wrapper/NotifyStandardBackedAccountService.swift 100.00% <ø> (ø)
...ccount/AccountService/Wrapper/StandardBacked.swift 93.62% <100.00%> (ø)
.../Wrapper/StorageStandardBackedAccountService.swift 96.30% <ø> (+0.05%) ⬆️
...peziAccount/Mock/MockSignInWithAppleProvider.swift 44.83% <ø> (+4.09%) ⬆️
...s/SpeziAccount/Mock/MockSimpleAccountService.swift 0.00% <ø> (ø)
...ccount/Mock/MockUserIdPasswordAccountService.swift 0.00% <ø> (ø)
...peziAccount/Views/UserIdPasswordEmbeddedView.swift 99.03% <ø> (+0.02%) ⬆️
... and 8 more

... and 9 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 8ac95d7...66d71c1. Read the comment docs.

@Supereg Supereg changed the title Module support for Account Services and Account Model Account and AccountService as Spezi Module Jul 21, 2024
@Supereg Supereg marked this pull request as ready for review July 21, 2024 22:20
@Supereg Supereg requested a review from PSchmiedmayer July 21, 2024 22:20
@PSchmiedmayer PSchmiedmayer added the enhancement New feature or request label Jul 22, 2024
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.

Nice work; great to see how all these things are starting to interconnect; great job @Supereg!!

@Supereg Supereg merged commit e3344aa into main Jul 22, 2024
10 of 11 checks passed
@Supereg Supereg deleted the feature/account-module branch July 22, 2024 13:31
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