Merge pull request #2333 from element-hq/feature/jme/use-unencrypted-room-calls-if-room-is-not-encrypted
Use `MatrixRoom.isEncrypted` value to set encryption mode in room calls
This commit is contained in:
commit
a189e744e7
5 changed files with 7 additions and 5 deletions
1
changelog.d/2333.feature
Normal file
1
changelog.d/2333.feature
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
Allow joining unencrypted video calls in non encrypted rooms.
|
||||||
|
|
@ -43,7 +43,7 @@ class DefaultCallWidgetProvider @Inject constructor(
|
||||||
): Result<Pair<MatrixWidgetDriver, String>> = runCatching {
|
): Result<Pair<MatrixWidgetDriver, String>> = runCatching {
|
||||||
val room = matrixClientsProvider.getOrRestore(sessionId).getOrThrow().getRoom(roomId) ?: error("Room not found")
|
val room = matrixClientsProvider.getOrRestore(sessionId).getOrThrow().getRoom(roomId) ?: error("Room not found")
|
||||||
val baseUrl = appPreferencesStore.getCustomElementCallBaseUrlFlow().firstOrNull() ?: ElementCallConfig.DEFAULT_BASE_URL
|
val baseUrl = appPreferencesStore.getCustomElementCallBaseUrlFlow().firstOrNull() ?: ElementCallConfig.DEFAULT_BASE_URL
|
||||||
val widgetSettings = callWidgetSettingsProvider.provide(baseUrl)
|
val widgetSettings = callWidgetSettingsProvider.provide(baseUrl, encrypted = room.isEncrypted)
|
||||||
val callUrl = room.generateWidgetWebViewUrl(widgetSettings, clientId, languageTag, theme).getOrThrow()
|
val callUrl = room.generateWidgetWebViewUrl(widgetSettings, clientId, languageTag, theme).getOrThrow()
|
||||||
room.getWidgetDriver(widgetSettings).getOrThrow() to callUrl
|
room.getWidgetDriver(widgetSettings).getOrThrow() to callUrl
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ import java.util.UUID
|
||||||
interface CallWidgetSettingsProvider {
|
interface CallWidgetSettingsProvider {
|
||||||
fun provide(
|
fun provide(
|
||||||
baseUrl: String,
|
baseUrl: String,
|
||||||
widgetId: String = UUID.randomUUID().toString()
|
widgetId: String = UUID.randomUUID().toString(),
|
||||||
|
encrypted: Boolean,
|
||||||
): MatrixWidgetSettings
|
): MatrixWidgetSettings
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ import javax.inject.Inject
|
||||||
|
|
||||||
@ContributesBinding(AppScope::class)
|
@ContributesBinding(AppScope::class)
|
||||||
class DefaultCallWidgetSettingsProvider @Inject constructor() : CallWidgetSettingsProvider {
|
class DefaultCallWidgetSettingsProvider @Inject constructor() : CallWidgetSettingsProvider {
|
||||||
override fun provide(baseUrl: String, widgetId: String): MatrixWidgetSettings {
|
override fun provide(baseUrl: String, widgetId: String, encrypted: Boolean): MatrixWidgetSettings {
|
||||||
val options = VirtualElementCallWidgetOptions(
|
val options = VirtualElementCallWidgetOptions(
|
||||||
elementCallUrl = baseUrl,
|
elementCallUrl = baseUrl,
|
||||||
widgetId = widgetId,
|
widgetId = widgetId,
|
||||||
|
|
@ -40,7 +40,7 @@ class DefaultCallWidgetSettingsProvider @Inject constructor() : CallWidgetSettin
|
||||||
confineToRoom = true,
|
confineToRoom = true,
|
||||||
font = null,
|
font = null,
|
||||||
analyticsId = null,
|
analyticsId = null,
|
||||||
encryption = EncryptionSystem.PerParticipantKeys,
|
encryption = if (encrypted) EncryptionSystem.PerParticipantKeys else EncryptionSystem.Unencrypted,
|
||||||
)
|
)
|
||||||
val rustWidgetSettings = newVirtualElementCallWidget(options)
|
val rustWidgetSettings = newVirtualElementCallWidget(options)
|
||||||
return MatrixWidgetSettings.fromRustWidgetSettings(rustWidgetSettings)
|
return MatrixWidgetSettings.fromRustWidgetSettings(rustWidgetSettings)
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ class FakeCallWidgetSettingsProvider(
|
||||||
) : CallWidgetSettingsProvider {
|
) : CallWidgetSettingsProvider {
|
||||||
val providedBaseUrls = mutableListOf<String>()
|
val providedBaseUrls = mutableListOf<String>()
|
||||||
|
|
||||||
override fun provide(baseUrl: String, widgetId: String): MatrixWidgetSettings {
|
override fun provide(baseUrl: String, widgetId: String, encrypted: Boolean): MatrixWidgetSettings {
|
||||||
providedBaseUrls += baseUrl
|
providedBaseUrls += baseUrl
|
||||||
return provideFn(baseUrl, widgetId)
|
return provideFn(baseUrl, widgetId)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue