From b0c294b41b18b95507236c2376f7f7eaeeed1d1f Mon Sep 17 00:00:00 2001 From: Adam Brown Date: Wed, 18 May 2022 14:16:36 +0100 Subject: [PATCH 1/3] avoiding resetting pending state when starting a new login flow - fixes selecting a incorrect homeserver and returning to the previous login page also failing --- .../android/sdk/internal/auth/DefaultAuthenticationService.kt | 4 ---- 1 file changed, 4 deletions(-) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/DefaultAuthenticationService.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/DefaultAuthenticationService.kt index 3edcd996cb..1c2b89be89 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/DefaultAuthenticationService.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/DefaultAuthenticationService.kt @@ -136,10 +136,6 @@ internal class DefaultAuthenticationService @Inject constructor( * valid homeserver API url, the url of Element Web, or anything else. */ override suspend fun getLoginFlow(homeServerConnectionConfig: HomeServerConnectionConfig): LoginFlowResult { - pendingSessionData = null - - pendingSessionStore.delete() - val result = runCatching { getLoginFlowInternal(homeServerConnectionConfig) } From 4f8aedb03802fce0dad701e92a6f5c701e666360 Mon Sep 17 00:00:00 2001 From: Adam Brown Date: Wed, 18 May 2022 14:23:50 +0100 Subject: [PATCH 2/3] moving and updating duplicated service function doc --- .../org/matrix/android/sdk/api/auth/AuthenticationService.kt | 4 +++- .../sdk/internal/auth/DefaultAuthenticationService.kt | 5 ----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/auth/AuthenticationService.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/auth/AuthenticationService.kt index 9a214f99a6..5ae70e1978 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/auth/AuthenticationService.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/auth/AuthenticationService.kt @@ -28,9 +28,11 @@ import org.matrix.android.sdk.api.session.Session * This interface defines methods to authenticate or to create an account to a matrix server. */ interface AuthenticationService { + /** * Request the supported login flows for this homeserver. - * This is the first method to call to be able to get a wizard to login or to create an account + * This is the first method to call to be able to get a wizard to login or to create an account. + * @param homeServerConnectionConfig contains the homeserver URL to login to, a wellKnown lookup will be attempted. */ suspend fun getLoginFlow(homeServerConnectionConfig: HomeServerConnectionConfig): LoginFlowResult diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/DefaultAuthenticationService.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/DefaultAuthenticationService.kt index 1c2b89be89..c64f451a2c 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/DefaultAuthenticationService.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/DefaultAuthenticationService.kt @@ -130,11 +130,6 @@ internal class DefaultAuthenticationService @Inject constructor( ?.trim { it == '/' } } - /** - * This is the entry point of the authentication service. - * homeServerConnectionConfig contains a homeserver URL probably entered by the user, which can be a - * valid homeserver API url, the url of Element Web, or anything else. - */ override suspend fun getLoginFlow(homeServerConnectionConfig: HomeServerConnectionConfig): LoginFlowResult { val result = runCatching { getLoginFlowInternal(homeServerConnectionConfig) From 8e8d38c3bba30360f827a9cb9a29b1e3b1c27055 Mon Sep 17 00:00:00 2001 From: Adam Brown Date: Wed, 18 May 2022 15:20:24 +0100 Subject: [PATCH 3/3] adding changelog entry --- changelog.d/6093.sdk | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/6093.sdk diff --git a/changelog.d/6093.sdk b/changelog.d/6093.sdk new file mode 100644 index 0000000000..8ac5e41b61 --- /dev/null +++ b/changelog.d/6093.sdk @@ -0,0 +1 @@ +Allowing AuthenticationService.getLoginFlow to fail without resetting state from previously successful calls