Check if the server supports MSC3440 using the stable flag from /versions api

This commit is contained in:
ariskotsomitopoulos 2022-03-10 12:07:05 +02:00
parent 03f293f216
commit 45ee9f85e5
3 changed files with 4 additions and 5 deletions

View file

@ -52,6 +52,7 @@ private const val FEATURE_REQUIRE_IDENTITY_SERVER = "m.require_identity_server"
private const val FEATURE_ID_ACCESS_TOKEN = "m.id_access_token"
private const val FEATURE_SEPARATE_ADD_AND_BIND = "m.separate_add_and_bind"
private const val FEATURE_THREADS_MSC3440 = "org.matrix.msc3440"
private const val FEATURE_THREADS_MSC3440_STABLE = "org.matrix.msc3440.stable"
/**
* Return true if the SDK supports this homeserver version
@ -74,7 +75,7 @@ internal fun Versions.isLoginAndRegistrationSupportedBySdk(): Boolean {
*/
internal fun Versions.doesServerSupportThreads(): Boolean {
return getMaxVersion() >= HomeServerVersion.v1_3_0 ||
unstableFeatures?.get(FEATURE_THREADS_MSC3440) ?: false
unstableFeatures?.get(FEATURE_THREADS_MSC3440_STABLE) ?: false
}
/**

View file

@ -70,8 +70,7 @@ internal data class Capabilities(
* Capability to indicate if the server supports MSC3440 Threading
* True if the user can use m.thread relation, false otherwise
*/
// @Json(name = "m.thread")
@Json(name = "io.element.thread")
@Json(name = "m.thread")
val threads: BooleanCapability? = null
)

View file

@ -123,8 +123,7 @@ internal class DefaultGetHomeServerCapabilitiesTask @Inject constructor(
homeServerCapabilitiesEntity.roomVersionsJson = capabilities?.roomVersions?.let {
MoshiProvider.providesMoshi().adapter(RoomVersions::class.java).toJson(it)
}
homeServerCapabilitiesEntity.canUseThreading =
capabilities?.threads?.enabled.orFalse() || getVersionResult?.doesServerSupportThreads().orFalse()
homeServerCapabilitiesEntity.canUseThreading = /* capabilities?.threads?.enabled.orFalse() || */ getVersionResult?.doesServerSupportThreads().orFalse()
}
if (getMediaConfigResult != null) {