Added RC setting to disable video completely
This commit is contained in:
parent
feec8b9758
commit
a8bdca0c26
10 changed files with 34 additions and 7 deletions
|
@ -16,6 +16,7 @@ Group changes to describe their impact on the project, as follows:
|
||||||
- Showing short term presence for contacts whom publish it + added setting to disable it (enabled by default for sip.linphone.org accounts)
|
- Showing short term presence for contacts whom publish it + added setting to disable it (enabled by default for sip.linphone.org accounts)
|
||||||
- Confirmation dialog before removing account
|
- Confirmation dialog before removing account
|
||||||
- Attended transfer instead of blind transfer if there is more than 1 call
|
- Attended transfer instead of blind transfer if there is more than 1 call
|
||||||
|
- Added hidden setting to disable video completely
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
- Account EXPIRES is now set to 1 month instead of 1 year for sip.linphone.org accounts
|
- Account EXPIRES is now set to 1 month instead of 1 year for sip.linphone.org accounts
|
||||||
|
|
|
@ -103,6 +103,8 @@ class ConferenceWaitingRoomViewModel : MessageNotifierViewModel() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val hideVideo = corePreferences.disableVideo
|
||||||
|
|
||||||
private val callParams: CallParams = coreContext.core.createCallParams(null)!!
|
private val callParams: CallParams = coreContext.core.createCallParams(null)!!
|
||||||
|
|
||||||
private val listener: CoreListenerStub = object : CoreListenerStub() {
|
private val listener: CoreListenerStub = object : CoreListenerStub() {
|
||||||
|
|
|
@ -24,6 +24,7 @@ import androidx.lifecycle.MediatorLiveData
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
import androidx.lifecycle.ViewModel
|
import androidx.lifecycle.ViewModel
|
||||||
import org.linphone.LinphoneApplication.Companion.coreContext
|
import org.linphone.LinphoneApplication.Companion.coreContext
|
||||||
|
import org.linphone.LinphoneApplication.Companion.corePreferences
|
||||||
import org.linphone.R
|
import org.linphone.R
|
||||||
import org.linphone.activities.voip.data.CallData
|
import org.linphone.activities.voip.data.CallData
|
||||||
import org.linphone.core.*
|
import org.linphone.core.*
|
||||||
|
|
|
@ -198,7 +198,7 @@ class ConferenceViewModel : ViewModel() {
|
||||||
|
|
||||||
override fun onStateChanged(conference: Conference, state: Conference.State) {
|
override fun onStateChanged(conference: Conference, state: Conference.State) {
|
||||||
Log.i("[Conference] State changed: $state")
|
Log.i("[Conference] State changed: $state")
|
||||||
isVideoConference.value = conference.currentParams.isVideoEnabled
|
isVideoConference.value = conference.currentParams.isVideoEnabled && !corePreferences.disableVideo
|
||||||
|
|
||||||
when (state) {
|
when (state) {
|
||||||
Conference.State.Created -> {
|
Conference.State.Created -> {
|
||||||
|
@ -340,7 +340,7 @@ class ConferenceViewModel : ViewModel() {
|
||||||
|
|
||||||
isConferenceLocallyPaused.value = !conference.isIn
|
isConferenceLocallyPaused.value = !conference.isIn
|
||||||
isMeAdmin.value = conference.me.isAdmin
|
isMeAdmin.value = conference.me.isAdmin
|
||||||
isVideoConference.value = conference.currentParams.isVideoEnabled
|
isVideoConference.value = conference.currentParams.isVideoEnabled && !corePreferences.disableVideo
|
||||||
subject.value = LinphoneUtils.getConferenceSubject(conference)
|
subject.value = LinphoneUtils.getConferenceSubject(conference)
|
||||||
|
|
||||||
updateConferenceLayout(conference)
|
updateConferenceLayout(conference)
|
||||||
|
|
|
@ -107,6 +107,8 @@ class ControlsViewModel : ViewModel() {
|
||||||
|
|
||||||
val foldingState = MutableLiveData<FoldingFeature>()
|
val foldingState = MutableLiveData<FoldingFeature>()
|
||||||
|
|
||||||
|
val hideVideo = corePreferences.disableVideo
|
||||||
|
|
||||||
private val nonEarpieceOutputAudioDevice = MutableLiveData<Boolean>()
|
private val nonEarpieceOutputAudioDevice = MutableLiveData<Boolean>()
|
||||||
|
|
||||||
private val listener: CoreListenerStub = object : CoreListenerStub() {
|
private val listener: CoreListenerStub = object : CoreListenerStub() {
|
||||||
|
|
|
@ -133,6 +133,18 @@ class CoreContext(
|
||||||
override fun onGlobalStateChanged(core: Core, state: GlobalState, message: String) {
|
override fun onGlobalStateChanged(core: Core, state: GlobalState, message: String) {
|
||||||
Log.i("[Context] Global state changed [$state]")
|
Log.i("[Context] Global state changed [$state]")
|
||||||
if (state == GlobalState.On) {
|
if (state == GlobalState.On) {
|
||||||
|
if (corePreferences.disableVideo) {
|
||||||
|
// if video has been disabled, don't forget to tell the Core to disable it as well
|
||||||
|
Log.w("[Context] Video has been disabled in app, disabling it as well in the Core")
|
||||||
|
core.isVideoCaptureEnabled = false
|
||||||
|
core.isVideoDisplayEnabled = false
|
||||||
|
|
||||||
|
val videoPolicy = core.videoActivationPolicy
|
||||||
|
videoPolicy.automaticallyInitiate = false
|
||||||
|
videoPolicy.automaticallyAccept = false
|
||||||
|
core.videoActivationPolicy = videoPolicy
|
||||||
|
}
|
||||||
|
|
||||||
fetchContacts()
|
fetchContacts()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -789,7 +801,7 @@ class CoreContext(
|
||||||
}
|
}
|
||||||
|
|
||||||
fun showSwitchCameraButton(): Boolean {
|
fun showSwitchCameraButton(): Boolean {
|
||||||
return core.videoDevicesList.size > 2 // Count StaticImage camera
|
return !corePreferences.disableVideo && core.videoDevicesList.size > 2 // Count StaticImage camera
|
||||||
}
|
}
|
||||||
|
|
||||||
fun createCallOverlay() {
|
fun createCallOverlay() {
|
||||||
|
|
|
@ -30,6 +30,7 @@ import java.security.KeyStoreException
|
||||||
import org.linphone.LinphoneApplication.Companion.coreContext
|
import org.linphone.LinphoneApplication.Companion.coreContext
|
||||||
import org.linphone.compatibility.Compatibility
|
import org.linphone.compatibility.Compatibility
|
||||||
import org.linphone.core.tools.Log
|
import org.linphone.core.tools.Log
|
||||||
|
import org.linphone.utils.LinphoneUtils
|
||||||
|
|
||||||
class CorePreferences constructor(private val context: Context) {
|
class CorePreferences constructor(private val context: Context) {
|
||||||
private var _config: Config? = null
|
private var _config: Config? = null
|
||||||
|
@ -474,6 +475,10 @@ class CorePreferences constructor(private val context: Context) {
|
||||||
val disableChat: Boolean
|
val disableChat: Boolean
|
||||||
get() = config.getBool("app", "disable_chat_feature", false)
|
get() = config.getBool("app", "disable_chat_feature", false)
|
||||||
|
|
||||||
|
// Will disable video feature completely
|
||||||
|
val disableVideo: Boolean
|
||||||
|
get() = config.getBool("app", "disable_video_feature", false)
|
||||||
|
|
||||||
val forceEndToEndEncryptedChat: Boolean
|
val forceEndToEndEncryptedChat: Boolean
|
||||||
get() = config.getBool("app", "force_lime_chat_rooms", false)
|
get() = config.getBool("app", "force_lime_chat_rooms", false)
|
||||||
|
|
||||||
|
@ -572,7 +577,7 @@ class CorePreferences constructor(private val context: Context) {
|
||||||
get() = config.getBool("app", "side_menu_recordings", true)
|
get() = config.getBool("app", "side_menu_recordings", true)
|
||||||
|
|
||||||
val showScheduledConferencesInSideMenu: Boolean
|
val showScheduledConferencesInSideMenu: Boolean
|
||||||
get() = config.getBool("app", "side_menu_conferences", true)
|
get() = config.getBool("app", "side_menu_conferences", LinphoneUtils.isRemoteConferencingAvailable())
|
||||||
|
|
||||||
val showAboutInSideMenu: Boolean
|
val showAboutInSideMenu: Boolean
|
||||||
get() = config.getBool("app", "side_menu_about", true)
|
get() = config.getBool("app", "side_menu_about", true)
|
||||||
|
@ -595,13 +600,13 @@ class CorePreferences constructor(private val context: Context) {
|
||||||
get() = config.getBool("app", "settings_audio", true)
|
get() = config.getBool("app", "settings_audio", true)
|
||||||
|
|
||||||
val showVideoSettings: Boolean
|
val showVideoSettings: Boolean
|
||||||
get() = config.getBool("app", "settings_video", true)
|
get() = config.getBool("app", "settings_video", !disableVideo)
|
||||||
|
|
||||||
val showCallSettings: Boolean
|
val showCallSettings: Boolean
|
||||||
get() = config.getBool("app", "settings_call", true)
|
get() = config.getBool("app", "settings_call", true)
|
||||||
|
|
||||||
val showChatSettings: Boolean
|
val showChatSettings: Boolean
|
||||||
get() = config.getBool("app", "settings_chat", true)
|
get() = config.getBool("app", "settings_chat", !disableChat)
|
||||||
|
|
||||||
val showNetworkSettings: Boolean
|
val showNetworkSettings: Boolean
|
||||||
get() = config.getBool("app", "settings_network", true)
|
get() = config.getBool("app", "settings_network", true)
|
||||||
|
@ -613,7 +618,7 @@ class CorePreferences constructor(private val context: Context) {
|
||||||
get() = config.getBool("app", "settings_advanced", true)
|
get() = config.getBool("app", "settings_advanced", true)
|
||||||
|
|
||||||
val showConferencesSettings: Boolean
|
val showConferencesSettings: Boolean
|
||||||
get() = config.getBool("app", "settings_conferences", true)
|
get() = config.getBool("app", "settings_conferences", LinphoneUtils.isRemoteConferencingAvailable())
|
||||||
|
|
||||||
/* Assets stuff */
|
/* Assets stuff */
|
||||||
|
|
||||||
|
|
|
@ -284,6 +284,7 @@
|
||||||
android:onClick="@{() -> viewModel.toggleVideo()}"
|
android:onClick="@{() -> viewModel.toggleVideo()}"
|
||||||
android:padding="5dp"
|
android:padding="5dp"
|
||||||
android:selected="@{viewModel.isVideoEnabled}"
|
android:selected="@{viewModel.isVideoEnabled}"
|
||||||
|
android:visibility="@{viewModel.hideVideo ? View.GONE : View.VISIBLE}"
|
||||||
android:src="@drawable/icon_toggle_camera"
|
android:src="@drawable/icon_toggle_camera"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintDimensionRatio="W,1:1"
|
app:layout_constraintDimensionRatio="W,1:1"
|
||||||
|
|
|
@ -288,6 +288,7 @@
|
||||||
android:onClick="@{() -> viewModel.toggleVideo()}"
|
android:onClick="@{() -> viewModel.toggleVideo()}"
|
||||||
android:padding="5dp"
|
android:padding="5dp"
|
||||||
android:selected="@{viewModel.isVideoEnabled}"
|
android:selected="@{viewModel.isVideoEnabled}"
|
||||||
|
android:visibility="@{viewModel.hideVideo ? View.GONE : View.VISIBLE}"
|
||||||
android:src="@drawable/icon_toggle_camera"
|
android:src="@drawable/icon_toggle_camera"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintDimensionRatio="W,1:1"
|
app:layout_constraintDimensionRatio="W,1:1"
|
||||||
|
@ -304,6 +305,7 @@
|
||||||
android:padding="10dp"
|
android:padding="10dp"
|
||||||
android:selected="@{viewModel.layoutMenuSelected}"
|
android:selected="@{viewModel.layoutMenuSelected}"
|
||||||
android:src="@{viewModel.selectedLayout == ConferenceDisplayMode.ACTIVE_SPEAKER ? @drawable/icon_conference_layout_active_speaker : viewModel.selectedLayout == ConferenceDisplayMode.AUDIO_ONLY ? @drawable/icon_conference_layout_audio_only : @drawable/icon_conference_layout_grid, default=@drawable/icon_conference_layout_grid}"
|
android:src="@{viewModel.selectedLayout == ConferenceDisplayMode.ACTIVE_SPEAKER ? @drawable/icon_conference_layout_active_speaker : viewModel.selectedLayout == ConferenceDisplayMode.AUDIO_ONLY ? @drawable/icon_conference_layout_audio_only : @drawable/icon_conference_layout_grid, default=@drawable/icon_conference_layout_grid}"
|
||||||
|
android:visibility="@{viewModel.hideVideo ? View.GONE : View.VISIBLE}"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintDimensionRatio="W,1:1"
|
app:layout_constraintDimensionRatio="W,1:1"
|
||||||
app:layout_constraintEnd_toEndOf="parent" />
|
app:layout_constraintEnd_toEndOf="parent" />
|
||||||
|
|
|
@ -100,6 +100,7 @@
|
||||||
android:onClick="@{() -> (!conferenceViewModel.conferenceExists || conferenceViewModel.conferenceDisplayMode != ConferenceDisplayMode.AUDIO_ONLY) ? controlsViewModel.toggleVideo() : conferenceViewModel.switchLayoutFromAudioOnlyToActiveSpeaker()}"
|
android:onClick="@{() -> (!conferenceViewModel.conferenceExists || conferenceViewModel.conferenceDisplayMode != ConferenceDisplayMode.AUDIO_ONLY) ? controlsViewModel.toggleVideo() : conferenceViewModel.switchLayoutFromAudioOnlyToActiveSpeaker()}"
|
||||||
android:padding="5dp"
|
android:padding="5dp"
|
||||||
android:selected="@{controlsViewModel.isVideoEnabled && controlsViewModel.isSendingVideo}"
|
android:selected="@{controlsViewModel.isVideoEnabled && controlsViewModel.isSendingVideo}"
|
||||||
|
android:visibility="@{controlsViewModel.hideVideo ? View.GONE : View.VISIBLE}"
|
||||||
android:src="@drawable/icon_toggle_camera"
|
android:src="@drawable/icon_toggle_camera"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintDimensionRatio="W,1:1"
|
app:layout_constraintDimensionRatio="W,1:1"
|
||||||
|
|
Loading…
Reference in a new issue