Disable attach file & voice messages in chat if no file transfer server URL is set
This commit is contained in:
parent
197ceb9e69
commit
226095bec7
8 changed files with 16 additions and 2 deletions
|
@ -107,6 +107,8 @@ class ChatMessageSendingViewModel(private val chatRoom: ChatRoom) : ViewModel()
|
||||||
|
|
||||||
val isEmojiPickerVisible = MutableLiveData<Boolean>()
|
val isEmojiPickerVisible = MutableLiveData<Boolean>()
|
||||||
|
|
||||||
|
val isFileTransferAvailable = MutableLiveData<Boolean>()
|
||||||
|
|
||||||
val requestKeyboardHidingEvent: MutableLiveData<Event<Boolean>> by lazy {
|
val requestKeyboardHidingEvent: MutableLiveData<Event<Boolean>> by lazy {
|
||||||
MutableLiveData<Event<Boolean>>()
|
MutableLiveData<Event<Boolean>>()
|
||||||
}
|
}
|
||||||
|
@ -146,6 +148,7 @@ class ChatMessageSendingViewModel(private val chatRoom: ChatRoom) : ViewModel()
|
||||||
sendMessageEnabled.value = false
|
sendMessageEnabled.value = false
|
||||||
isEmojiPickerOpen.value = false
|
isEmojiPickerOpen.value = false
|
||||||
isEmojiPickerVisible.value = corePreferences.showEmojiPickerButton
|
isEmojiPickerVisible.value = corePreferences.showEmojiPickerButton
|
||||||
|
isFileTransferAvailable.value = LinphoneUtils.isFileTransferAvailable()
|
||||||
updateChatRoomReadOnlyState()
|
updateChatRoomReadOnlyState()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -288,6 +288,11 @@ class LinphoneUtils {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun isFileTransferAvailable(): Boolean {
|
||||||
|
val core = coreContext.core
|
||||||
|
return core.fileTransferServer.orEmpty().isNotEmpty()
|
||||||
|
}
|
||||||
|
|
||||||
fun hashPassword(
|
fun hashPassword(
|
||||||
userId: String,
|
userId: String,
|
||||||
password: String,
|
password: String,
|
||||||
|
|
|
@ -44,6 +44,7 @@
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
android:background="?attr/backgroundColor"
|
||||||
android:clickable="true">
|
android:clickable="true">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
|
|
@ -34,7 +34,8 @@
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:layout_width="@dimen/master_fragment_width"
|
android:layout_width="@dimen/master_fragment_width"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_gravity="start">
|
android:layout_gravity="start"
|
||||||
|
android:background="?attr/backgroundColor">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/top_bar"
|
android:id="@+id/top_bar"
|
||||||
|
|
|
@ -126,7 +126,7 @@
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
android:layout_marginStart="@dimen/chat_message_sending_icons_margin"
|
android:layout_marginStart="@dimen/chat_message_sending_icons_margin"
|
||||||
android:contentDescription="@string/content_description_attach_file"
|
android:contentDescription="@string/content_description_attach_file"
|
||||||
android:enabled="@{chatSendingViewModel.attachFileEnabled && !chatSendingViewModel.attachFilePending}"
|
android:enabled="@{chatSendingViewModel.attachFileEnabled && !chatSendingViewModel.attachFilePending && chatSendingViewModel.isFileTransferAvailable}"
|
||||||
android:onClick="@{attachFileClickListener}"
|
android:onClick="@{attachFileClickListener}"
|
||||||
android:paddingTop="@dimen/chat_message_sending_icons_margin"
|
android:paddingTop="@dimen/chat_message_sending_icons_margin"
|
||||||
android:paddingBottom="@dimen/chat_message_sending_icons_margin"
|
android:paddingBottom="@dimen/chat_message_sending_icons_margin"
|
||||||
|
@ -147,6 +147,7 @@
|
||||||
android:paddingTop="@dimen/chat_message_sending_icons_margin"
|
android:paddingTop="@dimen/chat_message_sending_icons_margin"
|
||||||
android:paddingBottom="@dimen/chat_message_sending_icons_margin"
|
android:paddingBottom="@dimen/chat_message_sending_icons_margin"
|
||||||
android:selected="@{chatSendingViewModel.isVoiceRecording}"
|
android:selected="@{chatSendingViewModel.isVoiceRecording}"
|
||||||
|
android:enabled="@{chatSendingViewModel.isFileTransferAvailable}"
|
||||||
android:src="@drawable/record_audio_message"
|
android:src="@drawable/record_audio_message"
|
||||||
app:layout_constraintHeight_max="@dimen/chat_message_sending_icons_size"
|
app:layout_constraintHeight_max="@dimen/chat_message_sending_icons_size"
|
||||||
app:layout_constraintBottom_toBottomOf="@id/message"
|
app:layout_constraintBottom_toBottomOf="@id/message"
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:layout_width="@dimen/master_fragment_width"
|
android:layout_width="@dimen/master_fragment_width"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
android:background="?attr/backgroundColor"
|
||||||
android:layout_gravity="start">
|
android:layout_gravity="start">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:layout_width="@dimen/master_fragment_width"
|
android:layout_width="@dimen/master_fragment_width"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
android:background="?attr/backgroundColor"
|
||||||
android:layout_gravity="start">
|
android:layout_gravity="start">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:layout_width="@dimen/master_fragment_width"
|
android:layout_width="@dimen/master_fragment_width"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
android:background="?attr/backgroundColor"
|
||||||
android:layout_gravity="start">
|
android:layout_gravity="start">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
|
Loading…
Reference in a new issue