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

Refactor Registration Flow to Remove Consent Screen and Anonymous Login and move Invitation Code screen #105

Draft
wants to merge 22 commits into
base: main
Choose a base branch
from

Conversation

Basler182
Copy link
Contributor

Refactor Registration Flow to Remove Consent Screen and Anonymous Login and move Invitation Code screen

♻️ Current situation & Problem

⚙️ Release Notes

  • Remove the consent screen and anonymous login from the registration process.
  • Allow users to fully register without an invitation code.
  • After login, prompt users to enter an invitation code if not already provided.
  • Introduce two post-login states:
  • Logged in without invitation code: User sees only the invitation code screen.
  • Logged in with invitation code: User proceeds as usual.
  • The user's Firestore account object will be checked for an existing invitation code to determine the user state

✅ Testing

📝 Code of Conduct & Contributing Guidelines

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

@Basler182 Basler182 added the ENGAGE HF ENGAGE-HF-specific issues label Sep 20, 2024
Copy link

codecov bot commented Sep 20, 2024

Codecov Report

Attention: Patch coverage is 35.00000% with 52 lines in your changes missing coverage. Please review.

Project coverage is 39.47%. Comparing base (1adfb33) to head (d681b0e).

Files with missing lines Patch % Lines
...rd/spezi/module/account/register/RegisterScreen.kt 0.00% 18 Missing ⚠️
...stanford/spezi/module/account/login/LoginScreen.kt 0.00% 17 Missing ⚠️
...nford/spezi/module/account/login/LoginViewModel.kt 84.22% 1 Missing and 2 partials ⚠️
...account/login/components/SignInWithGoogleButton.kt 0.00% 3 Missing ⚠️
...n/kotlin/edu/stanford/bdh/engagehf/MainActivity.kt 0.00% 2 Missing ⚠️
...e/account/manager/FirebaseInvitationAuthManager.kt 0.00% 2 Missing ⚠️
.../spezi/module/account/register/DatePickerDialog.kt 0.00% 2 Missing ⚠️
...agehf/onboarding/EngageInvitationCodeRepository.kt 0.00% 1 Missing ⚠️
...onboarding/EngageSequentialOnboardingRepository.kt 0.00% 1 Missing ⚠️
...ord/spezi/module/account/AccountNavigationEvent.kt 0.00% 1 Missing ⚠️
... and 2 more
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##               main     #105      +/-   ##
============================================
+ Coverage     39.40%   39.47%   +0.08%     
+ Complexity      676      674       -2     
============================================
  Files           221      221              
  Lines          8080     8062      -18     
  Branches       1146     1139       -7     
============================================
- Hits           3183     3182       -1     
+ Misses         4600     4583      -17     
  Partials        297      297              
Flag Coverage Δ
uitests 30.53% <ø> (+0.16%) ⬆️
unittests 33.06% <35.00%> (+0.07%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...edu/stanford/bdh/engagehf/MainActivityViewModel.kt 100.00% <100.00%> (ø)
...edu/stanford/spezi/module/account/login/UiState.kt 100.00% <ø> (ø)
...stanford/spezi/module/account/manager/UserState.kt 100.00% <100.00%> (ø)
...dule/onboarding/invitation/InvitationCodeScreen.kt 0.00% <ø> (ø)
.../onboarding/invitation/InvitationCodeScreenData.kt 0.00% <ø> (ø)
...ule/onboarding/invitation/InvitationCodeUiState.kt 100.00% <ø> (ø)
...e/onboarding/invitation/InvitationCodeViewModel.kt 96.00% <ø> (+29.34%) ⬆️
...agehf/onboarding/EngageInvitationCodeRepository.kt 0.00% <0.00%> (ø)
...onboarding/EngageSequentialOnboardingRepository.kt 0.00% <0.00%> (ø)
...ord/spezi/module/account/AccountNavigationEvent.kt 83.34% <0.00%> (ø)
... and 9 more

... and 1 file 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 1adfb33...d681b0e. Read the comment docs.

@Basler182 Basler182 self-assigned this Sep 20, 2024
@Basler182
Copy link
Contributor Author

Here I think it makes sense, if you have time, to have a look at it Paul and give feedback on whether the flow is now adapted as you imagined. As you know best how it should be, @pauljohanneskraft :)

Copy link

@pauljohanneskraft pauljohanneskraft 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 implementing this! Sorry for not going into a lot of detail, if you have questions, let me know and we can schedule a call.

Here are some points:

  • We never want to sign in anonymously, it will be disabled and won't be possible. For the case of using Google authentication, we want to simply sign in with that credential, which should be possible without the go-around by anonymously signing in and then linking credentials.
  • New users will sign up using the createUser method and then call the enrollUser function - you still reference checkInvitationCode which doesn't exist anymore. Since the server is already merged, you may want to check that behavior with the Firebase emulators - if you do not run npm run prepare before calling npm run serve:seeded, the git commit change has little to no effect, so please make sure to call npm run prepare whenever you check out a different commit.
  • You will need to make sure to ask for the invitation code in three scenarios:
    1. The user has not completed onboarding a single time, then we just always start from the beginning, even if the user finished some previous step. The sign in/sign up screen on iOS would then show the logged in account instead of the sign in form when an account is already signed in. The invitation code is requested afterwards depending on whether the user has already enrolled or not (by checking whether the user object exists or whether it contains an invitationCode property, which is pretty much the same thing at the moment).
    2. The user has finished onboarding, but is signed in with an account that is not enrolled yet. This happens, when the user finished onboarding with one account, then singed up with a new account that is not enrolled. We would need to show the sign in/sign up screen with the signed in account visible and on tap of the "next" button, we ask for the invitation code.
    3. The user has completed onboarding, but is not signed into an account. This happens, when the user finished onboarding with one account and then decided to log out. In this case, we show the sign in/sign up screen with no account signed in.

On a quick test, I initially managed to finish the onboarding by signing into an existing account, but then on a restart of the app was asked for an invitation code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ENGAGE HF ENGAGE-HF-specific issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactor Registration Flow to Remove Consent Screen and Anonymous Login and move Invitation Code screen
2 participants