-
-
Notifications
You must be signed in to change notification settings - Fork 2
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
Upgrade to SpeziAccount 0.5.0 with account edit and removal support #8
Conversation
* Added a bunch more error messages
0dd08fa
to
54e52f4
Compare
The The EDIT: StanfordBDHG/XCTestExtensions#17 resolves these issues. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, this looks great! 🚀
# Unified Account View with rethought Account Service Model ## ♻️ Current situation & Problem Currently, `SepziAccount` exposes two distinct views: `Login` and `SignUp`. While visually identical (expect for customizations), the AccountService buttons navigate to the respective Login or SignUp views for data entry. This introduces several navigation steps for the user even for simple workflows (e.g. just signing in a returning user). Further, it is not clear where to place Identity Provider buttons (e.g., Sign in with Apple), as these create a new account or just sign you in to your existing one with the same, single button. ## 💡 Proposed solution This PR makes the following changes: * Unifying `Login` and `SignUp` views to be represented by a single view, placing identity providers on the same page as regular Account Services, the `AccountSetup` view. * Restructure the Account Service Model: * Make the necessary preparations to support third-party Identity providers * Introduce the concept of an `EmbeddableAccountService` and a new `KeyPasswordBasedAccountService` as new abstraction layers. This replaces the current `UsernamePasswordAccountService` and `EmailPasswordAccountService` implementations. Those we really only Mock implementations which provided extensibility through class inheritance. This was replaced by providing the same functionality with a hierarchy of protocols being more powerful and providing much more flexibility. Further, we introduce new Mock Account services (e.g., used by PreviewProviders) which more clearly communicate their use through their updated name. * Move the UI parts of an AccountService out into a distinct abstraction layer (`AccountSetupViewStyle`s). * Introduce the `Account Value` (through `AccountKey` implementations) abstraction to support arbitrary account values * They provide a name, a category (for optimized placement in the UI), and a initial value * The provide the UI components do display (`DataDisplayView`) and setup or edit (`DataEntryView`) account values * The provide easy to use accessors using extensions on `AccountKeys` and `AccountValues` * Optimized API surface for end-users: * Exposes the `signedIn` published property (same as previously) * Exposees the `details` shared repository to access the `AccountDetails` of the currently logged in use. This also provides access to the `AccountService` and its configuration that was used to setup the user account. * Provide a new `AccountOverview` view: * Allows to view arbitrary account values * Allows to edit arbitrary account values * Provide Logout and account Removal functionality * Enabled through StanfordSpezi/Spezi#72, one can easily configure `SpeziAccount` centrally while other configured components can provide their AccountServices via [Component Communication](https://swiftpackageindex.com/stanfordspezi/spezi/documentation/spezi/component#Communication). This PR tries to provide extensive documentation for all areas. To provide some insights into the new user-facing API surface. This is how you would configure Spezi Account now: ```swift class YourAppDelegate: SpeziAppDelegate { override var configuration: Configuration { AccountConfiguration(configuration: [ // the user defines what account values are used and if they are `required`, `collected` or just `supported` .requires(\.userId), .requires(\.password), .requires(\.name), .collects(\.dateOfBirth), .collects(\.genderIdentity) ]) } } ``` Below is an example on how to use the account setup view: ```swift struct MyOnboardingView: View { var body: some View { AccountSetup { NavigationLink { // ... next view if already signed in } label: { Text("Continue") } } } } ``` Lastly, the account overview is equally as easy to use: ```swift struct MyView: View { var body: some View { AccountOverview() } } ``` ## ⚙️ Release Notes * New, unified `AccountSetup` view * New `AccountOverview` view * Introduce new `AccountService` abstraction * Support arbitrary account values through `AccountKey`-based shared repository implementation ## ➕ Additional Information ### Related PRs and Issues * This PR provides the groundwork necessary for StanfordSpezi/SpeziFirebase#7 * The updated Firebase implementation: StanfordSpezi/SpeziFirebase#8 ### Testing Substantial UI tests were updated and added. ### Reviewer Nudging As this is quite a large PR it would make sense to start reviewing by reading through the documentation. First of all reviewing the documentation itself (structure and readability). Code example on the DocC article already explain a lot of the concepts. The areas that sparked your attention, where you think that something is off or hard to understand, I would recommend to deep dive into the respective code area. ### 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). --------- Co-authored-by: Paul Schmiedmayer <[email protected]>
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #8 +/- ##
===========================================
+ Coverage 39.04% 62.41% +23.37%
===========================================
Files 9 10 +1
Lines 374 641 +267
===========================================
+ Hits 146 400 +254
- Misses 228 241 +13
Continue to review full report in Codecov by Sentry.
|
Latest changes fix the discussed issues with requiring a recent login for sensitive operations. #13 tracks the ideal scenario for a future release. |
# Updated Account Setup and new Account Editing Functionality ## ♻️ Current situation & Problem There is an upcoming release of SpeziAccount that restructures and simplifies account setup procedure. Further, it adds a new Account Overview that allows you to view and edit your active account details. While it might not be required for all projects, we currently force a user account (e.g. as the standard expects a user account for all operations) even if the user decides to log out. Furthermore, we restore test case functionality for some tests cases that broke due to the latest accessibility improvements in some dependencies. For more information see: * StanfordSpezi/SpeziAccount#7 * StanfordSpezi/SpeziFirebase#8 ## ⚙️ Release Notes * Newly designed Account Setup experience * New Account Editing Functionality * Support complete removal of user data ## 📚 Documentation In code documentation was adjusted. ## ✅ Testing Tests were updated to cover new vectors. ## 📝 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).
…ezi#7) # Unified Account View with rethought Account Service Model ## ♻️ Current situation & Problem Currently, `SepziAccount` exposes two distinct views: `Login` and `SignUp`. While visually identical (expect for customizations), the AccountService buttons navigate to the respective Login or SignUp views for data entry. This introduces several navigation steps for the user even for simple workflows (e.g. just signing in a returning user). Further, it is not clear where to place Identity Provider buttons (e.g., Sign in with Apple), as these create a new account or just sign you in to your existing one with the same, single button. ## 💡 Proposed solution This PR makes the following changes: * Unifying `Login` and `SignUp` views to be represented by a single view, placing identity providers on the same page as regular Account Services, the `AccountSetup` view. * Restructure the Account Service Model: * Make the necessary preparations to support third-party Identity providers * Introduce the concept of an `EmbeddableAccountService` and a new `KeyPasswordBasedAccountService` as new abstraction layers. This replaces the current `UsernamePasswordAccountService` and `EmailPasswordAccountService` implementations. Those we really only Mock implementations which provided extensibility through class inheritance. This was replaced by providing the same functionality with a hierarchy of protocols being more powerful and providing much more flexibility. Further, we introduce new Mock Account services (e.g., used by PreviewProviders) which more clearly communicate their use through their updated name. * Move the UI parts of an AccountService out into a distinct abstraction layer (`AccountSetupViewStyle`s). * Introduce the `Account Value` (through `AccountKey` implementations) abstraction to support arbitrary account values * They provide a name, a category (for optimized placement in the UI), and a initial value * The provide the UI components do display (`DataDisplayView`) and setup or edit (`DataEntryView`) account values * The provide easy to use accessors using extensions on `AccountKeys` and `AccountValues` * Optimized API surface for end-users: * Exposes the `signedIn` published property (same as previously) * Exposees the `details` shared repository to access the `AccountDetails` of the currently logged in use. This also provides access to the `AccountService` and its configuration that was used to setup the user account. * Provide a new `AccountOverview` view: * Allows to view arbitrary account values * Allows to edit arbitrary account values * Provide Logout and account Removal functionality * Enabled through StanfordSpezi/Spezi#72, one can easily configure `SpeziAccount` centrally while other configured components can provide their AccountServices via [Component Communication](https://swiftpackageindex.com/stanfordspezi/spezi/documentation/spezi/component#Communication). This PR tries to provide extensive documentation for all areas. To provide some insights into the new user-facing API surface. This is how you would configure Spezi Account now: ```swift class YourAppDelegate: SpeziAppDelegate { override var configuration: Configuration { AccountConfiguration(configuration: [ // the user defines what account values are used and if they are `required`, `collected` or just `supported` .requires(\.userId), .requires(\.password), .requires(\.name), .collects(\.dateOfBirth), .collects(\.genderIdentity) ]) } } ``` Below is an example on how to use the account setup view: ```swift struct MyOnboardingView: View { var body: some View { AccountSetup { NavigationLink { // ... next view if already signed in } label: { Text("Continue") } } } } ``` Lastly, the account overview is equally as easy to use: ```swift struct MyView: View { var body: some View { AccountOverview() } } ``` ## ⚙️ Release Notes * New, unified `AccountSetup` view * New `AccountOverview` view * Introduce new `AccountService` abstraction * Support arbitrary account values through `AccountKey`-based shared repository implementation ## ➕ Additional Information ### Related PRs and Issues * This PR provides the groundwork necessary for StanfordSpezi/SpeziFirebase#7 * The updated Firebase implementation: StanfordSpezi/SpeziFirebase#8 ### Testing Substantial UI tests were updated and added. ### Reviewer Nudging As this is quite a large PR it would make sense to start reviewing by reading through the documentation. First of all reviewing the documentation itself (structure and readability). Code example on the DocC article already explain a lot of the concepts. The areas that sparked your attention, where you think that something is off or hard to understand, I would recommend to deep dive into the respective code area. ### 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). --------- Co-authored-by: Paul Schmiedmayer <[email protected]>
…Spezi#35) There is an upcoming release of SpeziAccount that restructures and simplifies account setup procedure. Further, it adds a new Account Overview that allows you to view and edit your active account details. While it might not be required for all projects, we currently force a user account (e.g. as the standard expects a user account for all operations) even if the user decides to log out. Furthermore, we restore test case functionality for some tests cases that broke due to the latest accessibility improvements in some dependencies. For more information see: * StanfordSpezi/SpeziAccount#7 * StanfordSpezi/SpeziFirebase#8 * Newly designed Account Setup experience * New Account Editing Functionality * Support complete removal of user data In code documentation was adjusted. Tests were updated to cover new vectors. 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).
…Spezi#35) # Updated Account Setup and new Account Editing Functionality ## ♻️ Current situation & Problem There is an upcoming release of SpeziAccount that restructures and simplifies account setup procedure. Further, it adds a new Account Overview that allows you to view and edit your active account details. While it might not be required for all projects, we currently force a user account (e.g. as the standard expects a user account for all operations) even if the user decides to log out. Furthermore, we restore test case functionality for some tests cases that broke due to the latest accessibility improvements in some dependencies. For more information see: * StanfordSpezi/SpeziAccount#7 * StanfordSpezi/SpeziFirebase#8 ## ⚙️ Release Notes * Newly designed Account Setup experience * New Account Editing Functionality * Support complete removal of user data ## 📚 Documentation In code documentation was adjusted. ## ✅ Testing Tests were updated to cover new vectors. ## 📝 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).
…Spezi#35) # Updated Account Setup and new Account Editing Functionality ## ♻️ Current situation & Problem There is an upcoming release of SpeziAccount that restructures and simplifies account setup procedure. Further, it adds a new Account Overview that allows you to view and edit your active account details. While it might not be required for all projects, we currently force a user account (e.g. as the standard expects a user account for all operations) even if the user decides to log out. Furthermore, we restore test case functionality for some tests cases that broke due to the latest accessibility improvements in some dependencies. For more information see: * StanfordSpezi/SpeziAccount#7 * StanfordSpezi/SpeziFirebase#8 ## ⚙️ Release Notes * Newly designed Account Setup experience * New Account Editing Functionality * Support complete removal of user data ## 📚 Documentation In code documentation was adjusted. ## ✅ Testing Tests were updated to cover new vectors. ## 📝 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).
…Spezi#35) # Updated Account Setup and new Account Editing Functionality ## ♻️ Current situation & Problem There is an upcoming release of SpeziAccount that restructures and simplifies account setup procedure. Further, it adds a new Account Overview that allows you to view and edit your active account details. While it might not be required for all projects, we currently force a user account (e.g. as the standard expects a user account for all operations) even if the user decides to log out. Furthermore, we restore test case functionality for some tests cases that broke due to the latest accessibility improvements in some dependencies. For more information see: * StanfordSpezi/SpeziAccount#7 * StanfordSpezi/SpeziFirebase#8 ## ⚙️ Release Notes * Newly designed Account Setup experience * New Account Editing Functionality * Support complete removal of user data ## 📚 Documentation In code documentation was adjusted. ## ✅ Testing Tests were updated to cover new vectors. ## 📝 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).
…Spezi#35) There is an upcoming release of SpeziAccount that restructures and simplifies account setup procedure. Further, it adds a new Account Overview that allows you to view and edit your active account details. While it might not be required for all projects, we currently force a user account (e.g. as the standard expects a user account for all operations) even if the user decides to log out. Furthermore, we restore test case functionality for some tests cases that broke due to the latest accessibility improvements in some dependencies. For more information see: * StanfordSpezi/SpeziAccount#7 * StanfordSpezi/SpeziFirebase#8 * Newly designed Account Setup experience * New Account Editing Functionality * Support complete removal of user data In code documentation was adjusted. Tests were updated to cover new vectors. 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).
…Spezi#35) There is an upcoming release of SpeziAccount that restructures and simplifies account setup procedure. Further, it adds a new Account Overview that allows you to view and edit your active account details. While it might not be required for all projects, we currently force a user account (e.g. as the standard expects a user account for all operations) even if the user decides to log out. Furthermore, we restore test case functionality for some tests cases that broke due to the latest accessibility improvements in some dependencies. For more information see: * StanfordSpezi/SpeziAccount#7 * StanfordSpezi/SpeziFirebase#8 * Newly designed Account Setup experience * New Account Editing Functionality * Support complete removal of user data In code documentation was adjusted. Tests were updated to cover new vectors. 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).
Upgrade to upcoming SpeziAccount release
♻️ Current situation & Problem
We currently support the current and latest version of
SpeziAccount
(0.3.0). The next version ofSpeziAccount
heavily refactors the exposed API.💡 Proposed solution
This PR makes sure SpeziFirebase is ready for the upgrade version of
SpeziAccount
.⚙️ Release Notes
SpeziAccount
➕ Additional Information
The upgrade to the new version of
SpeziAccount
requires only minor changes inSpeziFirebase
itself. We did some refactoring were we moved allFIRAuth
operations into the AccountService itself. Consequentially, theFirebaseAccountConfiguration
itself got a lot simpler.Breaking Changes
The following breaking changes are induced due to the new structure of
SpeziAccount
.FirebaseAccountConfiguration
is no longer injected as an environment object into the SwiftUI environment. Access the account information using the new, generalizedAccount
environment object.Related PRs
Testing
Tests were added and adjusted.
Reviewer Nudging
Look at the changes in
FirebaseAccountConfiguration
and theFirebaseEmailPasswordAccountService
.Code of Conduct & Contributing Guidelines
By submitting creating this pull request, you agree to follow our Code of Conduct and Contributing Guidelines: