-
Notifications
You must be signed in to change notification settings - Fork 748
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
FTUE - Stage selection and Registration action testing #6091
Conversation
import javax.inject.Inject | ||
|
||
class RegistrationActionHandler @Inject constructor() { | ||
class RegistrationActionHandler @Inject constructor( |
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.
the original implementation in RegistrationActionHandler
has been extracted and renamed to RegistrationWizardActionDelegate
Unit Test Results150 files + 4 150 suites +4 2m 34s ⏱️ +2s Results for commit 680b9a0. ± Comparison against base commit e6beb73. This pull request removes 5 and adds 14 tests. Note that renamed tests count towards both.
♻️ This comment has been updated with latest results. |
fb6a5b2
to
0a13e9a
Compare
0a13e9a
to
171056e
Compare
171056e
to
680b9a0
Compare
is Success -> RegistrationResult.Complete(session) | ||
} | ||
|
||
sealed interface RegistrationResult { |
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.
I don't understand what is the role of this interface ?
Which difference with: RegistrationWizardAction.Result ?
And why did you put Result in the Delegate class ?
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.
there's two layers/domains, the main difference is the split between generic SDK logic and Element specific things.
-
RegistrationWizardActionDelegate
which handles the SDK flows (eg a 401 when sending the verification email is not actually an error), could argue this should be inside the SDK itself but wanted to avoid too much scope creep -
RegistrationActionHandler
which is Element's integration with the onboarding stages, technically it only needs to process theNextStep
, the other result types are passed through. Element reorders the onboarding steps forMatrix.org
, ignores certain results from the wizard and simplifies the flow so that clients ofRegistrationActionHandler
only know about the nextStage
The Results
are needed because both layers have multiple different outcomes
Element's integration layer provides additional cases around the handling of the next registration step
StartRegistration
NextStage
MissingNextStage
UnsupportedStage
RegistrationComplete
SendEmailSuccess
Error
Ignored
SDK
Error
Complete
NextStep
SendEmailSuccess
Hopefully the tests help show the difference 🤞 SDK Delegate | Element intergration
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.
thanks for the explanation :)
0fd67ba
to
6d281ff
Compare
…ion and adding tests - renames the existing handler to a wizard delegate
6d281ff
to
befcfe8
Compare
SonarCloud Quality Gate failed. |
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.
LGTM
data class AddThreePid(val threePid: RegisterThreePid) : RegisterAction | ||
object SendAgainThreePid : RegisterAction | ||
private fun findNextStage(state: SelectedHomeserverState, flowResult: FlowResult): Result { | ||
val orderedResult = when { |
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.
I think if
would be much more readable here. when
doesn't look good with complex conditions. But I won't insist
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.
I've been using when
specifically for those types of cases 🙈
Type of change
Content
Adds unit tests around the registration stages
RegistrationActionHandler
RegistrationAction -> Stage
logic out of theViewModel
and adds unit testsMotivation and context
To add missing coverage to the FTUE area
Screenshots / GIFs
No UI changes
Tests
Tested devices