From 8a31e2710168c01dd7469ed0a59e21d4a4eb85ea Mon Sep 17 00:00:00 2001 From: yamilmedina Date: Fri, 6 Dec 2024 15:56:21 +0100 Subject: [PATCH 1/3] chore: empty commit bump From 9f9a1cdc0b33e1f12d2eb9f461b4687d1736bad0 Mon Sep 17 00:00:00 2001 From: yamilmedina Date: Fri, 13 Dec 2024 12:42:44 +0100 Subject: [PATCH 2/3] Revert "revert: conference simulcast support (WPB-11480) (#3107) (#3149)" This reverts commit d8b69f1202e0ea88889c98bf1e2f9cd5016d197c. --- .../wire/kalium/logic/data/call/CallClient.kt | 42 +++++++++++++++++-- gradle/libs.versions.toml | 18 ++++---- .../logic/feature/call/CallManagerImpl.kt | 11 +++-- .../serialization/LenientJsonSerializer.kt | 32 ++++++++++++++ 4 files changed, 87 insertions(+), 16 deletions(-) create mode 100644 util/src/commonMain/kotlin/com.wire.kalium.util/serialization/LenientJsonSerializer.kt diff --git a/data/src/commonMain/kotlin/com/wire/kalium/logic/data/call/CallClient.kt b/data/src/commonMain/kotlin/com/wire/kalium/logic/data/call/CallClient.kt index 7545545157e..0c2f3bb9b79 100644 --- a/data/src/commonMain/kotlin/com/wire/kalium/logic/data/call/CallClient.kt +++ b/data/src/commonMain/kotlin/com/wire/kalium/logic/data/call/CallClient.kt @@ -18,21 +18,55 @@ package com.wire.kalium.logic.data.call +import com.wire.kalium.util.serialization.LenientJsonSerializer +import kotlinx.serialization.ExperimentalSerializationApi +import kotlinx.serialization.KSerializer import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable -import kotlinx.serialization.json.Json +import kotlinx.serialization.descriptors.PrimitiveKind +import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor +import kotlinx.serialization.descriptors.SerialDescriptor +import kotlinx.serialization.descriptors.nullable +import kotlinx.serialization.encoding.Decoder +import kotlinx.serialization.encoding.Encoder @Serializable data class CallClient( @SerialName("userid") val userId: String, @SerialName("clientid") val clientId: String, - @SerialName("in_subconv") val isMemberOfSubconversation: Boolean = false + @SerialName("in_subconv") val isMemberOfSubconversation: Boolean = false, + @SerialName("quality") + @Serializable(with = CallQuality.CallQualityAsIntSerializer::class) + val quality: CallQuality = CallQuality.LOW ) @Serializable data class CallClientList( @SerialName("clients") val clients: List ) { - // TODO(optimization): Use a shared Json instance instead of creating one every time. - fun toJsonString(): String = Json { isLenient = true }.encodeToString(serializer(), this) + fun toJsonString(): String = LenientJsonSerializer.json.encodeToString(serializer(), this) +} + +enum class CallQuality { + ANY, + LOW, + HIGH; + + data object CallQualityAsIntSerializer : KSerializer { + override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor("quality", PrimitiveKind.INT).nullable + + override fun serialize(encoder: Encoder, value: CallQuality) { + encoder.encodeInt(value.ordinal) + } + + @OptIn(ExperimentalSerializationApi::class) + override fun deserialize(decoder: Decoder): CallQuality { + val value = if (decoder.decodeNotNullMark()) decoder.decodeInt() else 0 + return when (value) { + 1 -> LOW + 2 -> HIGH + else -> ANY + } + } + } } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index b6746e68430..86514745b0e 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -5,7 +5,7 @@ activity-compose = "1.9.0" app-compat = "1.6.1" android-paging3 = "3.2.1" cli-kt = "3.5.0" -coroutines = "1.8.0" +coroutines = "1.8.1" compose-compiler = "1.5.13" compose-ui = "1.6.6" compose-material = "1.6.6" @@ -17,12 +17,12 @@ okio = "3.9.0" ok-http = "4.12.0" mockative = "2.2.0" android-work = "2.9.0" -android-test-runner = "1.5.2" -android-test-core-ktx = "1.5.0" -android-test-rules = "1.5.0" -android-test-core = "1.5.0" +android-test-runner = "1.6.2" +android-test-core-ktx = "1.6.1" +android-test-rules = "1.6.1" +android-test-core = "1.6.1" androidx-arch = "2.2.0" -androidx-test-orchestrator = "1.4.2" +androidx-test-orchestrator = "1.5.1" androidx-sqlite = "2.4.0" benasher-uuid = "0.8.0" ktx-datetime = { strictly = "0.5.0" } @@ -37,12 +37,12 @@ sqldelight = "2.0.1" sqlcipher-android = "4.5.6" pbandk = "0.14.2" turbine = "1.1.0" -avs = "9.10.16" +avs = "10.0.1" jna = "5.14.0" core-crypto = "2.0.0" core-crypto-multiplatform = "0.6.0-rc.3-multiplatform-pre1" completeKotlin = "1.1.0" -desugar-jdk = "2.0.4" +desugar-jdk = "2.1.3" kermit = "2.0.3" detekt = "1.23.7" agp = "8.5.2" @@ -50,7 +50,7 @@ dokka = "1.8.20" carthage = "0.0.1" libsodiumBindings = "0.8.7" protobufCodegen = "0.9.4" -annotation = "1.7.1" +annotation = "1.9.1" mordant = "2.0.0-beta13" apache-tika = "2.9.2" mockk = "1.13.10" diff --git a/logic/src/commonJvmAndroid/kotlin/com/wire/kalium/logic/feature/call/CallManagerImpl.kt b/logic/src/commonJvmAndroid/kotlin/com/wire/kalium/logic/feature/call/CallManagerImpl.kt index 693c76d98f9..90244f7eb76 100644 --- a/logic/src/commonJvmAndroid/kotlin/com/wire/kalium/logic/feature/call/CallManagerImpl.kt +++ b/logic/src/commonJvmAndroid/kotlin/com/wire/kalium/logic/feature/call/CallManagerImpl.kt @@ -463,14 +463,19 @@ class CallManagerImpl internal constructor( callClients: CallClientList ) { withCalling { - // Needed to support calls between federated and non federated environments + // Mapping Needed to support calls between federated and non federated environments (domain separation) val clients = callClients.clients.map { callClient -> CallClient( - federatedIdMapper.parseToFederatedId(callClient.userId), - callClient.clientId + userId = federatedIdMapper.parseToFederatedId(callClient.userId), + clientId = callClient.clientId, + isMemberOfSubconversation = callClient.isMemberOfSubconversation, + quality = callClient.quality ) } val clientsJson = CallClientList(clients).toJsonString() + callingLogger.d( + "$TAG - wcall_request_video_streams() called -> Requesting video streams for conversation = ${conversationId.toLogString()}" + ) val conversationIdString = federatedIdMapper.parseToFederatedId(conversationId) calling.wcall_request_video_streams( inst = it, diff --git a/util/src/commonMain/kotlin/com.wire.kalium.util/serialization/LenientJsonSerializer.kt b/util/src/commonMain/kotlin/com.wire.kalium.util/serialization/LenientJsonSerializer.kt new file mode 100644 index 00000000000..3d6507cf8ff --- /dev/null +++ b/util/src/commonMain/kotlin/com.wire.kalium.util/serialization/LenientJsonSerializer.kt @@ -0,0 +1,32 @@ +/* + * Wire + * Copyright (C) 2024 Wire Swiss GmbH + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://www.gnu.org/licenses/. + */ +package com.wire.kalium.util.serialization + +import kotlinx.serialization.json.Json + +/** + * The json serializer for shared usage. + */ +object LenientJsonSerializer { + + val json = Json { + isLenient = true + encodeDefaults = true + ignoreUnknownKeys = true + } +} From a6acc1301b846480a3a248a79f58fb6202f8554f Mon Sep 17 00:00:00 2001 From: yamilmedina Date: Fri, 13 Dec 2024 12:44:29 +0100 Subject: [PATCH 3/3] chore: empty commit bump