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

FTUE - Only override sign up steps for matrix.org #6065

Merged
merged 6 commits into from
May 23, 2022

Conversation

ouchadam
Copy link
Contributor

Type of change

  • WIP Feature
  • Bugfix
  • Technical
  • Other :

Content

Fixes #5783 (First iteration #5785)

Only overrides the order of the sign up flow if the selected server is matrix.org

Motivation and context

Ultimately we want the homeserver to control the sign up flow however until this capability easily exists, we'll override only matrix.org's order from the client side and gather feedback.

Screenshots / GIFs

Before After
after-sign-up-override after-sign-up-order-3rd-p

Tests

  • Create a new account of matrix.org
  • Notice email is asked first
  • Create an account on another server which has mandatory email (eg 0wnz.at)
  • Notice recpatcha is asked first

Tested devices

  • Physical
  • Emulator
  • OS version(s): 28

….org is selected

- lifts the logic up to the view model
@ouchadam ouchadam added Z-FTUE Issue is relevant to the first time use project or experience PR-Small PR with less than 20 updated lines labels May 16, 2022
@github-actions
Copy link

github-actions bot commented May 16, 2022

Unit Test Results

122 files  ±0  122 suites  ±0   2m 14s ⏱️ -5s
205 tests ±0  205 ✔️ ±0  0 💤 ±0  0 ±0 
690 runs  ±0  690 ✔️ ±0  0 💤 ±0  0 ±0 

Results for commit 5f2cb67. ± Comparison against base commit 955f366.

This pull request removes 1 and adds 1 tests. Note that renamed tests count towards both.
im.vector.app.features.onboarding.ftueauth.FtueMissingRegistrationStagesComparatorTest ‑ when ordering stages, then prioritizes email
im.vector.app.features.onboarding.ftueauth.MatrixOrgRegistrationStagesComparatorTest ‑ when ordering stages, then prioritizes email

♻️ This comment has been updated with latest results.

@ouchadam ouchadam requested review from a team, yostyle and bmarty and removed request for a team May 16, 2022 13:09
@ouchadam ouchadam changed the title FTYUE - Only override sign up steps for matrix.org FTUE - Only override sign up steps for matrix.org May 16, 2022
Copy link
Member

@bmarty bmarty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, one small remark.

Also having a first time look on FtueMissingRegistrationStagesComparator, I am wondering if we could use compareTo instead of doing a subtraction, as per https://github.com/vector-im/element-android/blob/main/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/auth/data/SsoIdentityProvider.kt#L63.

Warning, it could reverse the order (I never know :) )

}

private fun OnboardingViewState.hasSelectedMatrixOrg() = selectedHomeserver.userFacingUrl == matrixOrgUrl

private fun FlowResult.overrideOrder() = copy(missingStages = missingStages.sortedWith(FtueMissingRegistrationStagesComparator()))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's strange that this extension is actually doing a copyof the state. I would keep the copy at the call site.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will inline 👍

@ouchadam
Copy link
Contributor Author

Also having a first time look on FtueMissingRegistrationStagesComparator, I am wondering if we could use compareTo instead of doing a subtraction, as per https://github.com/vector-im/element-android/blob/main/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/auth/data/SsoIdentityProvider.kt#L63.

Warning, it could reverse the order (I never know :) )

can do 👍 (and the test confirms it's the same order https://github.com/vector-im/element-android/blob/develop/vector/src/test/java/im/vector/app/features/onboarding/ftueauth/FtueMissingRegistrationStagesComparatorTest.kt#L31)

Copy link
Member

@bmarty bmarty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update! One final non blocking remark.

@@ -18,10 +18,10 @@ package im.vector.app.features.onboarding.ftueauth

import org.matrix.android.sdk.api.auth.registration.Stage

class FtueMissingRegistrationStagesComparator : Comparator<Stage> {
class MatrixOrgMissingRegistrationStagesComparator : Comparator<Stage> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: thinking again about the name of this class, I think the word Missing could be removed.

@@ -25,7 +25,7 @@ import im.vector.app.test.fixtures.anOtherStage
import org.amshove.kluent.shouldBeEqualTo
import org.junit.Test

class FtueMissingRegistrationStagesComparatorTest {
class MatrixOrgMissingRegistrationStagesComparatorTest {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same remark about the name here then

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

@bmarty bmarty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect, thanks!

@ouchadam ouchadam requested review from a team and ganfra and removed request for yostyle and a team May 20, 2022 14:31
Copy link
Member

@ganfra ganfra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All good for me, thanks!

@ouchadam ouchadam merged commit a59b8bf into develop May 23, 2022
@ouchadam ouchadam deleted the feature/adm/matrix-org-ordering branch May 23, 2022 20:24
@github-actions
Copy link

Matrix SDK

Integration Tests Results:

  • [org.matrix.android.sdk.session]
    = passed=20 failures=0 errors=0 skipped=3
  • [org.matrix.android.sdk.account]
    = passed=3 failures=0 errors=0 skipped=2
  • [org.matrix.android.sdk.internal]
    = passed=49 failures=1 errors=0 skipped=1
  • [org.matrix.android.sdk.ordering]
    = passed=16 failures=0 errors=0 skipped=0
  • [org.matrix.android.sdk.PermalinkParserTest]
    = passed=2 failures=0 errors=0 skipped=0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR-Small PR with less than 20 updated lines Z-FTUE Issue is relevant to the first time use project or experience
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FTUE - Update sign up steps ordering
3 participants