Fixed build with 5.3-alpha SDK due to enum relocations changes

This commit is contained in:
Sylvain Berfini 2023-02-22 16:24:38 +01:00
parent 981ee0ac8e
commit 4d90ee0f15
33 changed files with 129 additions and 129 deletions

View file

@ -244,7 +244,7 @@ dependencies {
implementation 'com.google.firebase:firebase-messaging'
}
implementation 'org.linphone:linphone-sdk-android:5.2+'
implementation 'org.linphone:linphone-sdk-android:5.3+'
// Only enable leak canary prior to release
//debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.4'

View file

@ -23,7 +23,7 @@ import androidx.lifecycle.MediatorLiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import org.linphone.LinphoneApplication.Companion.coreContext
import org.linphone.core.ConfiguringState
import org.linphone.core.Config
import org.linphone.core.Core
import org.linphone.core.CoreListenerStub
import org.linphone.core.tools.Log
@ -38,13 +38,17 @@ class RemoteProvisioningViewModel : ViewModel() {
val fetchSuccessfulEvent = MutableLiveData<Event<Boolean>>()
private val listener = object : CoreListenerStub() {
override fun onConfiguringStatus(core: Core, status: ConfiguringState, message: String?) {
override fun onConfiguringStatus(
core: Core,
status: Config.ConfiguringState,
message: String?
) {
fetchInProgress.value = false
when (status) {
ConfiguringState.Successful -> {
Config.ConfiguringState.Successful -> {
fetchSuccessfulEvent.value = Event(true)
}
ConfiguringState.Failed -> {
Config.ConfiguringState.Failed -> {
fetchSuccessfulEvent.value = Event(false)
}
else -> {}

View file

@ -20,12 +20,12 @@
package org.linphone.activities.main.chat
import org.linphone.core.Address
import org.linphone.core.ChatRoomSecurityLevel
import org.linphone.core.ChatRoom
data class GroupChatRoomMember(
val address: Address,
var isAdmin: Boolean = false,
val securityLevel: ChatRoomSecurityLevel = ChatRoomSecurityLevel.ClearText,
val securityLevel: ChatRoom.SecurityLevel = ChatRoom.SecurityLevel.ClearText,
val hasLimeX3DHCapability: Boolean = false,
// A participant not yet added to a group can't be set admin at the same time it's added
val canBeSetAdmin: Boolean = false

View file

@ -365,7 +365,7 @@ class ChatMessagesListAdapter(
val itemSize = AppUtils.getDimension(R.dimen.chat_message_popup_item_height).toInt()
var totalSize = itemSize * 7
if (chatMessage.chatRoom.hasCapability(
ChatRoomCapabilities.OneToOne.toInt()
ChatRoom.Capabilities.OneToOne.toInt()
)
) {
// No message id

View file

@ -42,7 +42,7 @@ import org.linphone.utils.TimestampUtils
class ChatRoomData(val chatRoom: ChatRoom) : ContactDataInterface {
override val contact: MutableLiveData<Friend> = MutableLiveData<Friend>()
override val displayName: MutableLiveData<String> = MutableLiveData<String>()
override val securityLevel: MutableLiveData<ChatRoomSecurityLevel> = MutableLiveData<ChatRoomSecurityLevel>()
override val securityLevel: MutableLiveData<ChatRoom.SecurityLevel> = MutableLiveData<ChatRoom.SecurityLevel>()
override val showGroupChatAvatar: Boolean
get() = !oneToOneChatRoom
override val presenceStatus: MutableLiveData<ConsolidatedPresence> = MutableLiveData<ConsolidatedPresence>()
@ -71,15 +71,15 @@ class ChatRoomData(val chatRoom: ChatRoom) : ContactDataInterface {
val notificationsMuted = MutableLiveData<Boolean>()
private val basicChatRoom: Boolean by lazy {
chatRoom.hasCapability(ChatRoomCapabilities.Basic.toInt())
chatRoom.hasCapability(ChatRoom.Capabilities.Basic.toInt())
}
val oneToOneChatRoom: Boolean by lazy {
chatRoom.hasCapability(ChatRoomCapabilities.OneToOne.toInt())
chatRoom.hasCapability(ChatRoom.Capabilities.OneToOne.toInt())
}
val encryptedChatRoom: Boolean by lazy {
chatRoom.hasCapability(ChatRoomCapabilities.Encrypted.toInt())
chatRoom.hasCapability(ChatRoom.Capabilities.Encrypted.toInt())
}
val contactNewlyFoundEvent: MutableLiveData<Event<Boolean>> by lazy {
@ -131,13 +131,13 @@ class ChatRoomData(val chatRoom: ChatRoom) : ContactDataInterface {
securityLevel.value = level
securityLevelIcon.value = when (level) {
ChatRoomSecurityLevel.Safe -> R.drawable.security_2_indicator
ChatRoomSecurityLevel.Encrypted -> R.drawable.security_1_indicator
ChatRoom.SecurityLevel.Safe -> R.drawable.security_2_indicator
ChatRoom.SecurityLevel.Encrypted -> R.drawable.security_1_indicator
else -> R.drawable.security_alert_indicator
}
securityLevelContentDescription.value = when (level) {
ChatRoomSecurityLevel.Safe -> R.string.content_description_security_level_safe
ChatRoomSecurityLevel.Encrypted -> R.string.content_description_security_level_encrypted
ChatRoom.SecurityLevel.Safe -> R.string.content_description_security_level_safe
ChatRoom.SecurityLevel.Encrypted -> R.string.content_description_security_level_encrypted
else -> R.string.content_description_security_level_unsafe
}
}

View file

@ -21,7 +21,7 @@ package org.linphone.activities.main.chat.data
import org.linphone.LinphoneApplication.Companion.coreContext
import org.linphone.R
import org.linphone.core.ChatRoomSecurityLevel
import org.linphone.core.ChatRoom
import org.linphone.core.ParticipantDevice
class DevicesListChildData(private val device: ParticipantDevice) {
@ -29,16 +29,16 @@ class DevicesListChildData(private val device: ParticipantDevice) {
val securityLevelIcon: Int by lazy {
when (device.securityLevel) {
ChatRoomSecurityLevel.Safe -> R.drawable.security_2_indicator
ChatRoomSecurityLevel.Encrypted -> R.drawable.security_1_indicator
ChatRoom.SecurityLevel.Safe -> R.drawable.security_2_indicator
ChatRoom.SecurityLevel.Encrypted -> R.drawable.security_1_indicator
else -> R.drawable.security_alert_indicator
}
}
val securityContentDescription: Int by lazy {
when (device.securityLevel) {
ChatRoomSecurityLevel.Safe -> R.string.content_description_security_level_safe
ChatRoomSecurityLevel.Encrypted -> R.string.content_description_security_level_encrypted
ChatRoom.SecurityLevel.Safe -> R.string.content_description_security_level_safe
ChatRoom.SecurityLevel.Encrypted -> R.string.content_description_security_level_encrypted
else -> R.string.content_description_security_level_unsafe
}
}

View file

@ -23,7 +23,7 @@ import androidx.lifecycle.MutableLiveData
import org.linphone.LinphoneApplication.Companion.coreContext
import org.linphone.R
import org.linphone.contact.GenericContactData
import org.linphone.core.ChatRoomSecurityLevel
import org.linphone.core.ChatRoom
import org.linphone.core.Participant
import org.linphone.utils.LinphoneUtils
@ -32,16 +32,16 @@ class DevicesListGroupData(private val participant: Participant) : GenericContac
) {
val securityLevelIcon: Int by lazy {
when (participant.securityLevel) {
ChatRoomSecurityLevel.Safe -> R.drawable.security_2_indicator
ChatRoomSecurityLevel.Encrypted -> R.drawable.security_1_indicator
ChatRoom.SecurityLevel.Safe -> R.drawable.security_2_indicator
ChatRoom.SecurityLevel.Encrypted -> R.drawable.security_1_indicator
else -> R.drawable.security_alert_indicator
}
}
val securityLevelContentDescription: Int by lazy {
when (participant.securityLevel) {
ChatRoomSecurityLevel.Safe -> R.string.content_description_security_level_safe
ChatRoomSecurityLevel.Encrypted -> R.string.content_description_security_level_encrypted
ChatRoom.SecurityLevel.Safe -> R.string.content_description_security_level_safe
ChatRoom.SecurityLevel.Encrypted -> R.string.content_description_security_level_encrypted
else -> R.string.content_description_security_level_unsafe
}
}

View file

@ -23,7 +23,7 @@ import androidx.lifecycle.MutableLiveData
import org.linphone.R
import org.linphone.activities.main.chat.GroupChatRoomMember
import org.linphone.contact.GenericContactData
import org.linphone.core.ChatRoomSecurityLevel
import org.linphone.core.ChatRoom
import org.linphone.utils.LinphoneUtils
class GroupInfoParticipantData(val participant: GroupChatRoomMember) : GenericContactData(
@ -40,16 +40,16 @@ class GroupInfoParticipantData(val participant: GroupChatRoomMember) : GenericCo
val securityLevelIcon: Int by lazy {
when (participant.securityLevel) {
ChatRoomSecurityLevel.Safe -> R.drawable.security_2_indicator
ChatRoomSecurityLevel.Encrypted -> R.drawable.security_1_indicator
ChatRoom.SecurityLevel.Safe -> R.drawable.security_2_indicator
ChatRoom.SecurityLevel.Encrypted -> R.drawable.security_1_indicator
else -> R.drawable.security_alert_indicator
}
}
val securityLevelContentDescription: Int by lazy {
when (participant.securityLevel) {
ChatRoomSecurityLevel.Safe -> R.string.content_description_security_level_safe
ChatRoomSecurityLevel.Encrypted -> R.string.content_description_security_level_encrypted
ChatRoom.SecurityLevel.Safe -> R.string.content_description_security_level_safe
ChatRoom.SecurityLevel.Encrypted -> R.string.content_description_security_level_encrypted
else -> R.string.content_description_security_level_unsafe
}
}

View file

@ -1058,7 +1058,7 @@ class DetailChatRoomFragment : MasterFragment<ChatRoomDetailFragmentBinding, Cha
}
if (viewModel.ephemeralChatRoom) {
if (chatRoom.currentParams.ephemeralMode == ChatRoomEphemeralMode.AdminManaged) {
if (chatRoom.currentParams.ephemeralMode == ChatRoom.EphemeralMode.AdminManaged) {
if (chatRoom.me?.isAdmin == false) {
Log.w(
"[Chat Room] Hiding ephemeral menu as mode is admin managed and we aren't admin"

View file

@ -38,7 +38,6 @@ import org.linphone.activities.navigateToChatRoom
import org.linphone.activities.navigateToChatRoomCreation
import org.linphone.core.Address
import org.linphone.core.ChatRoom
import org.linphone.core.ChatRoomCapabilities
import org.linphone.databinding.ChatRoomGroupInfoFragmentBinding
import org.linphone.utils.AppUtils
import org.linphone.utils.DialogUtils
@ -68,7 +67,7 @@ class GroupInfoFragment : SecureFragment<ChatRoomGroupInfoFragmentBinding>() {
adapter = GroupInfoParticipantsAdapter(
viewLifecycleOwner,
chatRoom?.hasCapability(ChatRoomCapabilities.Encrypted.toInt()) ?: (viewModel.isEncrypted.value == true)
chatRoom?.hasCapability(ChatRoom.Capabilities.Encrypted.toInt()) ?: (viewModel.isEncrypted.value == true)
)
binding.participants.adapter = adapter

View file

@ -96,7 +96,7 @@ class ChatMessageSendingViewModel(private val chatRoom: ChatRoom) : ViewModel()
val voiceRecordPlayingPosition = MutableLiveData<Int>()
val imeFlags: Int = if (chatRoom.hasCapability(ChatRoomCapabilities.Encrypted.toInt())) {
val imeFlags: Int = if (chatRoom.hasCapability(ChatRoom.Capabilities.Encrypted.toInt())) {
// IME_FLAG_NO_PERSONALIZED_LEARNING is only available on Android 8 and newer
Compatibility.getImeFlagsForSecureChatRoom()
} else {
@ -157,7 +157,7 @@ class ChatMessageSendingViewModel(private val chatRoom: ChatRoom) : ViewModel()
}
if (this::recorder.isInitialized) {
if (recorder.state != RecorderState.Closed) {
if (recorder.state != Recorder.State.Closed) {
recorder.close()
}
}
@ -246,7 +246,7 @@ class ChatMessageSendingViewModel(private val chatRoom: ChatRoom) : ViewModel()
}
val message = createChatMessage()
val isBasicChatRoom: Boolean = chatRoom.hasCapability(ChatRoomCapabilities.Basic.toInt())
val isBasicChatRoom: Boolean = chatRoom.hasCapability(ChatRoom.Capabilities.Basic.toInt())
var voiceRecord = false
if (isPendingVoiceRecord.value == true && recorder.file != null) {
@ -366,14 +366,14 @@ class ChatMessageSendingViewModel(private val chatRoom: ChatRoom) : ViewModel()
}
when (recorder.state) {
RecorderState.Running -> Log.w("[Chat Message Sending] Recorder is already recording")
RecorderState.Paused -> {
Recorder.State.Running -> Log.w("[Chat Message Sending] Recorder is already recording")
Recorder.State.Paused -> {
Log.w("[Chat Message Sending] Recorder isn't closed, resuming recording")
recorder.start()
}
RecorderState.Closed -> {
Recorder.State.Closed -> {
val extension = when (recorder.params.fileFormat) {
RecorderFileFormat.Mkv -> "mkv"
Recorder.FileFormat.Mkv -> "mkv"
else -> "wav"
}
val tempFileName = "voice-recording-${System.currentTimeMillis()}.$extension"
@ -415,7 +415,7 @@ class ChatMessageSendingViewModel(private val chatRoom: ChatRoom) : ViewModel()
}
fun cancelVoiceRecording() {
if (recorder.state != RecorderState.Closed) {
if (recorder.state != Recorder.State.Closed) {
Log.i("[Chat Message Sending] Closing voice recorder")
recorder.close()
@ -442,7 +442,7 @@ class ChatMessageSendingViewModel(private val chatRoom: ChatRoom) : ViewModel()
}
private fun stopVoiceRecorder() {
if (recorder.state == RecorderState.Running) {
if (recorder.state == Recorder.State.Running) {
Log.i("[Chat Message Sending] Pausing / closing voice recorder")
recorder.pause()
recorder.close()
@ -516,9 +516,9 @@ class ChatMessageSendingViewModel(private val chatRoom: ChatRoom) : ViewModel()
Log.i("[Chat Message Sending] Creating recorder for voice message")
val recorderParams = coreContext.core.createRecorderParams()
if (corePreferences.voiceMessagesFormatMkv) {
recorderParams.fileFormat = RecorderFileFormat.Mkv
recorderParams.fileFormat = Recorder.FileFormat.Mkv
} else {
recorderParams.fileFormat = RecorderFileFormat.Wav
recorderParams.fileFormat = Recorder.FileFormat.Wav
}
val recordingAudioDevice = AudioRouteUtils.getAudioRecordingDeviceForVoiceMessage()
@ -580,7 +580,7 @@ class ChatMessageSendingViewModel(private val chatRoom: ChatRoom) : ViewModel()
private fun updateChatRoomReadOnlyState() {
isReadOnly.value = chatRoom.isReadOnly || (
chatRoom.hasCapability(
ChatRoomCapabilities.Conference.toInt()
ChatRoom.Capabilities.Conference.toInt()
) && chatRoom.participants.isEmpty()
)
}

View file

@ -95,13 +95,13 @@ class ChatMessagesListViewModel(private val chatRoom: ChatRoom) : ViewModel() {
}
override fun onConferenceJoined(chatRoom: ChatRoom, eventLog: EventLog) {
if (!chatRoom.hasCapability(ChatRoomCapabilities.OneToOne.toInt())) {
if (!chatRoom.hasCapability(ChatRoom.Capabilities.OneToOne.toInt())) {
addEvent(eventLog)
}
}
override fun onConferenceLeft(chatRoom: ChatRoom, eventLog: EventLog) {
if (!chatRoom.hasCapability(ChatRoomCapabilities.OneToOne.toInt())) {
if (!chatRoom.hasCapability(ChatRoom.Capabilities.OneToOne.toInt())) {
addEvent(eventLog)
}
}

View file

@ -94,15 +94,15 @@ class ChatRoomCreationViewModel : ContactsSelectionViewModel() {
val encrypted = secureChatMandatory || isEncrypted.value == true
val params: ChatRoomParams = coreContext.core.createDefaultChatRoomParams()
params.backend = ChatRoomBackend.Basic
params.backend = ChatRoom.Backend.Basic
params.isGroupEnabled = false
if (encrypted) {
params.isEncryptionEnabled = true
params.backend = ChatRoomBackend.FlexisipChat
params.backend = ChatRoom.Backend.FlexisipChat
params.ephemeralMode = if (corePreferences.useEphemeralPerDeviceMode) {
ChatRoomEphemeralMode.DeviceManaged
ChatRoom.EphemeralMode.DeviceManaged
} else {
ChatRoomEphemeralMode.AdminManaged
ChatRoom.EphemeralMode.AdminManaged
}
params.ephemeralLifetime = 0 // Make sure ephemeral is disabled by default
Log.i(

View file

@ -49,7 +49,7 @@ class ChatRoomViewModelFactory(private val chatRoom: ChatRoom) :
class ChatRoomViewModel(val chatRoom: ChatRoom) : ViewModel(), ContactDataInterface {
override val contact: MutableLiveData<Friend> = MutableLiveData<Friend>()
override val displayName: MutableLiveData<String> = MutableLiveData<String>()
override val securityLevel: MutableLiveData<ChatRoomSecurityLevel> = MutableLiveData<ChatRoomSecurityLevel>()
override val securityLevel: MutableLiveData<ChatRoom.SecurityLevel> = MutableLiveData<ChatRoom.SecurityLevel>()
override val showGroupChatAvatar: Boolean
get() = conferenceChatRoom && !oneToOneChatRoom
override val presenceStatus: MutableLiveData<ConsolidatedPresence> = MutableLiveData<ConsolidatedPresence>()
@ -74,23 +74,23 @@ class ChatRoomViewModel(val chatRoom: ChatRoom) : ViewModel(), ContactDataInterf
val ephemeralEnabled = MutableLiveData<Boolean>()
val basicChatRoom: Boolean by lazy {
chatRoom.hasCapability(ChatRoomCapabilities.Basic.toInt())
chatRoom.hasCapability(ChatRoom.Capabilities.Basic.toInt())
}
val oneToOneChatRoom: Boolean by lazy {
chatRoom.hasCapability(ChatRoomCapabilities.OneToOne.toInt())
chatRoom.hasCapability(ChatRoom.Capabilities.OneToOne.toInt())
}
private val conferenceChatRoom: Boolean by lazy {
chatRoom.hasCapability(ChatRoomCapabilities.Conference.toInt())
chatRoom.hasCapability(ChatRoom.Capabilities.Conference.toInt())
}
val encryptedChatRoom: Boolean by lazy {
chatRoom.hasCapability(ChatRoomCapabilities.Encrypted.toInt())
chatRoom.hasCapability(ChatRoom.Capabilities.Encrypted.toInt())
}
val ephemeralChatRoom: Boolean by lazy {
chatRoom.hasCapability(ChatRoomCapabilities.Ephemeral.toInt())
chatRoom.hasCapability(ChatRoom.Capabilities.Ephemeral.toInt())
}
val meAdmin: MutableLiveData<Boolean> by lazy {
@ -387,13 +387,13 @@ class ChatRoomViewModel(val chatRoom: ChatRoom) : ViewModel(), ContactDataInterf
securityLevel.value = level
securityLevelIcon.value = when (level) {
ChatRoomSecurityLevel.Safe -> R.drawable.security_2_indicator
ChatRoomSecurityLevel.Encrypted -> R.drawable.security_1_indicator
ChatRoom.SecurityLevel.Safe -> R.drawable.security_2_indicator
ChatRoom.SecurityLevel.Encrypted -> R.drawable.security_1_indicator
else -> R.drawable.security_alert_indicator
}
securityLevelContentDescription.value = when (level) {
ChatRoomSecurityLevel.Safe -> R.string.content_description_security_level_safe
ChatRoomSecurityLevel.Encrypted -> R.string.content_description_security_level_encrypted
ChatRoom.SecurityLevel.Safe -> R.string.content_description_security_level_safe
ChatRoom.SecurityLevel.Encrypted -> R.string.content_description_security_level_encrypted
else -> R.string.content_description_security_level_unsafe
}
}

View file

@ -100,7 +100,7 @@ class GroupInfoViewModel(val chatRoom: ChatRoom?) : MessageNotifierViewModel() {
isMeAdmin.value = chatRoom == null || (chatRoom.me?.isAdmin == true && !chatRoom.isReadOnly)
canLeaveGroup.value = chatRoom != null && !chatRoom.isReadOnly
isEncrypted.value = corePreferences.forceEndToEndEncryptedChat || chatRoom?.hasCapability(
ChatRoomCapabilities.Encrypted.toInt()
ChatRoom.Capabilities.Encrypted.toInt()
) == true
if (chatRoom != null) updateParticipants()
@ -123,9 +123,9 @@ class GroupInfoViewModel(val chatRoom: ChatRoom?) : MessageNotifierViewModel() {
params.isGroupEnabled = true
if (params.isEncryptionEnabled) {
params.ephemeralMode = if (corePreferences.useEphemeralPerDeviceMode) {
ChatRoomEphemeralMode.DeviceManaged
ChatRoom.EphemeralMode.DeviceManaged
} else {
ChatRoomEphemeralMode.AdminManaged
ChatRoom.EphemeralMode.AdminManaged
}
}
params.ephemeralLifetime = 0 // Make sure ephemeral is disabled by default

View file

@ -337,7 +337,7 @@ class ConferenceWaitingRoomViewModel : MessageNotifierViewModel() {
fun setMosaicLayout() {
Log.i("[Conference Waiting Room] Set default layout to Mosaic")
callParams.conferenceVideoLayout = ConferenceLayout.Grid
callParams.conferenceVideoLayout = Conference.Layout.Grid
callParams.isVideoEnabled = isVideoAvailableInCore()
updateLayout()
@ -350,7 +350,7 @@ class ConferenceWaitingRoomViewModel : MessageNotifierViewModel() {
fun setActiveSpeakerLayout() {
Log.i("[Conference Waiting Room] Set default layout to ActiveSpeaker")
callParams.conferenceVideoLayout = ConferenceLayout.ActiveSpeaker
callParams.conferenceVideoLayout = Conference.Layout.ActiveSpeaker
callParams.isVideoEnabled = isVideoAvailableInCore()
updateLayout()
@ -437,7 +437,7 @@ class ConferenceWaitingRoomViewModel : MessageNotifierViewModel() {
selectedLayout.value = ConferenceDisplayMode.AUDIO_ONLY
} else {
selectedLayout.value = when (callParams.conferenceVideoLayout) {
ConferenceLayout.Grid -> ConferenceDisplayMode.GRID
Conference.Layout.Grid -> ConferenceDisplayMode.GRID
else -> ConferenceDisplayMode.ACTIVE_SPEAKER
}
}

View file

@ -31,7 +31,7 @@ import org.linphone.LinphoneApplication.Companion.coreContext
import org.linphone.LinphoneApplication.Companion.corePreferences
import org.linphone.R
import org.linphone.contact.*
import org.linphone.core.ChatRoomSecurityLevel
import org.linphone.core.ChatRoom.SecurityLevel
import org.linphone.core.ConsolidatedPresence
import org.linphone.core.Friend
import org.linphone.core.tools.Log
@ -42,7 +42,7 @@ import org.linphone.utils.PermissionHelper
class ContactEditorData(val friend: Friend?) : ContactDataInterface {
override val contact: MutableLiveData<Friend> = MutableLiveData<Friend>()
override val displayName: MutableLiveData<String> = MutableLiveData<String>()
override val securityLevel: MutableLiveData<ChatRoomSecurityLevel> = MutableLiveData<ChatRoomSecurityLevel>()
override val securityLevel: MutableLiveData<SecurityLevel> = MutableLiveData<SecurityLevel>()
override val presenceStatus: MutableLiveData<ConsolidatedPresence> = MutableLiveData<ConsolidatedPresence>()
override val coroutineScope: CoroutineScope = coreContext.coroutineScope

View file

@ -53,7 +53,7 @@ class ContactViewModelFactory(private val friend: Friend) :
class ContactViewModel(friend: Friend, async: Boolean = false) : MessageNotifierViewModel(), ContactDataInterface {
override val contact: MutableLiveData<Friend> = MutableLiveData<Friend>()
override val displayName: MutableLiveData<String> = MutableLiveData<String>()
override val securityLevel: MutableLiveData<ChatRoomSecurityLevel> = MutableLiveData<ChatRoomSecurityLevel>()
override val securityLevel: MutableLiveData<ChatRoom.SecurityLevel> = MutableLiveData<ChatRoom.SecurityLevel>()
override val presenceStatus: MutableLiveData<ConsolidatedPresence> = MutableLiveData<ConsolidatedPresence>()
override val coroutineScope: CoroutineScope = viewModelScope
@ -218,7 +218,7 @@ class ContactViewModel(friend: Friend, async: Boolean = false) : MessageNotifier
val hasLimeCapability = corePreferences.allowEndToEndEncryptedChatWithoutPresence || (
friend.getPresenceModelForUriOrTel(
value
)?.hasCapability(FriendCapability.LimeX3Dh) ?: false
)?.hasCapability(Friend.Capability.LimeX3Dh) ?: false
)
val secureChatAllowed = LinphoneUtils.isEndToEndEncryptedChatAvailable() && !isMe && hasLimeCapability
val displayValue = if (coreContext.core.defaultAccount?.params?.domain == address.domain) (address.username ?: value) else value
@ -249,7 +249,7 @@ class ContactViewModel(friend: Friend, async: Boolean = false) : MessageNotifier
val hasLimeCapability = corePreferences.allowEndToEndEncryptedChatWithoutPresence || (
friend.getPresenceModelForUriOrTel(
number
)?.hasCapability(FriendCapability.LimeX3Dh) ?: false
)?.hasCapability(Friend.Capability.LimeX3Dh) ?: false
)
val secureChatAllowed = LinphoneUtils.isEndToEndEncryptedChatAvailable() && !isMe && hasLimeCapability
val label = PhoneNumberUtils.vcardParamStringToAddressBookLabel(

View file

@ -119,8 +119,8 @@ class ContactsListViewModel : ViewModel() {
previousFilter = filterValue
val domain = if (sipContactsSelected.value == true) coreContext.core.defaultAccount?.params?.domain ?: "" else ""
val filter = MagicSearchSource.Friends.toInt() or MagicSearchSource.LdapServers.toInt()
val aggregation = MagicSearchAggregation.Friend
val filter = MagicSearch.Source.Friends.toInt() or MagicSearch.Source.LdapServers.toInt()
val aggregation = MagicSearch.Aggregation.Friend
searchResultsPending = true
fastFetchJob?.cancel()
Log.i(

View file

@ -110,7 +110,7 @@ class CallLogViewModel(val callLog: CallLog, private val isRelated: Boolean = fa
corePreferences.allowEndToEndEncryptedChatWithoutPresence || (
contact.value?.getPresenceModelForUriOrTel(
peerSipUri
)?.hasCapability(FriendCapability.LimeX3Dh) ?: false
)?.hasCapability(Friend.Capability.LimeX3Dh) ?: false
)
)

View file

@ -22,12 +22,12 @@ package org.linphone.activities.main.settings.viewmodels
import androidx.lifecycle.MutableLiveData
import org.linphone.R
import org.linphone.activities.main.settings.SettingListenerStub
import org.linphone.core.ConferenceLayout
import org.linphone.core.Conference.Layout
class ConferencesSettingsViewModel : GenericSettingsViewModel() {
val layoutListener = object : SettingListenerStub() {
override fun onListValueChanged(position: Int) {
core.defaultConferenceLayout = ConferenceLayout.fromInt(layoutValues[position])
core.defaultConferenceLayout = Layout.fromInt(layoutValues[position])
layoutIndex.value = position
}
}
@ -43,10 +43,10 @@ class ConferencesSettingsViewModel : GenericSettingsViewModel() {
val labels = arrayListOf<String>()
labels.add(prefs.getString(R.string.conference_display_mode_active_speaker))
layoutValues.add(ConferenceLayout.ActiveSpeaker.toInt())
layoutValues.add(Layout.ActiveSpeaker.toInt())
labels.add(prefs.getString(R.string.conference_display_mode_mosaic))
layoutValues.add(ConferenceLayout.Grid.toInt())
layoutValues.add(Layout.Grid.toInt())
layoutLabels.value = labels
layoutIndex.value = layoutValues.indexOf(core.defaultConferenceLayout.toInt())

View file

@ -27,9 +27,6 @@ import org.linphone.LinphoneApplication.Companion.coreContext
import org.linphone.R
import org.linphone.activities.main.settings.SettingListenerStub
import org.linphone.core.Ldap
import org.linphone.core.LdapAuthMethod
import org.linphone.core.LdapCertVerificationMode
import org.linphone.core.LdapDebugLevel
import org.linphone.core.tools.Log
import org.linphone.utils.Event
@ -102,7 +99,7 @@ class LdapSettingsViewModel(private val ldap: Ldap, val index: String) : Generic
val ldapAuthMethodListener = object : SettingListenerStub() {
override fun onListValueChanged(position: Int) {
val params = ldap.params.clone()
params.authMethod = LdapAuthMethod.fromInt(ldapAuthMethodValues[position])
params.authMethod = Ldap.AuthMethod.fromInt(ldapAuthMethodValues[position])
ldap.params = params
ldapAuthMethodIndex.value = position
}
@ -123,7 +120,7 @@ class LdapSettingsViewModel(private val ldap: Ldap, val index: String) : Generic
val ldapCertCheckListener = object : SettingListenerStub() {
override fun onListValueChanged(position: Int) {
val params = ldap.params.clone()
params.serverCertificatesVerificationMode = LdapCertVerificationMode.fromInt(
params.serverCertificatesVerificationMode = Ldap.CertVerificationMode.fromInt(
ldapCertCheckValues[position]
)
ldap.params = params
@ -238,7 +235,7 @@ class LdapSettingsViewModel(private val ldap: Ldap, val index: String) : Generic
val ldapDebugListener = object : SettingListenerStub() {
override fun onBoolValueChanged(newValue: Boolean) {
val params = ldap.params.clone()
params.debugLevel = if (newValue) LdapDebugLevel.Verbose else LdapDebugLevel.Off
params.debugLevel = if (newValue) Ldap.DebugLevel.Verbose else Ldap.DebugLevel.Off
ldap.params = params
}
}
@ -261,7 +258,7 @@ class LdapSettingsViewModel(private val ldap: Ldap, val index: String) : Generic
ldapNameAttribute.value = params.nameAttribute
ldapSipAttribute.value = params.sipAttribute
ldapSipDomain.value = params.sipDomain
ldapDebug.value = params.debugLevel == LdapDebugLevel.Verbose
ldapDebug.value = params.debugLevel == Ldap.DebugLevel.Verbose
initAuthMethodList()
initTlsCertCheckList()
@ -271,10 +268,10 @@ class LdapSettingsViewModel(private val ldap: Ldap, val index: String) : Generic
val labels = arrayListOf<String>()
labels.add(prefs.getString(R.string.contacts_settings_ldap_auth_method_anonymous))
ldapAuthMethodValues.add(LdapAuthMethod.Anonymous.toInt())
ldapAuthMethodValues.add(Ldap.AuthMethod.Anonymous.toInt())
labels.add(prefs.getString(R.string.contacts_settings_ldap_auth_method_simple))
ldapAuthMethodValues.add(LdapAuthMethod.Simple.toInt())
ldapAuthMethodValues.add(Ldap.AuthMethod.Simple.toInt())
ldapAuthMethodLabels.value = labels
ldapAuthMethodIndex.value = ldapAuthMethodValues.indexOf(ldap.params.authMethod.toInt())
@ -284,13 +281,13 @@ class LdapSettingsViewModel(private val ldap: Ldap, val index: String) : Generic
val labels = arrayListOf<String>()
labels.add(prefs.getString(R.string.contacts_settings_ldap_cert_check_auto))
ldapCertCheckValues.add(LdapCertVerificationMode.Default.toInt())
ldapCertCheckValues.add(Ldap.CertVerificationMode.Default.toInt())
labels.add(prefs.getString(R.string.contacts_settings_ldap_cert_check_disabled))
ldapCertCheckValues.add(LdapCertVerificationMode.Disabled.toInt())
ldapCertCheckValues.add(Ldap.CertVerificationMode.Disabled.toInt())
labels.add(prefs.getString(R.string.contacts_settings_ldap_cert_check_enabled))
ldapCertCheckValues.add(LdapCertVerificationMode.Enabled.toInt())
ldapCertCheckValues.add(Ldap.CertVerificationMode.Enabled.toInt())
ldapCertCheckLabels.value = labels
ldapCertCheckIndex.value = ldapCertCheckValues.indexOf(

View file

@ -70,17 +70,17 @@ class ConferenceParticipantDeviceData(
override fun onStateChanged(
participantDevice: ParticipantDevice,
state: ParticipantDeviceState
state: ParticipantDevice.State
) {
Log.i(
"[Conference Participant Device] Participant [${participantDevice.address.asStringUriOnly()}] state has changed: $state"
)
when (state) {
ParticipantDeviceState.Joining, ParticipantDeviceState.Alerting -> isJoining.value = true
ParticipantDeviceState.OnHold -> {
ParticipantDevice.State.Joining, ParticipantDevice.State.Alerting -> isJoining.value = true
ParticipantDevice.State.OnHold -> {
isInConference.value = false
}
ParticipantDeviceState.Present -> {
ParticipantDevice.State.Present -> {
isJoining.value = false
isInConference.value = true
updateWindowId(textureView)
@ -135,7 +135,7 @@ class ConferenceParticipantDeviceData(
isInConference.value = participantDevice.isInConference
val state = participantDevice.state
isJoining.value = state == ParticipantDeviceState.Joining || state == ParticipantDeviceState.Alerting
isJoining.value = state == ParticipantDevice.State.Joining || state == ParticipantDevice.State.Alerting
Log.i(
"[Conference Participant Device] State for participant [${participantDevice.address.asStringUriOnly()}] is $state"
)

View file

@ -85,7 +85,7 @@ class StatItemData(val type: StatType) {
StatType.DOWNLOAD_BW -> "${stats.downloadBandwidth} kbits/s"
StatType.UPLOAD_BW -> "${stats.uploadBandwidth} kbits/s"
StatType.ICE -> stats.iceState.toString()
StatType.IP_FAM -> if (stats.ipFamilyOfRemote == AddressFamily.Inet6) "IPv6" else "IPv4"
StatType.IP_FAM -> if (stats.ipFamilyOfRemote == Address.Family.Inet6) "IPv6" else "IPv4"
StatType.SENDER_LOSS -> DecimalFormat("##.##%").format(stats.senderLossRate)
StatType.RECEIVER_LOSS -> DecimalFormat("##.##%").format(stats.receiverLossRate)
StatType.JITTER -> DecimalFormat("##.## ms").format(stats.jitterBufferSizeMs)

View file

@ -174,15 +174,15 @@ class ConferenceViewModel : ViewModel() {
override fun onParticipantDeviceStateChanged(
conference: Conference,
device: ParticipantDevice,
state: ParticipantDeviceState
state: ParticipantDevice.State
) {
if (conference.isMe(device.address)) {
when (state) {
ParticipantDeviceState.Present -> {
ParticipantDevice.State.Present -> {
Log.i("[Conference] Entered conference")
isConferenceLocallyPaused.value = false
}
ParticipantDeviceState.OnHold -> {
ParticipantDevice.State.OnHold -> {
Log.i("[Conference] Left conference")
isConferenceLocallyPaused.value = true
}
@ -436,8 +436,8 @@ class ConferenceViewModel : ViewModel() {
}
params.conferenceVideoLayout = when (layout) {
ConferenceDisplayMode.GRID -> ConferenceLayout.Grid
else -> ConferenceLayout.ActiveSpeaker
ConferenceDisplayMode.GRID -> Conference.Layout.Grid
else -> Conference.Layout.ActiveSpeaker
}
call.update(params)
@ -464,7 +464,7 @@ class ConferenceViewModel : ViewModel() {
ConferenceDisplayMode.AUDIO_ONLY
} else {
when (params.conferenceVideoLayout) {
ConferenceLayout.Grid -> ConferenceDisplayMode.GRID
Conference.Layout.Grid -> ConferenceDisplayMode.GRID
else -> ConferenceDisplayMode.ACTIVE_SPEAKER
}
}

View file

@ -25,7 +25,7 @@ import kotlinx.coroutines.CoroutineScope
import org.linphone.LinphoneApplication.Companion.coreContext
import org.linphone.activities.main.viewmodels.MessageNotifierViewModel
import org.linphone.core.Address
import org.linphone.core.ChatRoomSecurityLevel
import org.linphone.core.ChatRoom.SecurityLevel
import org.linphone.core.ConsolidatedPresence
import org.linphone.core.Friend
import org.linphone.utils.LinphoneUtils
@ -35,7 +35,7 @@ interface ContactDataInterface {
val displayName: MutableLiveData<String>
val securityLevel: MutableLiveData<ChatRoomSecurityLevel>
val securityLevel: MutableLiveData<SecurityLevel>
val showGroupChatAvatar: Boolean
get() = false
@ -48,12 +48,12 @@ interface ContactDataInterface {
open class GenericContactData(private val sipAddress: Address) : ContactDataInterface {
final override val contact: MutableLiveData<Friend> = MutableLiveData<Friend>()
final override val displayName: MutableLiveData<String> = MutableLiveData<String>()
final override val securityLevel: MutableLiveData<ChatRoomSecurityLevel> = MutableLiveData<ChatRoomSecurityLevel>()
final override val securityLevel: MutableLiveData<SecurityLevel> = MutableLiveData<SecurityLevel>()
final override val presenceStatus: MutableLiveData<ConsolidatedPresence> = MutableLiveData<ConsolidatedPresence>()
final override val coroutineScope: CoroutineScope = coreContext.coroutineScope
init {
securityLevel.value = ChatRoomSecurityLevel.ClearText
securityLevel.value = SecurityLevel.ClearText
presenceStatus.value = ConsolidatedPresence.Offline
contactLookup()
}
@ -78,12 +78,12 @@ open class GenericContactData(private val sipAddress: Address) : ContactDataInte
abstract class GenericContactViewModel(private val sipAddress: Address) : MessageNotifierViewModel(), ContactDataInterface {
final override val contact: MutableLiveData<Friend> = MutableLiveData<Friend>()
final override val displayName: MutableLiveData<String> = MutableLiveData<String>()
final override val securityLevel: MutableLiveData<ChatRoomSecurityLevel> = MutableLiveData<ChatRoomSecurityLevel>()
final override val securityLevel: MutableLiveData<SecurityLevel> = MutableLiveData<SecurityLevel>()
final override val presenceStatus: MutableLiveData<ConsolidatedPresence> = MutableLiveData<ConsolidatedPresence>()
final override val coroutineScope: CoroutineScope = viewModelScope
init {
securityLevel.value = ChatRoomSecurityLevel.ClearText
securityLevel.value = SecurityLevel.ClearText
presenceStatus.value = ConsolidatedPresence.Offline
contactLookup()
}

View file

@ -28,7 +28,7 @@ import org.linphone.utils.LinphoneUtils
class ContactSelectionData(private val searchResult: SearchResult) : ContactDataInterface {
override val contact: MutableLiveData<Friend> = MutableLiveData<Friend>()
override val displayName: MutableLiveData<String> = MutableLiveData<String>()
override val securityLevel: MutableLiveData<ChatRoomSecurityLevel> = MutableLiveData<ChatRoomSecurityLevel>()
override val securityLevel: MutableLiveData<ChatRoom.SecurityLevel> = MutableLiveData<ChatRoom.SecurityLevel>()
override val presenceStatus: MutableLiveData<ConsolidatedPresence> = MutableLiveData<ConsolidatedPresence>()
override val coroutineScope: CoroutineScope = coreContext.coroutineScope
@ -56,7 +56,7 @@ class ContactSelectionData(private val searchResult: SearchResult) : ContactData
val hasLimeX3DHCapability: Boolean
get() = LinphoneUtils.isEndToEndEncryptedChatAvailable() && searchResult.hasCapability(
FriendCapability.LimeX3Dh
Friend.Capability.LimeX3Dh
)
init {

View file

@ -30,7 +30,7 @@ import androidx.recyclerview.widget.RecyclerView
import org.linphone.LinphoneApplication.Companion.coreContext
import org.linphone.R
import org.linphone.core.Address
import org.linphone.core.FriendCapability
import org.linphone.core.Friend.Capability
import org.linphone.core.SearchResult
import org.linphone.databinding.ContactSelectionCellBinding
import org.linphone.utils.Event
@ -121,12 +121,12 @@ class ContactsSelectionAdapter(
) ?: false
val limeCheck = !securityEnabled || (
securityEnabled && searchResult.hasCapability(
FriendCapability.LimeX3Dh
Capability.LimeX3Dh
)
)
val groupCheck = !groupCapabilityRequired || (
groupCapabilityRequired && searchResult.hasCapability(
FriendCapability.GroupChat
Capability.GroupChat
)
)
val disabled = if (searchResult.friend != null) !limeCheck || !groupCheck || isMyself else false // Generated entry from search filter

View file

@ -100,8 +100,8 @@ open class ContactsSelectionViewModel : MessageNotifierViewModel() {
coreContext.contactsManager.magicSearch.getContactsListAsync(
filterValue,
domain,
MagicSearchSource.All.toInt(),
MagicSearchAggregation.None
MagicSearch.Source.All.toInt(),
MagicSearch.Aggregation.None
)
val spinnerDelay = corePreferences.delayBeforeShowingContactsSearchSpinner.toLong()

View file

@ -792,7 +792,7 @@ class NotificationsManager(private val context: Context) {
notifiable.messages.add(notifiableMessage)
}
if (room.hasCapability(ChatRoomCapabilities.OneToOne.toInt())) {
if (room.hasCapability(ChatRoom.Capabilities.OneToOne.toInt())) {
notifiable.isGroup = false
} else {
notifiable.isGroup = true

View file

@ -133,11 +133,11 @@ class LinphoneUtils {
val params = core.createDefaultChatRoomParams()
params.isGroupEnabled = false
params.backend = ChatRoomBackend.Basic
params.backend = ChatRoom.Backend.Basic
if (isSecured) {
params.subject = AppUtils.getString(R.string.chat_room_dummy_subject)
params.isEncryptionEnabled = true
params.backend = ChatRoomBackend.FlexisipChat
params.backend = ChatRoom.Backend.FlexisipChat
}
val participants = arrayOf(participant)
@ -159,10 +159,10 @@ class LinphoneUtils {
val chatRoomParams = coreContext.core.createDefaultChatRoomParams()
chatRoomParams.isGroupEnabled = false
if (isEndToEndEncryptedChatAvailable()) {
chatRoomParams.backend = ChatRoomBackend.FlexisipChat
chatRoomParams.backend = ChatRoom.Backend.FlexisipChat
chatRoomParams.isEncryptionEnabled = true
} else {
chatRoomParams.backend = ChatRoomBackend.Basic
chatRoomParams.backend = ChatRoom.Backend.Basic
chatRoomParams.isEncryptionEnabled = false
}
chatRoomParams.subject = "Meeting invitation" // Won't be used

View file

@ -36,7 +36,7 @@ import org.linphone.activities.main.MainActivity
import org.linphone.contact.getPerson
import org.linphone.core.Address
import org.linphone.core.ChatRoom
import org.linphone.core.ChatRoomCapabilities
import org.linphone.core.ChatRoom.Capabilities
import org.linphone.core.Friend
import org.linphone.core.tools.Log
import org.linphone.mediastream.Version
@ -62,7 +62,7 @@ class ShortcutsHelper(val context: Context) {
}
val addresses: ArrayList<Address> = arrayListOf(room.peerAddress)
if (!room.hasCapability(ChatRoomCapabilities.Basic.toInt())) {
if (!room.hasCapability(Capabilities.Basic.toInt())) {
addresses.clear()
for (participant in room.participants) {
addresses.add(participant.address)
@ -169,7 +169,7 @@ class ShortcutsHelper(val context: Context) {
val personsList = arrayListOf<Person>()
val subject: String
val icon: IconCompat
if (chatRoom.hasCapability(ChatRoomCapabilities.Basic.toInt())) {
if (chatRoom.hasCapability(Capabilities.Basic.toInt())) {
val contact =
coreContext.contactsManager.findContactByAddress(chatRoom.peerAddress)
val person = contact?.getPerson()
@ -179,7 +179,7 @@ class ShortcutsHelper(val context: Context) {
icon = person?.icon ?: coreContext.contactsManager.contactAvatar
subject = contact?.name ?: LinphoneUtils.getDisplayName(chatRoom.peerAddress)
} else if (chatRoom.hasCapability(ChatRoomCapabilities.OneToOne.toInt()) && chatRoom.participants.isNotEmpty()) {
} else if (chatRoom.hasCapability(Capabilities.OneToOne.toInt()) && chatRoom.participants.isNotEmpty()) {
val address = chatRoom.participants.first().address
val contact =
coreContext.contactsManager.findContactByAddress(address)

View file

@ -4,7 +4,7 @@
<data>
<import type="android.view.View"/>
<import type="org.linphone.core.ChatRoomSecurityLevel"/>
<import type="org.linphone.core.ChatRoom.SecurityLevel"/>
<import type="org.linphone.core.ConsolidatedPresence"/>
<variable
name="removeClickListener"
@ -59,7 +59,7 @@
android:layout_alignParentEnd="true"
android:contentDescription="@string/content_description_contact_can_do_encryption"
android:src="@drawable/security_toggle_icon_green"
android:visibility="@{isEncrypted &amp;&amp; data.securityLevel == ChatRoomSecurityLevel.ClearText ? View.VISIBLE : View.GONE, default=gone}" />
android:visibility="@{isEncrypted &amp;&amp; data.securityLevel == SecurityLevel.ClearText ? View.VISIBLE : View.GONE, default=gone}" />
<ImageView
android:layout_width="20dp"
@ -68,7 +68,7 @@
android:layout_alignParentEnd="true"
android:contentDescription="@{data.securityLevelContentDescription}"
android:src="@{data.securityLevelIcon, default=@drawable/security_alert_indicator}"
android:visibility="@{isEncrypted &amp;&amp; data.securityLevel != ChatRoomSecurityLevel.ClearText ? View.VISIBLE : View.GONE, default=gone}" />
android:visibility="@{isEncrypted &amp;&amp; data.securityLevel != SecurityLevel.ClearText ? View.VISIBLE : View.GONE, default=gone}" />
</RelativeLayout>