From 57a5714fb5915424822c5fa18fcc3d0fc9776dba Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Thu, 4 Jun 2020 11:11:19 +0200 Subject: [PATCH 1/4] Add the ability to compare Homeserver version (#1442) --- .../matrix/android/api/auth/data/Versions.kt | 30 ++++++---- .../auth/version/HomeServerVersion.kt | 52 ++++++++++++++++++ .../android/api/auth/data/VersionsKtTest.kt | 55 +++++++++++++++++++ 3 files changed, 126 insertions(+), 11 deletions(-) create mode 100644 matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/auth/version/HomeServerVersion.kt create mode 100644 matrix-sdk-android/src/test/java/im/vector/matrix/android/api/auth/data/VersionsKtTest.kt diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/auth/data/Versions.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/auth/data/Versions.kt index c4186c6ec5..e17209b316 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/auth/data/Versions.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/auth/data/Versions.kt @@ -18,6 +18,7 @@ package im.vector.matrix.android.api.auth.data import com.squareup.moshi.Json import com.squareup.moshi.JsonClass +import im.vector.matrix.android.internal.auth.version.HomeServerVersion /** * Model for https://matrix.org/docs/spec/client_server/latest#get-matrix-client-versions @@ -47,13 +48,13 @@ data class Versions( ) // MatrixClientServerAPIVersion -private const val r0_0_1 = "r0.0.1" -private const val r0_1_0 = "r0.1.0" -private const val r0_2_0 = "r0.2.0" -private const val r0_3_0 = "r0.3.0" -private const val r0_4_0 = "r0.4.0" -private const val r0_5_0 = "r0.5.0" -private const val r0_6_0 = "r0.6.0" +private val r0_0_1 = HomeServerVersion.parse("r0.0.1")!! +private val r0_1_0 = HomeServerVersion.parse("r0.1.0")!! +private val r0_2_0 = HomeServerVersion.parse("r0.2.0")!! +private val r0_3_0 = HomeServerVersion.parse("r0.3.0")!! +private val r0_4_0 = HomeServerVersion.parse("r0.4.0")!! +private val r0_5_0 = HomeServerVersion.parse("r0.5.0")!! +private val r0_6_0 = HomeServerVersion.parse("r0.6.0")!! // MatrixVersionsFeature private const val FEATURE_LAZY_LOAD_MEMBERS = "m.lazy_load_members" @@ -83,7 +84,7 @@ fun Versions.isLoginAndRegistrationSupportedBySdk(): Boolean { * @return true if the server support the lazy loading of room members */ private fun Versions.supportLazyLoadMembers(): Boolean { - return supportedVersions?.contains(r0_5_0) == true + return getMaxVersion() >= r0_5_0 || unstableFeatures?.get(FEATURE_LAZY_LOAD_MEMBERS) == true } @@ -92,7 +93,7 @@ private fun Versions.supportLazyLoadMembers(): Boolean { * adding a 3pid or resetting password. */ private fun Versions.doesServerRequireIdentityServerParam(): Boolean { - if (supportedVersions?.contains(r0_6_0) == true) return false + if (getMaxVersion() >= r0_6_0) return false return unstableFeatures?.get(FEATURE_REQUIRE_IDENTITY_SERVER) ?: true } @@ -101,11 +102,18 @@ private fun Versions.doesServerRequireIdentityServerParam(): Boolean { * Some homeservers may trigger errors if they are not prepared for the new parameter. */ private fun Versions.doesServerAcceptIdentityAccessToken(): Boolean { - return supportedVersions?.contains(r0_6_0) == true + return getMaxVersion() >= r0_6_0 || unstableFeatures?.get(FEATURE_ID_ACCESS_TOKEN) ?: false } private fun Versions.doesServerSeparatesAddAndBind(): Boolean { - return supportedVersions?.contains(r0_6_0) == true + return getMaxVersion() >= r0_6_0 || unstableFeatures?.get(FEATURE_SEPARATE_ADD_AND_BIND) ?: false } + +private fun Versions.getMaxVersion(): HomeServerVersion { + return supportedVersions + ?.mapNotNull { HomeServerVersion.parse(it) } + ?.max() + ?: r0_0_1 +} diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/auth/version/HomeServerVersion.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/auth/version/HomeServerVersion.kt new file mode 100644 index 0000000000..0ea230774e --- /dev/null +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/auth/version/HomeServerVersion.kt @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2020 New Vector Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package im.vector.matrix.android.internal.auth.version + +/** + * Values will take the form "rX.Y.Z". + * Ref: https://matrix.org/docs/spec/client_server/latest#get-matrix-client-versions + */ +internal data class HomeServerVersion( + val major: Int, + val minor: Int, + val patch: Int +) : Comparable { + override fun compareTo(other: HomeServerVersion): Int { + return when { + major > other.major -> 1 + major < other.major -> -1 + minor > other.minor -> 1 + minor < other.minor -> -1 + patch > other.patch -> 1 + patch < other.patch -> -1 + else -> 0 + } + } + + companion object { + internal val pattern = Regex("""r(\d+)\.(\d+)\.(\d+)""") + + internal fun parse(value: String): HomeServerVersion? { + val result = pattern.matchEntire(value) ?: return null + return HomeServerVersion( + major = result.groupValues[1].toInt(), + minor = result.groupValues[2].toInt(), + patch = result.groupValues[3].toInt() + ) + } + } +} diff --git a/matrix-sdk-android/src/test/java/im/vector/matrix/android/api/auth/data/VersionsKtTest.kt b/matrix-sdk-android/src/test/java/im/vector/matrix/android/api/auth/data/VersionsKtTest.kt new file mode 100644 index 0000000000..b129c019b5 --- /dev/null +++ b/matrix-sdk-android/src/test/java/im/vector/matrix/android/api/auth/data/VersionsKtTest.kt @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2020 New Vector Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package im.vector.matrix.android.api.auth.data + +import org.amshove.kluent.shouldBe +import org.junit.Test + +class VersionsKtTest { + + @Test + fun isSupportedBySdkTooLow() { + Versions(supportedVersions = listOf("r0.4.0")).isSupportedBySdk() shouldBe false + Versions(supportedVersions = listOf("r0.4.1")).isSupportedBySdk() shouldBe false + } + + @Test + fun isSupportedBySdkUnstable() { + Versions(supportedVersions = listOf("r0.4.0"), unstableFeatures = mapOf("m.lazy_load_members" to true)).isSupportedBySdk() shouldBe true + } + + @Test + fun isSupportedBySdkOk() { + Versions(supportedVersions = listOf("r0.5.0")).isSupportedBySdk() shouldBe true + Versions(supportedVersions = listOf("r0.5.1")).isSupportedBySdk() shouldBe true + } + + // Was not working + @Test + fun isSupportedBySdkLater() { + Versions(supportedVersions = listOf("r0.6.0")).isSupportedBySdk() shouldBe true + Versions(supportedVersions = listOf("r0.6.1")).isSupportedBySdk() shouldBe true + } + + // Cover cases of issue #1442 + @Test + fun isSupportedBySdk1442() { + Versions(supportedVersions = listOf("r0.5.0", "r0.6.0")).isSupportedBySdk() shouldBe true + Versions(supportedVersions = listOf("r0.5.0", "r0.6.1")).isSupportedBySdk() shouldBe true + Versions(supportedVersions = listOf("r0.6.0")).isSupportedBySdk() shouldBe true + } +} From 532f5e58eaaeb2ef78f777573922873a40a015ce Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Thu, 4 Jun 2020 11:30:24 +0200 Subject: [PATCH 2/4] Move class Versions to internal package --- .../matrix/android/internal/auth/AuthAPI.kt | 2 +- .../auth/DefaultAuthenticationService.kt | 6 ++-- .../auth/version/HomeServerVersion.kt | 8 +++++ .../auth/version}/Versions.kt | 30 +++++++------------ .../session/homeserver/CapabilitiesAPI.kt | 2 +- .../DefaultGetHomeServerCapabilitiesTask.kt | 4 +-- .../android/api/auth/data/VersionsKtTest.kt | 2 ++ 7 files changed, 27 insertions(+), 27 deletions(-) rename matrix-sdk-android/src/main/java/im/vector/matrix/android/{api/auth/data => internal/auth/version}/Versions.kt (77%) diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/auth/AuthAPI.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/auth/AuthAPI.kt index 2f03c99421..7eaadd8ee2 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/auth/AuthAPI.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/auth/AuthAPI.kt @@ -17,7 +17,6 @@ package im.vector.matrix.android.internal.auth import im.vector.matrix.android.api.auth.data.Credentials -import im.vector.matrix.android.api.auth.data.Versions import im.vector.matrix.android.internal.auth.data.LoginFlowResponse import im.vector.matrix.android.internal.auth.data.PasswordLoginParams import im.vector.matrix.android.internal.auth.data.RiotConfig @@ -27,6 +26,7 @@ import im.vector.matrix.android.internal.auth.registration.AddThreePidRegistrati import im.vector.matrix.android.internal.auth.registration.RegistrationParams import im.vector.matrix.android.internal.auth.registration.SuccessResult import im.vector.matrix.android.internal.auth.registration.ValidationCodeBody +import im.vector.matrix.android.internal.auth.version.Versions import im.vector.matrix.android.internal.network.NetworkConstants import retrofit2.Call import retrofit2.http.Body diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/auth/DefaultAuthenticationService.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/auth/DefaultAuthenticationService.kt index b543fa7507..5e80acf0f6 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/auth/DefaultAuthenticationService.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/auth/DefaultAuthenticationService.kt @@ -23,9 +23,6 @@ import im.vector.matrix.android.api.auth.AuthenticationService import im.vector.matrix.android.api.auth.data.Credentials import im.vector.matrix.android.api.auth.data.HomeServerConnectionConfig import im.vector.matrix.android.api.auth.data.LoginFlowResult -import im.vector.matrix.android.api.auth.data.Versions -import im.vector.matrix.android.api.auth.data.isLoginAndRegistrationSupportedBySdk -import im.vector.matrix.android.api.auth.data.isSupportedBySdk import im.vector.matrix.android.api.auth.login.LoginWizard import im.vector.matrix.android.api.auth.registration.RegistrationWizard import im.vector.matrix.android.api.auth.wellknown.WellknownResult @@ -40,6 +37,9 @@ import im.vector.matrix.android.internal.auth.db.PendingSessionData import im.vector.matrix.android.internal.auth.login.DefaultLoginWizard import im.vector.matrix.android.internal.auth.login.DirectLoginTask import im.vector.matrix.android.internal.auth.registration.DefaultRegistrationWizard +import im.vector.matrix.android.internal.auth.version.Versions +import im.vector.matrix.android.internal.auth.version.isLoginAndRegistrationSupportedBySdk +import im.vector.matrix.android.internal.auth.version.isSupportedBySdk import im.vector.matrix.android.internal.di.Unauthenticated import im.vector.matrix.android.internal.network.RetrofitFactory import im.vector.matrix.android.internal.network.executeRequest diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/auth/version/HomeServerVersion.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/auth/version/HomeServerVersion.kt index 0ea230774e..514f29a550 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/auth/version/HomeServerVersion.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/auth/version/HomeServerVersion.kt @@ -48,5 +48,13 @@ internal data class HomeServerVersion( patch = result.groupValues[3].toInt() ) } + + val r0_0_1 = parse("r0.0.1")!! + val r0_1_0 = parse("r0.1.0")!! + val r0_2_0 = parse("r0.2.0")!! + val r0_3_0 = parse("r0.3.0")!! + val r0_4_0 = parse("r0.4.0")!! + val r0_5_0 = parse("r0.5.0")!! + val r0_6_0 = parse("r0.6.0")!! } } diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/auth/data/Versions.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/auth/version/Versions.kt similarity index 77% rename from matrix-sdk-android/src/main/java/im/vector/matrix/android/api/auth/data/Versions.kt rename to matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/auth/version/Versions.kt index e17209b316..a65be58e54 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/auth/data/Versions.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/auth/version/Versions.kt @@ -1,5 +1,5 @@ /* - * Copyright 2018 New Vector Ltd + * Copyright (c) 2020 New Vector Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,11 +14,10 @@ * limitations under the License. */ -package im.vector.matrix.android.api.auth.data +package im.vector.matrix.android.internal.auth.version import com.squareup.moshi.Json import com.squareup.moshi.JsonClass -import im.vector.matrix.android.internal.auth.version.HomeServerVersion /** * Model for https://matrix.org/docs/spec/client_server/latest#get-matrix-client-versions @@ -39,7 +38,7 @@ import im.vector.matrix.android.internal.auth.version.HomeServerVersion * */ @JsonClass(generateAdapter = true) -data class Versions( +internal data class Versions( @Json(name = "versions") val supportedVersions: List? = null, @@ -47,15 +46,6 @@ data class Versions( val unstableFeatures: Map? = null ) -// MatrixClientServerAPIVersion -private val r0_0_1 = HomeServerVersion.parse("r0.0.1")!! -private val r0_1_0 = HomeServerVersion.parse("r0.1.0")!! -private val r0_2_0 = HomeServerVersion.parse("r0.2.0")!! -private val r0_3_0 = HomeServerVersion.parse("r0.3.0")!! -private val r0_4_0 = HomeServerVersion.parse("r0.4.0")!! -private val r0_5_0 = HomeServerVersion.parse("r0.5.0")!! -private val r0_6_0 = HomeServerVersion.parse("r0.6.0")!! - // MatrixVersionsFeature private const val FEATURE_LAZY_LOAD_MEMBERS = "m.lazy_load_members" private const val FEATURE_REQUIRE_IDENTITY_SERVER = "m.require_identity_server" @@ -65,14 +55,14 @@ private const val FEATURE_SEPARATE_ADD_AND_BIND = "m.separate_add_and_bind" /** * Return true if the SDK supports this homeserver version */ -fun Versions.isSupportedBySdk(): Boolean { +internal fun Versions.isSupportedBySdk(): Boolean { return supportLazyLoadMembers() } /** * Return true if the SDK supports this homeserver version for login and registration */ -fun Versions.isLoginAndRegistrationSupportedBySdk(): Boolean { +internal fun Versions.isLoginAndRegistrationSupportedBySdk(): Boolean { return !doesServerRequireIdentityServerParam() && doesServerAcceptIdentityAccessToken() && doesServerSeparatesAddAndBind() @@ -84,7 +74,7 @@ fun Versions.isLoginAndRegistrationSupportedBySdk(): Boolean { * @return true if the server support the lazy loading of room members */ private fun Versions.supportLazyLoadMembers(): Boolean { - return getMaxVersion() >= r0_5_0 + return getMaxVersion() >= HomeServerVersion.r0_5_0 || unstableFeatures?.get(FEATURE_LAZY_LOAD_MEMBERS) == true } @@ -93,7 +83,7 @@ private fun Versions.supportLazyLoadMembers(): Boolean { * adding a 3pid or resetting password. */ private fun Versions.doesServerRequireIdentityServerParam(): Boolean { - if (getMaxVersion() >= r0_6_0) return false + if (getMaxVersion() >= HomeServerVersion.r0_6_0) return false return unstableFeatures?.get(FEATURE_REQUIRE_IDENTITY_SERVER) ?: true } @@ -102,12 +92,12 @@ private fun Versions.doesServerRequireIdentityServerParam(): Boolean { * Some homeservers may trigger errors if they are not prepared for the new parameter. */ private fun Versions.doesServerAcceptIdentityAccessToken(): Boolean { - return getMaxVersion() >= r0_6_0 + return getMaxVersion() >= HomeServerVersion.r0_6_0 || unstableFeatures?.get(FEATURE_ID_ACCESS_TOKEN) ?: false } private fun Versions.doesServerSeparatesAddAndBind(): Boolean { - return getMaxVersion() >= r0_6_0 + return getMaxVersion() >= HomeServerVersion.r0_6_0 || unstableFeatures?.get(FEATURE_SEPARATE_ADD_AND_BIND) ?: false } @@ -115,5 +105,5 @@ private fun Versions.getMaxVersion(): HomeServerVersion { return supportedVersions ?.mapNotNull { HomeServerVersion.parse(it) } ?.max() - ?: r0_0_1 + ?: HomeServerVersion.r0_0_1 } diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/homeserver/CapabilitiesAPI.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/homeserver/CapabilitiesAPI.kt index 880a8fbc31..f96863bea6 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/homeserver/CapabilitiesAPI.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/homeserver/CapabilitiesAPI.kt @@ -16,7 +16,7 @@ package im.vector.matrix.android.internal.session.homeserver -import im.vector.matrix.android.api.auth.data.Versions +import im.vector.matrix.android.internal.auth.version.Versions import im.vector.matrix.android.internal.network.NetworkConstants import retrofit2.Call import retrofit2.http.GET diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/homeserver/DefaultGetHomeServerCapabilitiesTask.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/homeserver/DefaultGetHomeServerCapabilitiesTask.kt index 56b9dfc294..f1ee8b4583 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/homeserver/DefaultGetHomeServerCapabilitiesTask.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/homeserver/DefaultGetHomeServerCapabilitiesTask.kt @@ -17,10 +17,10 @@ package im.vector.matrix.android.internal.session.homeserver import com.zhuinden.monarchy.Monarchy -import im.vector.matrix.android.api.auth.data.Versions -import im.vector.matrix.android.api.auth.data.isLoginAndRegistrationSupportedBySdk import im.vector.matrix.android.api.auth.wellknown.WellknownResult import im.vector.matrix.android.api.session.homeserver.HomeServerCapabilities +import im.vector.matrix.android.internal.auth.version.Versions +import im.vector.matrix.android.internal.auth.version.isLoginAndRegistrationSupportedBySdk import im.vector.matrix.android.internal.database.model.HomeServerCapabilitiesEntity import im.vector.matrix.android.internal.database.query.getOrCreate import im.vector.matrix.android.internal.di.UserId diff --git a/matrix-sdk-android/src/test/java/im/vector/matrix/android/api/auth/data/VersionsKtTest.kt b/matrix-sdk-android/src/test/java/im/vector/matrix/android/api/auth/data/VersionsKtTest.kt index b129c019b5..fa6e47f96d 100644 --- a/matrix-sdk-android/src/test/java/im/vector/matrix/android/api/auth/data/VersionsKtTest.kt +++ b/matrix-sdk-android/src/test/java/im/vector/matrix/android/api/auth/data/VersionsKtTest.kt @@ -16,6 +16,8 @@ package im.vector.matrix.android.api.auth.data +import im.vector.matrix.android.internal.auth.version.Versions +import im.vector.matrix.android.internal.auth.version.isSupportedBySdk import org.amshove.kluent.shouldBe import org.junit.Test From fce8a3bc18424239843e31e31c6813b7b309e4e9 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Thu, 4 Jun 2020 11:43:54 +0200 Subject: [PATCH 3/4] changes.md --- CHANGES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.md b/CHANGES.md index cd6ffe9995..b484daf8e3 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -8,6 +8,7 @@ Features ✨: Improvements 🙌: - New wording for notice when current user is the sender - Hide "X made no changes" event by default in timeline (#1430) + - Improve checking of homeserver version support (#1442) Bugfix 🐛: - Switch theme is not fully taken into account without restarting the app From d4ba9fa09a1ffc31f47ccec237788f10022dc9f7 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Mon, 8 Jun 2020 18:15:00 +0200 Subject: [PATCH 4/4] Cleanup after Ganfra's review --- .../internal/auth/version/HomeServerVersion.kt | 14 +++++++------- .../android/internal/auth/version/Versions.kt | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/auth/version/HomeServerVersion.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/auth/version/HomeServerVersion.kt index 514f29a550..7e0a95dfef 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/auth/version/HomeServerVersion.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/auth/version/HomeServerVersion.kt @@ -49,12 +49,12 @@ internal data class HomeServerVersion( ) } - val r0_0_1 = parse("r0.0.1")!! - val r0_1_0 = parse("r0.1.0")!! - val r0_2_0 = parse("r0.2.0")!! - val r0_3_0 = parse("r0.3.0")!! - val r0_4_0 = parse("r0.4.0")!! - val r0_5_0 = parse("r0.5.0")!! - val r0_6_0 = parse("r0.6.0")!! + val r0_0_0 = HomeServerVersion(major = 0, minor = 0, patch = 0) + val r0_1_0 = HomeServerVersion(major = 0, minor = 1, patch = 0) + val r0_2_0 = HomeServerVersion(major = 0, minor = 2, patch = 0) + val r0_3_0 = HomeServerVersion(major = 0, minor = 3, patch = 0) + val r0_4_0 = HomeServerVersion(major = 0, minor = 4, patch = 0) + val r0_5_0 = HomeServerVersion(major = 0, minor = 5, patch = 0) + val r0_6_0 = HomeServerVersion(major = 0, minor = 6, patch = 0) } } diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/auth/version/Versions.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/auth/version/Versions.kt index a65be58e54..aee5f7e3f3 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/auth/version/Versions.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/auth/version/Versions.kt @@ -105,5 +105,5 @@ private fun Versions.getMaxVersion(): HomeServerVersion { return supportedVersions ?.mapNotNull { HomeServerVersion.parse(it) } ?.max() - ?: HomeServerVersion.r0_0_1 + ?: HomeServerVersion.r0_0_0 }