fun RawService.getElementWellknown() now takes a SessionParams for parameter to be able to use something else than the userId's domain
This commit is contained in:
parent
984b1dd6a8
commit
0f25e2986f
|
@ -56,7 +56,7 @@ class JitsiService @Inject constructor(
|
|||
// Build data for a jitsi widget
|
||||
val widgetId: String = WidgetType.Jitsi.preferred + "_" + session.myUserId + "_" + System.currentTimeMillis()
|
||||
val preferredJitsiDomain = tryOrNull {
|
||||
rawService.getElementWellknown(session.myUserId)
|
||||
rawService.getElementWellknown(session.sessionParams)
|
||||
?.jitsiServer
|
||||
?.preferredDomain
|
||||
}
|
||||
|
|
|
@ -86,7 +86,7 @@ class CreateDirectRoomViewModel @AssistedInject constructor(@Assisted
|
|||
setState { copy(createAndInviteState = Loading()) }
|
||||
|
||||
viewModelScope.launch(Dispatchers.IO) {
|
||||
val adminE2EByDefault = rawService.getElementWellknown(session.myUserId)
|
||||
val adminE2EByDefault = rawService.getElementWellknown(session.sessionParams)
|
||||
?.isE2EByDefault()
|
||||
?: true
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ class DirectRoomHelper @Inject constructor(
|
|||
if (existingRoomId != null) {
|
||||
roomId = existingRoomId
|
||||
} else {
|
||||
val adminE2EByDefault = rawService.getElementWellknown(session.myUserId)
|
||||
val adminE2EByDefault = rawService.getElementWellknown(session.sessionParams)
|
||||
?.isE2EByDefault()
|
||||
?: true
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ class HomeServerCapabilitiesViewModel @AssistedInject constructor(
|
|||
private fun initAdminE2eByDefault() {
|
||||
viewModelScope.launch(Dispatchers.IO) {
|
||||
val adminE2EByDefault = tryOrNull {
|
||||
rawService.getElementWellknown(session.myUserId)
|
||||
rawService.getElementWellknown(session.sessionParams)
|
||||
?.isE2EByDefault()
|
||||
?: true
|
||||
} ?: true
|
||||
|
|
|
@ -16,11 +16,14 @@
|
|||
|
||||
package im.vector.app.features.raw.wellknown
|
||||
|
||||
import org.matrix.android.sdk.api.auth.data.SessionParams
|
||||
import org.matrix.android.sdk.api.extensions.tryOrNull
|
||||
import org.matrix.android.sdk.api.raw.RawService
|
||||
|
||||
suspend fun RawService.getElementWellknown(userId: String): ElementWellKnown? {
|
||||
return tryOrNull { getWellknown(userId) }
|
||||
suspend fun RawService.getElementWellknown(sessionParams: SessionParams): ElementWellKnown? {
|
||||
// By default we use the domain of the userId to retrieve the .well-known data
|
||||
val domain = sessionParams.userId.substringAfter(":")
|
||||
return tryOrNull { getWellknown(domain) }
|
||||
?.let { ElementWellKnownMapper.from(it) }
|
||||
}
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ class CreateRoomViewModel @AssistedInject constructor(@Assisted private val init
|
|||
private fun initAdminE2eByDefault() {
|
||||
viewModelScope.launch(Dispatchers.IO) {
|
||||
adminE2EByDefault = tryOrNull {
|
||||
rawService.getElementWellknown(session.myUserId)
|
||||
rawService.getElementWellknown(session.sessionParams)
|
||||
?.isE2EByDefault()
|
||||
?: true
|
||||
} ?: true
|
||||
|
|
|
@ -157,7 +157,7 @@ class VectorSettingsSecurityPrivacyFragment @Inject constructor(
|
|||
findPreference<VectorPreference>(VectorPreferences.SETTINGS_CRYPTOGRAPHY_HS_ADMIN_DISABLED_E2E_DEFAULT)?.isVisible =
|
||||
vectorActivity.getVectorComponent()
|
||||
.rawService()
|
||||
.getElementWellknown(session.myUserId)
|
||||
.getElementWellknown(session.sessionParams)
|
||||
?.isE2EByDefault() == false
|
||||
}
|
||||
}
|
||||
|
|
|
@ -75,7 +75,7 @@ class CreateSpaceViewModelTask @Inject constructor(
|
|||
val childIds = mutableListOf<String>()
|
||||
|
||||
val e2eByDefault = tryOrNull {
|
||||
rawService.getElementWellknown(session.myUserId)
|
||||
rawService.getElementWellknown(session.sessionParams)
|
||||
?.isE2EByDefault()
|
||||
?: true
|
||||
} ?: true
|
||||
|
|
|
@ -81,7 +81,7 @@ class SpacePeopleViewModel @AssistedInject constructor(
|
|||
setState { copy(createAndInviteState = Loading()) }
|
||||
|
||||
viewModelScope.launch(Dispatchers.IO) {
|
||||
val adminE2EByDefault = rawService.getElementWellknown(session.myUserId)
|
||||
val adminE2EByDefault = rawService.getElementWellknown(session.sessionParams)
|
||||
?.isE2EByDefault()
|
||||
?: true
|
||||
|
||||
|
|
Loading…
Reference in New Issue