Also hide video call button if video is disabled

This commit is contained in:
Sylvain Berfini 2023-09-21 11:42:08 +02:00
parent 544f37a75b
commit 93bb1c0c96
4 changed files with 12 additions and 2 deletions

View file

@ -21,6 +21,8 @@ class CallLogViewModel @UiThread constructor() : ViewModel() {
val chatDisabled = MutableLiveData<Boolean>()
val videoCallDisabled = MutableLiveData<Boolean>()
val historyDeletedEvent: MutableLiveData<Event<Boolean>> by lazy {
MutableLiveData<Event<Boolean>>()
}
@ -28,8 +30,9 @@ class CallLogViewModel @UiThread constructor() : ViewModel() {
private lateinit var address: Address
init {
coreContext.postOnCoreThread {
coreContext.postOnCoreThread { core ->
chatDisabled.postValue(corePreferences.disableChat)
videoCallDisabled.postValue(!core.isVideoEnabled)
}
}

View file

@ -68,6 +68,8 @@ class ContactViewModel @UiThread constructor() : ViewModel() {
val chatDisabled = MutableLiveData<Boolean>()
val videoCallDisabled = MutableLiveData<Boolean>()
val showLongPressMenuForNumberOrAddressEvent: MutableLiveData<Event<ContactNumberOrAddressModel>> by lazy {
MutableLiveData<Event<ContactNumberOrAddressModel>>()
}
@ -145,8 +147,9 @@ class ContactViewModel @UiThread constructor() : ViewModel() {
expandNumbersAndAddresses.value = true
expandDevicesTrust.value = false // TODO FIXME: set it to true when it will work for real
coreContext.postOnCoreThread {
coreContext.postOnCoreThread { core ->
chatDisabled.postValue(corePreferences.disableChat)
videoCallDisabled.postValue(!core.isVideoEnabled)
coreContext.contactsManager.addListener(contactsListener)
}
}

View file

@ -197,6 +197,7 @@
<ImageView
android:onClick="@{() -> viewModel.startVideoCall()}"
android:id="@+id/video_call"
android:visibility="@{viewModel.videoCallDisabled ? View.GONE : View.VISIBLE}"
android:layout_width="56dp"
android:layout_height="56dp"
android:layout_marginTop="20dp"
@ -212,6 +213,7 @@
style="@style/default_text_style"
android:onClick="@{() -> viewModel.startVideoCall()}"
android:id="@+id/video_call_label"
android:visibility="@{viewModel.videoCallDisabled ? View.GONE : View.VISIBLE}"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"

View file

@ -210,6 +210,7 @@
<ImageView
android:onClick="@{() -> viewModel.startVideoCall()}"
android:id="@+id/video_call"
android:visibility="@{viewModel.videoCallDisabled ? View.GONE : View.VISIBLE}"
android:layout_width="56dp"
android:layout_height="56dp"
android:layout_marginTop="20dp"
@ -225,6 +226,7 @@
style="@style/default_text_style"
android:onClick="@{() -> viewModel.startVideoCall()}"
android:id="@+id/video_call_label"
android:visibility="@{viewModel.videoCallDisabled ? View.GONE : View.VISIBLE}"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"