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

Temporary account creation using Element Web. #3467

Merged
merged 8 commits into from
Sep 16, 2024

Conversation

bmarty
Copy link
Member

@bmarty bmarty commented Sep 16, 2024

Content

Add ability to create an account directly from Element X, but using a Url of an Element Web instance.

Motivation and context

Give a temporary way for users to create account, waiting for MAS to be available on matrix.org.

Screenshots / GIFs

AccountCreation

Tests

Note: account creation on matrix.org needs that the URL https://matrix.org/.well-known/element/element.json return some Json. In the mean time, this is possible to test by letting DefaultWebClientUrlForAuthenticationRetriever.retrieve return the value "https://pr42--matrix-react-sdk.netlify.app/#/mobile_register"

Using password

  • Start the app
  • Click on "Create an account"
  • Use matrix.org
  • Click on Continue
  • follow the flow to create the account
  • at the end the account has been created and, the (empty) room list should be displayed

Using Oidc

  • Start the app
  • Click on "Create an account"
  • Change the homserver to an Oidc-support server
  • Click on Continue
  • follow the flow to create the account
  • at the end the account has been created and, the (empty) room list should be displayed

Tested devices

  • Physical
  • Emulator
  • OS version(s):

Checklist

  • Changes have been tested on an Android device or Android emulator with API 23
  • UI change has been tested on both light and dark themes
  • Accessibility has been taken into account. See https://github.com/element-hq/element-x-android/blob/develop/CONTRIBUTING.md#accessibility
  • Pull request is based on the develop branch
  • Pull request title will be used in the release note, it clearly define what will change for the user
  • Pull request includes screenshots or videos if containing UI changes
  • Pull request includes a sign off
  • You've made a self review of your PR

@bmarty bmarty added the PR-Feature For a new feature label Sep 16, 2024
Copy link
Contributor

github-actions bot commented Sep 16, 2024

📱 Scan the QR code below to install the build (arm64 only) for this PR.
QR code
If you can't scan the QR code you can install the build via this link: https://i.diawi.com/npMpQT

@bmarty bmarty changed the title Feature/bma/account creation Temporary account creation using Element Web. Sep 16, 2024
@bmarty bmarty marked this pull request as ready for review September 16, 2024 12:37
@bmarty bmarty requested a review from a team as a code owner September 16, 2024 12:37
@bmarty bmarty requested review from jmartinesp and removed request for a team September 16, 2024 12:37
@bmarty bmarty added the Z-NextRelease For issues and PRs which should be included in the NextRelease. label Sep 16, 2024
Copy link

codecov bot commented Sep 16, 2024

Codecov Report

Attention: Patch coverage is 60.16598% with 96 lines in your changes missing coverage. Please review.

Project coverage is 82.52%. Comparing base (764692b) to head (7f1d9bb).
Report is 26 commits behind head on develop.

Files with missing lines Patch % Lines
...in/impl/screens/createaccount/CreateAccountView.kt 53.62% 30 Missing and 2 partials ⚠️
...screens/createaccount/WebViewMessageInterceptor.kt 0.00% 27 Missing ⚠️
...impl/web/WebClientUrlForAuthenticationRetriever.kt 0.00% 20 Missing ⚠️
...nfirmaccountprovider/ConfirmAccountProviderView.kt 25.00% 8 Missing and 1 partial ⚠️
...creens/createaccount/MobileRegistrationResponse.kt 20.00% 4 Missing ⚠️
...es/login/impl/resolver/network/ElementWellKnown.kt 0.00% 2 Missing ⚠️
...pl/screens/createaccount/CreateAccountPresenter.kt 93.93% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3467      +/-   ##
===========================================
- Coverage    82.63%   82.52%   -0.11%     
===========================================
  Files         1701     1713      +12     
  Lines        40047    40275     +228     
  Branches      4872     4899      +27     
===========================================
+ Hits         33092    33237     +145     
- Misses        5234     5314      +80     
- Partials      1721     1724       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@jmartinesp jmartinesp left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

Comment on lines 38 to 39
// - EC widget API -> Element X (message.data.api == "fromWidget")
// - Element X -> EC widget API (message.data.api == "toWidget"), we should ignore these
Copy link
Member

Choose a reason for hiding this comment

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

Copy&paste issue 😅 ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Will fix, thanks!

import androidx.webkit.WebViewCompat
import androidx.webkit.WebViewFeature

class WebViewMessageInterceptor(
Copy link
Member

Choose a reason for hiding this comment

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

Definitely not for now, but maybe we should extract this to some shared module (androidutils?).

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, I had though about it, but since this is supposed to be a temporary code...

@bmarty bmarty added the Run-Maestro Starts a Maestro Cloud session to run integration tests label Sep 16, 2024
@github-actions github-actions bot removed the Run-Maestro Starts a Maestro Cloud session to run integration tests label Sep 16, 2024
@jmartinesp
Copy link
Member

Just to double check, do we want to merge it with creation enabled while m.org can't create new users without the workaround?

@bmarty
Copy link
Member Author

bmarty commented Sep 16, 2024

Just to double check, do we want to merge it with creation enabled while m.org can't create new users without the workaround?

I guess this is fine. If matrix.org is not ready, this error will be displayed:

image

So this is correct :)

iOS PR has been merged FWIW

@bmarty bmarty merged commit cf2c90e into develop Sep 16, 2024
21 checks passed
@bmarty bmarty deleted the feature/bma/accountCreation branch September 16, 2024 14:52
Copy link

sonarcloud bot commented Sep 16, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR-Feature For a new feature Z-NextRelease For issues and PRs which should be included in the NextRelease.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants