From fee595cfdc7b243274aba8a4273997f5a540b79c Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Tue, 14 Jan 2025 17:38:24 +0100 Subject: [PATCH] Asking for EndToEnd encryption security level when scheduling a meeting/creating a group call if LIME is available --- .../chat/viewmodel/AbstractConversationViewModel.kt | 10 ++++++++++ .../ui/main/history/viewmodel/StartCallViewModel.kt | 10 ++++++++++ .../meetings/viewmodel/ScheduleMeetingViewModel.kt | 9 +++++++++ 3 files changed, 29 insertions(+) diff --git a/app/src/main/java/org/linphone/ui/main/chat/viewmodel/AbstractConversationViewModel.kt b/app/src/main/java/org/linphone/ui/main/chat/viewmodel/AbstractConversationViewModel.kt index b7ecccfcf..5b8067d2f 100644 --- a/app/src/main/java/org/linphone/ui/main/chat/viewmodel/AbstractConversationViewModel.kt +++ b/app/src/main/java/org/linphone/ui/main/chat/viewmodel/AbstractConversationViewModel.kt @@ -28,6 +28,7 @@ import org.linphone.LinphoneApplication.Companion.coreContext import org.linphone.R import org.linphone.core.Address import org.linphone.core.ChatRoom +import org.linphone.core.Conference import org.linphone.core.ConferenceParams import org.linphone.core.ConferenceScheduler import org.linphone.core.ConferenceSchedulerListenerStub @@ -222,6 +223,15 @@ abstract class AbstractConversationViewModel : GenericViewModel() { // Allows to have a chat room within the conference conferenceInfo.setCapability(StreamType.Text, true) + // Enable end-to-end encryption if client supports it + conferenceInfo.securityLevel = if (LinphoneUtils.isEndToEndEncryptedChatAvailable(core)) { + Log.i("$TAG Requesting EndToEnd security level for conference") + Conference.SecurityLevel.EndToEnd + } else { + Log.i("$TAG Requesting PointToPoint security level for conference") + Conference.SecurityLevel.PointToPoint + } + val participants = arrayOfNulls(chatRoom.participants.size) var index = 0 for (participant in chatRoom.participants) { diff --git a/app/src/main/java/org/linphone/ui/main/history/viewmodel/StartCallViewModel.kt b/app/src/main/java/org/linphone/ui/main/history/viewmodel/StartCallViewModel.kt index 69778db44..23ba2bac0 100644 --- a/app/src/main/java/org/linphone/ui/main/history/viewmodel/StartCallViewModel.kt +++ b/app/src/main/java/org/linphone/ui/main/history/viewmodel/StartCallViewModel.kt @@ -28,6 +28,7 @@ import kotlinx.coroutines.launch import org.linphone.LinphoneApplication.Companion.coreContext import org.linphone.LinphoneApplication.Companion.corePreferences import org.linphone.R +import org.linphone.core.Conference import org.linphone.core.ConferenceScheduler import org.linphone.core.ConferenceSchedulerListenerStub import org.linphone.core.Factory @@ -226,6 +227,15 @@ class StartCallViewModel // Allows to have a chat room within the conference conferenceInfo.setCapability(StreamType.Text, true) + // Enable end-to-end encryption if client supports it + conferenceInfo.securityLevel = if (LinphoneUtils.isEndToEndEncryptedChatAvailable(core)) { + Log.i("$TAG Requesting EndToEnd security level for conference") + Conference.SecurityLevel.EndToEnd + } else { + Log.i("$TAG Requesting PointToPoint security level for conference") + Conference.SecurityLevel.PointToPoint + } + val participants = arrayOfNulls(selection.value.orEmpty().size) var index = 0 for (participant in selection.value.orEmpty()) { diff --git a/app/src/main/java/org/linphone/ui/main/meetings/viewmodel/ScheduleMeetingViewModel.kt b/app/src/main/java/org/linphone/ui/main/meetings/viewmodel/ScheduleMeetingViewModel.kt index 7afc6f674..cde71d26a 100644 --- a/app/src/main/java/org/linphone/ui/main/meetings/viewmodel/ScheduleMeetingViewModel.kt +++ b/app/src/main/java/org/linphone/ui/main/meetings/viewmodel/ScheduleMeetingViewModel.kt @@ -419,6 +419,15 @@ class ScheduleMeetingViewModel // Allows to have a chat room within the conference conferenceInfo.setCapability(StreamType.Text, true) + // Enable end-to-end encryption if client supports it + conferenceInfo.securityLevel = if (LinphoneUtils.isEndToEndEncryptedChatAvailable(core)) { + Log.i("$TAG Requesting EndToEnd security level for conference") + Conference.SecurityLevel.EndToEnd + } else { + Log.i("$TAG Requesting PointToPoint security level for conference") + Conference.SecurityLevel.PointToPoint + } + Log.i("$TAG Computing timestamps") computeTimestampsForSelectedTimezone()