Fixed kotlin boolean properties changes in Java wrapper + allow CPIM messages in basic chat rooms for sip.linphone.org accounts

This commit is contained in:
Sylvain Berfini 2022-01-06 17:29:07 +01:00
parent 2729916ce4
commit 5605e37121
32 changed files with 82 additions and 75 deletions

View file

@ -16,6 +16,7 @@
<entry name="realm" overwrite="true">sip.linphone.org</entry> <entry name="realm" overwrite="true">sip.linphone.org</entry>
<entry name="conference_factory_uri" overwrite="true">sip:conference-factory@sip.linphone.org</entry> <entry name="conference_factory_uri" overwrite="true">sip:conference-factory@sip.linphone.org</entry>
<entry name="push_notification_allowed" overwrite="true">1</entry> <entry name="push_notification_allowed" overwrite="true">1</entry>
<entry name="cpim_in_basic_chat_rooms_enabled" overwrite="true">1</entry>
</section> </section>
<section name="nat_policy_default_values"> <section name="nat_policy_default_values">
<entry name="stun_server" overwrite="true">stun.linphone.org</entry> <entry name="stun_server" overwrite="true">stun.linphone.org</entry>

View file

@ -76,14 +76,14 @@ class QrCodeFragment : GenericFragment<AssistantQrCodeFragmentBinding>() {
super.onResume() super.onResume()
coreContext.core.nativePreviewWindowId = binding.qrCodeCaptureTexture coreContext.core.nativePreviewWindowId = binding.qrCodeCaptureTexture
coreContext.core.enableQrcodeVideoPreview(true) coreContext.core.isQrcodeVideoPreviewEnabled = true
coreContext.core.enableVideoPreview(true) coreContext.core.isVideoPreviewEnabled = true
} }
override fun onPause() { override fun onPause() {
coreContext.core.nativePreviewWindowId = null coreContext.core.nativePreviewWindowId = null
coreContext.core.enableQrcodeVideoPreview(false) coreContext.core.isQrcodeVideoPreviewEnabled = false
coreContext.core.enableVideoPreview(false) coreContext.core.isVideoPreviewEnabled = false
super.onPause() super.onPause()
} }

View file

@ -139,7 +139,7 @@ class IncomingCallActivity : GenericActivity() {
permissionsRequiredList.add(Manifest.permission.RECORD_AUDIO) permissionsRequiredList.add(Manifest.permission.RECORD_AUDIO)
} }
if (viewModel.call.currentParams.videoEnabled() && !PermissionHelper.get().hasCameraPermission()) { if (viewModel.call.currentParams.isVideoEnabled && !PermissionHelper.get().hasCameraPermission()) {
Log.i("[Incoming Call Activity] Asking for CAMERA permission") Log.i("[Incoming Call Activity] Asking for CAMERA permission")
permissionsRequiredList.add(Manifest.permission.CAMERA) permissionsRequiredList.add(Manifest.permission.CAMERA)
} }

View file

@ -179,7 +179,7 @@ class OutgoingCallActivity : ProximitySensorActivity() {
Log.i("[Outgoing Call Activity] Asking for RECORD_AUDIO permission") Log.i("[Outgoing Call Activity] Asking for RECORD_AUDIO permission")
permissionsRequiredList.add(Manifest.permission.RECORD_AUDIO) permissionsRequiredList.add(Manifest.permission.RECORD_AUDIO)
} }
if (viewModel.call.currentParams.videoEnabled() && !PermissionHelper.get().hasCameraPermission()) { if (viewModel.call.currentParams.isVideoEnabled && !PermissionHelper.get().hasCameraPermission()) {
Log.i("[Outgoing Call Activity] Asking for CAMERA permission") Log.i("[Outgoing Call Activity] Asking for CAMERA permission")
permissionsRequiredList.add(Manifest.permission.CAMERA) permissionsRequiredList.add(Manifest.permission.CAMERA)
} }

View file

@ -36,7 +36,7 @@ class CallStatisticsData(val call: Call) : GenericContactData(call.remoteAddress
private val listener = object : CoreListenerStub() { private val listener = object : CoreListenerStub() {
override fun onCallStatsUpdated(core: Core, call: Call, stats: CallStats) { override fun onCallStatsUpdated(core: Core, call: Call, stats: CallStats) {
if (call == this@CallStatisticsData.call) { if (call == this@CallStatisticsData.call) {
isVideoEnabled.value = call.currentParams.videoEnabled() isVideoEnabled.value = call.currentParams.isVideoEnabled
updateCallStats(stats) updateCallStats(stats)
} }
} }
@ -50,7 +50,7 @@ class CallStatisticsData(val call: Call) : GenericContactData(call.remoteAddress
initCallStats() initCallStats()
val videoEnabled = call.currentParams.videoEnabled() val videoEnabled = call.currentParams.isVideoEnabled
isVideoEnabled.value = videoEnabled isVideoEnabled.value = videoEnabled
isExpanded.value = coreContext.core.currentCall == call isExpanded.value = coreContext.core.currentCall == call

View file

@ -126,8 +126,8 @@ class ControlsFragment : GenericFragment<CallControlsFragmentBinding>() {
if (call.state == Call.State.StreamsRunning) { if (call.state == Call.State.StreamsRunning) {
dialog?.dismiss() dialog?.dismiss()
} else if (call.state == Call.State.UpdatedByRemote) { } else if (call.state == Call.State.UpdatedByRemote) {
if (coreContext.core.videoCaptureEnabled() || coreContext.core.videoDisplayEnabled()) { if (coreContext.core.isVideoCaptureEnabled || coreContext.core.isVideoDisplayEnabled) {
if (call.currentParams.videoEnabled() != call.remoteParams?.videoEnabled()) { if (call.currentParams.isVideoEnabled != call.remoteParams?.isVideoEnabled) {
showCallVideoUpdateDialog(call) showCallVideoUpdateDialog(call)
} }
} else { } else {

View file

@ -139,7 +139,7 @@ open class CallViewModel(val call: Call) : GenericContactViewModel(call.remoteAd
} }
fun takeScreenshot() { fun takeScreenshot() {
if (call.currentParams.videoEnabled()) { if (call.currentParams.isVideoEnabled) {
val fileName = System.currentTimeMillis().toString() + ".jpeg" val fileName = System.currentTimeMillis().toString() + ".jpeg"
call.takeVideoSnapshot(FileUtils.getFileStoragePath(fileName).absolutePath) call.takeVideoSnapshot(FileUtils.getFileStoragePath(fileName).absolutePath)
} }

View file

@ -75,11 +75,11 @@ class CallsViewModel : ViewModel() {
} else if (call.state == Call.State.UpdatedByRemote) { } else if (call.state == Call.State.UpdatedByRemote) {
// If the correspondent asks to turn on video while audio call, // If the correspondent asks to turn on video while audio call,
// defer update until user has chosen whether to accept it or not // defer update until user has chosen whether to accept it or not
val remoteVideo = call.remoteParams?.videoEnabled() ?: false val remoteVideo = call.remoteParams?.isVideoEnabled ?: false
val localVideo = call.currentParams.videoEnabled() val localVideo = call.currentParams.isVideoEnabled
val autoAccept = call.core.videoActivationPolicy.automaticallyAccept val autoAccept = call.core.videoActivationPolicy.automaticallyAccept
if (remoteVideo && !localVideo && !autoAccept) { if (remoteVideo && !localVideo && !autoAccept) {
if (coreContext.core.videoCaptureEnabled() || coreContext.core.videoDisplayEnabled()) { if (coreContext.core.isVideoCaptureEnabled || coreContext.core.isVideoDisplayEnabled) {
call.deferUpdate() call.deferUpdate()
callUpdateEvent.value = Event(call) callUpdateEvent.value = Event(call)
} else { } else {

View file

@ -253,8 +253,8 @@ class ControlsViewModel : ViewModel() {
} }
somethingClickedEvent.value = Event(true) somethingClickedEvent.value = Event(true)
val micEnabled = coreContext.core.micEnabled() val micEnabled = coreContext.core.isMicEnabled
coreContext.core.enableMic(!micEnabled) coreContext.core.isMicEnabled = !micEnabled
updateMuteMicState() updateMuteMicState()
} }
@ -304,7 +304,7 @@ class ControlsViewModel : ViewModel() {
isVideoUpdateInProgress.value = true isVideoUpdateInProgress.value = true
val params = core.createCallParams(currentCall) val params = core.createCallParams(currentCall)
params?.enableVideo(!currentCall.currentParams.videoEnabled()) params?.isVideoEnabled = !currentCall.currentParams.isVideoEnabled
currentCall.update(params) currentCall.update(params)
} }
} }
@ -386,7 +386,7 @@ class ControlsViewModel : ViewModel() {
somethingClickedEvent.value = Event(true) somethingClickedEvent.value = Event(true)
val core = coreContext.core val core = coreContext.core
val currentCallVideoEnabled = core.currentCall?.currentParams?.videoEnabled() ?: false val currentCallVideoEnabled = core.currentCall?.currentParams?.isVideoEnabled ?: false
val params = core.createConferenceParams() val params = core.createConferenceParams()
params.isVideoEnabled = currentCallVideoEnabled params.isVideoEnabled = currentCallVideoEnabled
@ -419,7 +419,7 @@ class ControlsViewModel : ViewModel() {
} }
fun updateMuteMicState() { fun updateMuteMicState() {
isMicrophoneMuted.value = !PermissionHelper.get().hasRecordAudioPermission() || !coreContext.core.micEnabled() isMicrophoneMuted.value = !PermissionHelper.get().hasRecordAudioPermission() || !coreContext.core.isMicEnabled
isMuteMicrophoneEnabled.value = coreContext.core.currentCall != null || coreContext.core.conference?.isIn == true isMuteMicrophoneEnabled.value = coreContext.core.currentCall != null || coreContext.core.conference?.isIn == true
} }
@ -465,7 +465,7 @@ class ControlsViewModel : ViewModel() {
private fun updateVideoAvailable() { private fun updateVideoAvailable() {
val core = coreContext.core val core = coreContext.core
val currentCall = core.currentCall val currentCall = core.currentCall
isVideoAvailable.value = (core.videoCaptureEnabled() || core.videoPreviewEnabled()) && isVideoAvailable.value = (core.isVideoCaptureEnabled || core.isVideoPreviewEnabled) &&
( (
(currentCall != null && !currentCall.mediaInProgress()) || (currentCall != null && !currentCall.mediaInProgress()) ||
core.conference?.isIn == true core.conference?.isIn == true

View file

@ -60,10 +60,10 @@ class IncomingCallViewModel(call: Call) : CallViewModel(call) {
coreContext.core.addListener(listener) coreContext.core.addListener(listener)
screenLocked.value = false screenLocked.value = false
inviteWithVideo.value = call.remoteParams?.videoEnabled() == true && coreContext.core.videoActivationPolicy.automaticallyAccept inviteWithVideo.value = call.remoteParams?.isVideoEnabled == true && coreContext.core.videoActivationPolicy.automaticallyAccept
earlyMediaVideoEnabled.value = corePreferences.acceptEarlyMedia && earlyMediaVideoEnabled.value = corePreferences.acceptEarlyMedia &&
call.state == Call.State.IncomingEarlyMedia && call.state == Call.State.IncomingEarlyMedia &&
call.currentParams.videoEnabled() call.currentParams.isVideoEnabled
} }
override fun onCleared() { override fun onCleared() {

View file

@ -173,7 +173,7 @@ class DetailChatRoomFragment : MasterFragment<ChatRoomDetailFragmentBinding, Cha
Compatibility.setLocusIdInContentCaptureSession(binding.root, chatRoom) Compatibility.setLocusIdInContentCaptureSession(binding.root, chatRoom)
isSecure = chatRoom.currentParams.encryptionEnabled() isSecure = chatRoom.currentParams.isEncryptionEnabled
viewModel = ViewModelProvider( viewModel = ViewModelProvider(
this, this,
@ -391,7 +391,7 @@ class DetailChatRoomFragment : MasterFragment<ChatRoomDetailFragmentBinding, Cha
if (corePreferences.useInAppFileViewerForNonEncryptedFiles || content.isFileEncrypted) { if (corePreferences.useInAppFileViewerForNonEncryptedFiles || content.isFileEncrypted) {
val preventScreenshots = val preventScreenshots =
viewModel.chatRoom.currentParams.encryptionEnabled() viewModel.chatRoom.currentParams.isEncryptionEnabled
when { when {
FileUtils.isExtensionImage(path) -> navigateToImageFileViewer( FileUtils.isExtensionImage(path) -> navigateToImageFileViewer(
preventScreenshots preventScreenshots

View file

@ -54,7 +54,7 @@ class DevicesFragment : SecureFragment<ChatRoomDevicesFragmentBinding>() {
return return
} }
isSecure = chatRoom.currentParams.encryptionEnabled() isSecure = chatRoom.currentParams.isEncryptionEnabled
listViewModel = ViewModelProvider( listViewModel = ViewModelProvider(
this, this,

View file

@ -61,7 +61,7 @@ class GroupInfoFragment : SecureFragment<ChatRoomGroupInfoFragmentBinding>() {
} }
val chatRoom: ChatRoom? = sharedViewModel.selectedGroupChatRoom.value val chatRoom: ChatRoom? = sharedViewModel.selectedGroupChatRoom.value
isSecure = chatRoom?.currentParams?.encryptionEnabled() ?: false isSecure = chatRoom?.currentParams?.isEncryptionEnabled ?: false
viewModel = ViewModelProvider( viewModel = ViewModelProvider(
this, this,

View file

@ -61,7 +61,7 @@ class ImdnFragment : SecureFragment<ChatRoomImdnFragmentBinding>() {
return return
} }
isSecure = chatRoom.currentParams.encryptionEnabled() isSecure = chatRoom.currentParams.isEncryptionEnabled
if (arguments != null) { if (arguments != null) {
val messageId = arguments?.getString("MessageId") val messageId = arguments?.getString("MessageId")

View file

@ -160,9 +160,9 @@ class ChatRoomCreationViewModel : ErrorReportingViewModel() {
val encrypted = isEncrypted.value == true val encrypted = isEncrypted.value == true
val params: ChatRoomParams = coreContext.core.createDefaultChatRoomParams() val params: ChatRoomParams = coreContext.core.createDefaultChatRoomParams()
params.backend = ChatRoomBackend.Basic params.backend = ChatRoomBackend.Basic
params.enableGroup(false) params.isGroupEnabled = false
if (encrypted) { if (encrypted) {
params.enableEncryption(true) params.isEncryptionEnabled = true
params.backend = ChatRoomBackend.FlexisipChat params.backend = ChatRoomBackend.FlexisipChat
params.ephemeralMode = if (corePreferences.useEphemeralPerDeviceMode) params.ephemeralMode = if (corePreferences.useEphemeralPerDeviceMode)
ChatRoomEphemeralMode.DeviceManaged ChatRoomEphemeralMode.DeviceManaged

View file

@ -203,7 +203,7 @@ class ChatRoomViewModel(val chatRoom: ChatRoom) : ViewModel(), ContactDataInterf
} }
override fun onEphemeralEvent(chatRoom: ChatRoom, eventLog: EventLog) { override fun onEphemeralEvent(chatRoom: ChatRoom, eventLog: EventLog) {
ephemeralEnabled.value = chatRoom.ephemeralEnabled() ephemeralEnabled.value = chatRoom.isEphemeralEnabled
} }
override fun onParticipantAdminStatusChanged(chatRoom: ChatRoom, eventLog: EventLog) { override fun onParticipantAdminStatusChanged(chatRoom: ChatRoom, eventLog: EventLog) {
@ -222,7 +222,7 @@ class ChatRoomViewModel(val chatRoom: ChatRoom) : ViewModel(), ContactDataInterf
subject.value = chatRoom.subject subject.value = chatRoom.subject
updateSecurityIcon() updateSecurityIcon()
meAdmin.value = chatRoom.me?.isAdmin ?: false meAdmin.value = chatRoom.me?.isAdmin ?: false
ephemeralEnabled.value = chatRoom.ephemeralEnabled() ephemeralEnabled.value = chatRoom.isEphemeralEnabled
contactLookup() contactLookup()
updateParticipants() updateParticipants()

View file

@ -50,8 +50,8 @@ class EphemeralViewModel(private val chatRoom: ChatRoom) : ViewModel() {
} }
init { init {
Log.i("[Ephemeral Messages] Current lifetime is ${chatRoom.ephemeralLifetime}, ephemeral enabled? ${chatRoom.ephemeralEnabled()}") Log.i("[Ephemeral Messages] Current lifetime is ${chatRoom.ephemeralLifetime}, ephemeral enabled? ${chatRoom.isEphemeralEnabled}")
currentSelectedDuration = if (chatRoom.ephemeralEnabled()) chatRoom.ephemeralLifetime else 0 currentSelectedDuration = if (chatRoom.isEphemeralEnabled) chatRoom.ephemeralLifetime else 0
computeEphemeralDurationValues() computeEphemeralDurationValues()
} }
@ -65,13 +65,13 @@ class EphemeralViewModel(private val chatRoom: ChatRoom) : ViewModel() {
Log.i("[Ephemeral Messages] Configured lifetime for ephemeral messages was already $currentSelectedDuration") Log.i("[Ephemeral Messages] Configured lifetime for ephemeral messages was already $currentSelectedDuration")
} }
if (!chatRoom.ephemeralEnabled()) { if (!chatRoom.isEphemeralEnabled) {
Log.i("[Ephemeral Messages] Ephemeral messages were disabled, enable them") Log.i("[Ephemeral Messages] Ephemeral messages were disabled, enable them")
chatRoom.enableEphemeral(true) chatRoom.isEphemeralEnabled = true
} }
} else if (chatRoom.ephemeralEnabled()) { } else if (chatRoom.isEphemeralEnabled) {
Log.i("[Ephemeral Messages] Ephemeral messages were enabled, disable them") Log.i("[Ephemeral Messages] Ephemeral messages were enabled, disable them")
chatRoom.enableEphemeral(false) chatRoom.isEphemeralEnabled = false
} }
} }

View file

@ -117,8 +117,8 @@ class GroupInfoViewModel(val chatRoom: ChatRoom?) : ErrorReportingViewModel() {
fun createChatRoom() { fun createChatRoom() {
waitForChatRoomCreation.value = true waitForChatRoomCreation.value = true
val params: ChatRoomParams = coreContext.core.createDefaultChatRoomParams() val params: ChatRoomParams = coreContext.core.createDefaultChatRoomParams()
params.enableEncryption(isEncrypted.value == true) params.isEncryptionEnabled = isEncrypted.value == true
params.enableGroup(true) params.isGroupEnabled = true
if (isEncrypted.value == true) { if (isEncrypted.value == true) {
params.ephemeralMode = if (corePreferences.useEphemeralPerDeviceMode) params.ephemeralMode = if (corePreferences.useEphemeralPerDeviceMode)
ChatRoomEphemeralMode.DeviceManaged ChatRoomEphemeralMode.DeviceManaged

View file

@ -160,7 +160,7 @@ class DialerViewModel : LogsUploadViewModel() {
fun updateShowVideoPreview() { fun updateShowVideoPreview() {
val videoPreview = corePreferences.videoPreview val videoPreview = corePreferences.videoPreview
showPreview.value = videoPreview showPreview.value = videoPreview
coreContext.core.enableVideoPreview(videoPreview) coreContext.core.isVideoPreviewEnabled = videoPreview
} }
fun eraseLastChar() { fun eraseLastChar() {

View file

@ -315,7 +315,7 @@ class AccountSettingsViewModel(val account: Account) : GenericSettingsViewModel(
val iceListener = object : SettingListenerStub() { val iceListener = object : SettingListenerStub() {
override fun onBoolValueChanged(newValue: Boolean) { override fun onBoolValueChanged(newValue: Boolean) {
val params = account.params.clone() val params = account.params.clone()
params.natPolicy?.enableIce(newValue) params.natPolicy?.isIceEnabled = newValue
account.params = params account.params = params
} }
} }
@ -437,7 +437,7 @@ class AccountSettingsViewModel(val account: Account) : GenericSettingsViewModel(
proxy.value = params.serverAddress?.asStringUriOnly() proxy.value = params.serverAddress?.asStringUriOnly()
outboundProxy.value = params.isOutboundProxyEnabled outboundProxy.value = params.isOutboundProxyEnabled
stunServer.value = params.natPolicy?.stunServer stunServer.value = params.natPolicy?.stunServer
ice.value = params.natPolicy?.iceEnabled() ice.value = params.natPolicy?.isIceEnabled
avpf.value = params.avpfMode == AVPFMode.Enabled avpf.value = params.avpfMode == AVPFMode.Enabled
avpfRrInterval.value = params.avpfRrInterval avpfRrInterval.value = params.avpfRrInterval
expires.value = params.expires expires.value = params.expires

View file

@ -41,7 +41,7 @@ class AudioSettingsViewModel : GenericSettingsViewModel() {
val echoCancellationListener = object : SettingListenerStub() { val echoCancellationListener = object : SettingListenerStub() {
override fun onBoolValueChanged(newValue: Boolean) { override fun onBoolValueChanged(newValue: Boolean) {
core.enableEchoCancellation(newValue) core.isEchoCancellationEnabled = newValue
} }
} }
val echoCancellation = MutableLiveData<Boolean>() val echoCancellation = MutableLiveData<Boolean>()
@ -81,7 +81,7 @@ class AudioSettingsViewModel : GenericSettingsViewModel() {
val adaptiveRateControlListener = object : SettingListenerStub() { val adaptiveRateControlListener = object : SettingListenerStub() {
override fun onBoolValueChanged(newValue: Boolean) { override fun onBoolValueChanged(newValue: Boolean) {
core.enableAdaptiveRateControl(newValue) core.isAdaptiveRateControlEnabled = newValue
} }
} }
val adaptiveRateControl = MutableLiveData<Boolean>() val adaptiveRateControl = MutableLiveData<Boolean>()
@ -153,9 +153,9 @@ class AudioSettingsViewModel : GenericSettingsViewModel() {
val audioCodecs = MutableLiveData<ArrayList<ViewDataBinding>>() val audioCodecs = MutableLiveData<ArrayList<ViewDataBinding>>()
init { init {
echoCancellation.value = core.echoCancellationEnabled() echoCancellation.value = core.isEchoCancellationEnabled
adaptiveRateControl.value = core.adaptiveRateControlEnabled() adaptiveRateControl.value = core.isAdaptiveRateControlEnabled
echoCalibration.value = if (core.echoCancellationEnabled()) { echoCalibration.value = if (core.isEchoCancellationEnabled) {
prefs.getString(R.string.audio_settings_echo_cancellation_calibration_value).format(prefs.echoCancellerCalibration) prefs.getString(R.string.audio_settings_echo_cancellation_calibration_value).format(prefs.echoCancellerCalibration)
} else { } else {
prefs.getString(R.string.audio_settings_echo_canceller_calibration_summary) prefs.getString(R.string.audio_settings_echo_canceller_calibration_summary)

View file

@ -33,7 +33,7 @@ class ContactsSettingsViewModel : GenericSettingsViewModel() {
val friendListSubscribeListener = object : SettingListenerStub() { val friendListSubscribeListener = object : SettingListenerStub() {
override fun onBoolValueChanged(newValue: Boolean) { override fun onBoolValueChanged(newValue: Boolean) {
core.enableFriendListSubscription(newValue) core.isFriendListSubscriptionEnabled = newValue
} }
} }
val friendListSubscribe = MutableLiveData<Boolean>() val friendListSubscribe = MutableLiveData<Boolean>()

View file

@ -26,14 +26,14 @@ import org.linphone.activities.main.settings.SettingListenerStub
class NetworkSettingsViewModel : GenericSettingsViewModel() { class NetworkSettingsViewModel : GenericSettingsViewModel() {
val wifiOnlyListener = object : SettingListenerStub() { val wifiOnlyListener = object : SettingListenerStub() {
override fun onBoolValueChanged(newValue: Boolean) { override fun onBoolValueChanged(newValue: Boolean) {
core.enableWifiOnly(newValue) core.isWifiOnlyEnabled = newValue
} }
} }
val wifiOnly = MutableLiveData<Boolean>() val wifiOnly = MutableLiveData<Boolean>()
val allowIpv6Listener = object : SettingListenerStub() { val allowIpv6Listener = object : SettingListenerStub() {
override fun onBoolValueChanged(newValue: Boolean) { override fun onBoolValueChanged(newValue: Boolean) {
core.enableIpv6(newValue) core.isIpv6Enabled = newValue
} }
} }
val allowIpv6 = MutableLiveData<Boolean>() val allowIpv6 = MutableLiveData<Boolean>()
@ -59,8 +59,8 @@ class NetworkSettingsViewModel : GenericSettingsViewModel() {
val sipPort = MutableLiveData<Int>() val sipPort = MutableLiveData<Int>()
init { init {
wifiOnly.value = core.wifiOnlyEnabled() wifiOnly.value = core.isWifiOnlyEnabled
allowIpv6.value = core.ipv6Enabled() allowIpv6.value = core.isIpv6Enabled
randomPorts.value = getTransportPort() == -1 randomPorts.value = getTransportPort() == -1
sipPort.value = getTransportPort() sipPort.value = getTransportPort()
} }

View file

@ -52,7 +52,7 @@ class TunnelSettingsViewModel : GenericSettingsViewModel() {
val useDualModeListener = object : SettingListenerStub() { val useDualModeListener = object : SettingListenerStub() {
override fun onBoolValueChanged(newValue: Boolean) { override fun onBoolValueChanged(newValue: Boolean) {
val tunnel = core.tunnel val tunnel = core.tunnel
tunnel?.enableDualMode(newValue) tunnel?.isDualModeEnabled = newValue
} }
} }
val useDualMode = MutableLiveData<Boolean>() val useDualMode = MutableLiveData<Boolean>()
@ -96,7 +96,7 @@ class TunnelSettingsViewModel : GenericSettingsViewModel() {
hostnameUrl.value = config.host hostnameUrl.value = config.host
port.value = config.port port.value = config.port
useDualMode.value = tunnel?.dualModeEnabled() useDualMode.value = tunnel?.isDualModeEnabled
hostnameUrl2.value = config.host2 hostnameUrl2.value = config.host2
port2.value = config.port2 port2.value = config.port2

View file

@ -31,8 +31,8 @@ import org.linphone.core.tools.Log
class VideoSettingsViewModel : GenericSettingsViewModel() { class VideoSettingsViewModel : GenericSettingsViewModel() {
val enableVideoListener = object : SettingListenerStub() { val enableVideoListener = object : SettingListenerStub() {
override fun onBoolValueChanged(newValue: Boolean) { override fun onBoolValueChanged(newValue: Boolean) {
core.enableVideoCapture(newValue) core.isVideoCaptureEnabled = newValue
core.enableVideoDisplay(newValue) core.isVideoDisplayEnabled = newValue
if (!newValue) { if (!newValue) {
tabletPreview.value = false tabletPreview.value = false
initiateCall.value = false initiateCall.value = false
@ -115,7 +115,7 @@ class VideoSettingsViewModel : GenericSettingsViewModel() {
val videoCodecs = MutableLiveData<ArrayList<ViewDataBinding>>() val videoCodecs = MutableLiveData<ArrayList<ViewDataBinding>>()
init { init {
enableVideo.value = core.videoEnabled() && core.videoSupported() enableVideo.value = core.isVideoEnabled && core.videoSupported()
tabletPreview.value = prefs.videoPreview tabletPreview.value = prefs.videoPreview
isTablet.value = coreContext.context.resources.getBoolean(R.bool.isTablet) isTablet.value = coreContext.context.resources.getBoolean(R.bool.isTablet)
initiateCall.value = core.videoActivationPolicy.automaticallyInitiate initiateCall.value = core.videoActivationPolicy.automaticallyInitiate

View file

@ -206,7 +206,7 @@ class Api26Compatibility {
} }
Call.State.OutgoingRinging, Call.State.OutgoingProgress, Call.State.OutgoingInit, Call.State.OutgoingEarlyMedia -> { Call.State.OutgoingRinging, Call.State.OutgoingProgress, Call.State.OutgoingInit, Call.State.OutgoingEarlyMedia -> {
stringResourceId = R.string.call_notification_outgoing stringResourceId = R.string.call_notification_outgoing
iconResourceId = if (call.params.videoEnabled()) { iconResourceId = if (call.params.isVideoEnabled) {
R.drawable.topbar_videocall_notification R.drawable.topbar_videocall_notification
} else { } else {
R.drawable.topbar_call_notification R.drawable.topbar_call_notification
@ -214,7 +214,7 @@ class Api26Compatibility {
} }
else -> { else -> {
stringResourceId = R.string.call_notification_active stringResourceId = R.string.call_notification_active
iconResourceId = if (call.currentParams.videoEnabled()) { iconResourceId = if (call.currentParams.isVideoEnabled) {
R.drawable.topbar_videocall_notification R.drawable.topbar_videocall_notification
} else { } else {
R.drawable.topbar_call_notification R.drawable.topbar_call_notification

View file

@ -96,7 +96,7 @@ class Api31Compatibility {
val roundPicture = ImageUtils.getRoundBitmapFromUri(context, pictureUri) val roundPicture = ImageUtils.getRoundBitmapFromUri(context, pictureUri)
val displayName = contact?.fullName ?: LinphoneUtils.getDisplayName(call.remoteAddress) val displayName = contact?.fullName ?: LinphoneUtils.getDisplayName(call.remoteAddress)
val isVideo = call.currentParams.videoEnabled() val isVideo = call.currentParams.isVideoEnabled
val iconResourceId: Int = when (call.state) { val iconResourceId: Int = when (call.state) {
Call.State.Paused, Call.State.Pausing, Call.State.PausedByRemote -> { Call.State.Paused, Call.State.Pausing, Call.State.PausedByRemote -> {
R.drawable.topbar_call_paused_notification R.drawable.topbar_call_paused_notification

View file

@ -192,7 +192,7 @@ class NativeContact(val nativeId: String, private val lookupKey: String? = null)
var created = false var created = false
if (friend == null) { if (friend == null) {
val friend = coreContext.core.createFriend() val friend = coreContext.core.createFriend()
friend.enableSubscribes(false) friend.isSubscribesEnabled = false
friend.incSubscribePolicy = SubscribePolicy.SPDeny friend.incSubscribePolicy = SubscribePolicy.SPDeny
friend.refKey = nativeId friend.refKey = nativeId
friend.userData = this friend.userData = this

View file

@ -189,7 +189,7 @@ class CoreContext(val context: Context, coreConfig: Config) {
} }
} }
if (corePreferences.routeAudioToSpeakerWhenVideoIsEnabled && call.currentParams.videoEnabled()) { if (corePreferences.routeAudioToSpeakerWhenVideoIsEnabled && call.currentParams.isVideoEnabled) {
// Do not turn speaker on when video is enabled if headset or bluetooth is used // Do not turn speaker on when video is enabled if headset or bluetooth is used
if (!AudioRouteUtils.isHeadsetAudioRouteAvailable() && !AudioRouteUtils.isBluetoothAudioRouteCurrentlyUsed( if (!AudioRouteUtils.isHeadsetAudioRouteAvailable() && !AudioRouteUtils.isBluetoothAudioRouteCurrentlyUsed(
call call
@ -380,6 +380,12 @@ class CoreContext(val context: Context, coreConfig: Config) {
core.limeX3DhServerUrl = url core.limeX3DhServerUrl = url
} }
} }
// Ensure we allow CPIM messages in basic chat rooms
val newParams = account.params.clone()
newParams.isCpimInBasicChatRoomEnabled = true
account.params = newParams
Log.i("[Context] CPIM allowed in basic chat rooms for account ${newParams.identityAddress?.asStringUriOnly()}")
} }
} }
@ -455,11 +461,11 @@ class CoreContext(val context: Context, coreConfig: Config) {
val params = core.createCallParams(call) val params = core.createCallParams(call)
if (accept) { if (accept) {
params?.enableVideo(true) params?.isVideoEnabled = true
core.enableVideoCapture(true) core.isVideoCaptureEnabled = true
core.enableVideoDisplay(true) core.isVideoDisplayEnabled = true
} else { } else {
params?.enableVideo(false) params?.isVideoEnabled = false
} }
call.acceptUpdate(params) call.acceptUpdate(params)
@ -471,7 +477,7 @@ class CoreContext(val context: Context, coreConfig: Config) {
params?.recordFile = LinphoneUtils.getRecordingFilePathForAddress(call.remoteAddress) params?.recordFile = LinphoneUtils.getRecordingFilePathForAddress(call.remoteAddress)
if (LinphoneUtils.checkIfNetworkHasLowBandwidth(context)) { if (LinphoneUtils.checkIfNetworkHasLowBandwidth(context)) {
Log.w("[Context] Enabling low bandwidth mode!") Log.w("[Context] Enabling low bandwidth mode!")
params?.enableLowBandwidth(true) params?.isLowBandwidthEnabled = true
} }
call.acceptWithParams(params) call.acceptWithParams(params)
} }
@ -548,7 +554,7 @@ class CoreContext(val context: Context, coreConfig: Config) {
} }
if (LinphoneUtils.checkIfNetworkHasLowBandwidth(context)) { if (LinphoneUtils.checkIfNetworkHasLowBandwidth(context)) {
Log.w("[Context] Enabling low bandwidth mode!") Log.w("[Context] Enabling low bandwidth mode!")
params.enableLowBandwidth(true) params.isLowBandwidthEnabled = true
} }
params.recordFile = LinphoneUtils.getRecordingFilePathForAddress(address) params.recordFile = LinphoneUtils.getRecordingFilePathForAddress(address)
@ -562,7 +568,7 @@ class CoreContext(val context: Context, coreConfig: Config) {
} }
if (corePreferences.sendEarlyMedia) { if (corePreferences.sendEarlyMedia) {
params.enableEarlyMediaSending(true) params.isEarlyMediaSendingEnabled = true
} }
val call = core.inviteAddressWithParams(address, params) val call = core.inviteAddressWithParams(address, params)
@ -601,7 +607,7 @@ class CoreContext(val context: Context, coreConfig: Config) {
return if (conference != null && conference.isIn) { return if (conference != null && conference.isIn) {
conference.currentParams.isVideoEnabled conference.currentParams.isVideoEnabled
} else { } else {
core.currentCall?.currentParams?.videoEnabled() ?: false core.currentCall?.currentParams?.isVideoEnabled ?: false
} }
} }

View file

@ -66,7 +66,7 @@ class LinphoneUtils {
fun isLimeAvailable(): Boolean { fun isLimeAvailable(): Boolean {
val core = coreContext.core val core = coreContext.core
return core.limeX3DhAvailable() && core.limeX3DhEnabled() && return core.limeX3DhAvailable() && core.isLimeX3DhEnabled &&
core.limeX3DhServerUrl != null && core.limeX3DhServerUrl != null &&
core.defaultAccount?.params?.conferenceFactoryUri != null core.defaultAccount?.params?.conferenceFactoryUri != null
} }
@ -81,11 +81,11 @@ class LinphoneUtils {
val defaultAccount = core.defaultAccount val defaultAccount = core.defaultAccount
val params = core.createDefaultChatRoomParams() val params = core.createDefaultChatRoomParams()
params.enableGroup(false) params.isGroupEnabled = false
params.backend = ChatRoomBackend.Basic params.backend = ChatRoomBackend.Basic
if (isSecured) { if (isSecured) {
params.subject = AppUtils.getString(R.string.chat_room_dummy_subject) params.subject = AppUtils.getString(R.string.chat_room_dummy_subject)
params.enableEncryption(true) params.isEncryptionEnabled = true
params.backend = ChatRoomBackend.FlexisipChat params.backend = ChatRoomBackend.FlexisipChat
} }

View file

@ -128,7 +128,7 @@
android:src="@drawable/chat_send_message" /> android:src="@drawable/chat_send_message" />
<ImageView <ImageView
android:visibility="@{viewModel.chatRoom.ephemeralEnabled() ? View.VISIBLE : View.GONE, default=gone}" android:visibility="@{viewModel.chatRoom.isEphemeralEnabled() ? View.VISIBLE : View.GONE, default=gone}"
android:enabled="@{chatSendingViewModel.sendMessageEnabled &amp;&amp; !chatSendingViewModel.isReadOnly}" android:enabled="@{chatSendingViewModel.sendMessageEnabled &amp;&amp; !chatSendingViewModel.isReadOnly}"
android:contentDescription="@string/content_description_ephemeral_message" android:contentDescription="@string/content_description_ephemeral_message"
android:clickable="false" android:clickable="false"

View file

@ -258,7 +258,7 @@
android:src="@drawable/chat_send_message" /> android:src="@drawable/chat_send_message" />
<ImageView <ImageView
android:visibility="@{viewModel.chatRoom.ephemeralEnabled() ? View.VISIBLE : View.GONE, default=gone}" android:visibility="@{viewModel.chatRoom.isEphemeralEnabled() ? View.VISIBLE : View.GONE, default=gone}"
android:enabled="@{chatSendingViewModel.sendMessageEnabled}" android:enabled="@{chatSendingViewModel.sendMessageEnabled}"
android:contentDescription="@string/content_description_ephemeral_message" android:contentDescription="@string/content_description_ephemeral_message"
android:clickable="false" android:clickable="false"