Add support for login link (#4752)

* Add support for login link

https://mobile.element.io/element?account_provider=example.org&login_hint=mxid:@alice:example.org

* Update screenshots

* Reduce code duplication

* Add test on OnBoardingPresenter

* Fix tool

* Ignore login parameter if user is not allowed to connect to the provided server.

* Improve tests.

* Cleanup

* Revert change on Project.xml.

* Add documentation

* Improve LoginHelper

* Rename LoginFlow to LoginMode

Move LoginFlow to package io.element.android.features.login.impl.login
Rename some implementation of LoginMode
Rename LoginFlowView to LoginModeView

* Change launchMode of MainActivity from `singleTop` to `singleTask`

Using launchMode singleTask to avoid multiple instances of the Activity when the app is already open. This is important for incoming share and for opening the application from a mobile.element.io link.

Closes #4074

---------

Co-authored-by: ElementBot <android@element.io>
This commit is contained in:
Benoit Marty 2025-05-21 18:19:42 +02:00 committed by GitHub
parent 60c4155108
commit 5a2aeac6b6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
52 changed files with 1092 additions and 363 deletions

View file

@ -34,11 +34,17 @@
android:value='androidx.startup' />
</provider>
<!--
Using launchMode singleTask to avoid multiple instances of the Activity
when the app is already open. This is important for incoming share (see
https://github.com/element-hq/element-x-android/issues/4074) and for opening
the application from a mobile.element.io link.
-->
<activity
android:name=".MainActivity"
android:configChanges="orientation|screenSize|screenLayout|keyboardHidden|uiMode"
android:exported="true"
android:launchMode="singleTop"
android:launchMode="singleTask"
android:theme="@style/Theme.ElementX.Splash"
android:windowSoftInputMode="adjustResize">
<intent-filter>
@ -54,6 +60,9 @@
android:host="open"
android:scheme="elementx" />
</intent-filter>
<!--
Oidc redirection
-->
<intent-filter>
<action android:name="android.intent.action.VIEW" />
@ -80,6 +89,21 @@
<!-- Matching asset file: https://staging.element.io/.well-known/assetlinks.json -->
<data android:host="staging.element.io" />
</intent-filter>
<!--
Element mobile links
Example: https://mobile.element.io/element?account_provider=example.org&login_hint=mxid:@alice:example.org
-->
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https" />
<!-- Matching asset file: https://mobile.element.io/.well-known/assetlinks.json -->
<data android:host="mobile.element.io" />
<data android:path="/element" />
</intent-filter>
<!--
matrix.to links
Note: On Android 12 and higher clicking a web link (that is not an Android App Link) always shows content in a web browser