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

@ -19,7 +19,6 @@ import io.element.android.libraries.matrix.api.core.TransactionId
import io.element.android.libraries.matrix.api.core.UniqueId
import io.element.android.libraries.matrix.api.core.UserId
import io.element.android.libraries.matrix.api.room.RoomNotificationMode
import io.element.android.libraries.matrix.api.room.RoomNotificationSettings
const val A_USER_NAME = "alice"
const val A_USER_NAME_2 = "Bob"
@ -73,7 +72,6 @@ const val A_HOMESERVER_URL_2 = "matrix-client.org"
val A_HOMESERVER = MatrixHomeServerDetails(A_HOMESERVER_URL, supportsPasswordLogin = true, supportsOidcLogin = false)
val A_HOMESERVER_OIDC = MatrixHomeServerDetails(A_HOMESERVER_URL, supportsPasswordLogin = false, supportsOidcLogin = true)
val A_ROOM_NOTIFICATION_MODE = RoomNotificationMode.MUTE
val A_ROOM_NOTIFICATION_SETTINGS = RoomNotificationSettings(mode = A_ROOM_NOTIFICATION_MODE, isDefault = false)
const val AN_AVATAR_URL = "mxc://data"
@ -88,3 +86,5 @@ val A_SERVER_LIST = listOf("server1", "server2")
const val A_TIMESTAMP = 567L
const val A_FORMATTED_DATE = "April 6, 1980 at 6:35 PM"
const val A_LOGIN_HINT = "mxid:@alice:example.org"

View file

@ -87,7 +87,10 @@ class FakeMatrixAuthenticationService(
return importCreatedSessionLambda(externalSession)
}
override suspend fun getOidcUrl(prompt: OidcPrompt): Result<OidcDetails> = simulateLongTask {
override suspend fun getOidcUrl(
prompt: OidcPrompt,
loginHint: String?,
): Result<OidcDetails> = simulateLongTask {
oidcError?.let { Result.failure(it) } ?: Result.success(A_OIDC_DATA)
}