mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-05-06 21:33:09 +00:00
Hide some parts of the UI depending on Core or account configuration
This commit is contained in:
parent
7d7b037741
commit
81f0a9515f
10 changed files with 31 additions and 3 deletions
|
|
@ -123,6 +123,10 @@ class CorePreferences @UiThread constructor(private val context: Context) {
|
|||
val darkModeAllowed: Boolean
|
||||
get() = config.getBool("ui", "dark_mode_allowed", true)
|
||||
|
||||
@get:WorkerThread
|
||||
val onlyDisplaySipUriUsername: Boolean
|
||||
get() = config.getBool("ui", "only_display_sip_uri_username", true)
|
||||
|
||||
@get:WorkerThread
|
||||
val disableChat: Boolean
|
||||
get() = config.getBool("ui", "disable_chat_feature", false)
|
||||
|
|
|
|||
|
|
@ -857,7 +857,7 @@ class ConversationFragment : SlidingPaneChildFragment() {
|
|||
)
|
||||
|
||||
popupView.conversationMuted = viewModel.isMuted.value == true
|
||||
popupView.ephemeralMessagesAvailable = viewModel.isEndToEndEncrypted.value == true || viewModel.isGroup.value == true
|
||||
popupView.ephemeralMessagesAvailable = viewModel.isEndToEndEncrypted.value == true
|
||||
popupView.readOnlyConversation = viewModel.isReadOnly.value == true
|
||||
|
||||
popupView.setGoToInfoClickListener {
|
||||
|
|
|
|||
|
|
@ -54,6 +54,8 @@ class ConversationInfoViewModel @UiThread constructor() : AbstractConversationVi
|
|||
|
||||
val isGroup = MutableLiveData<Boolean>()
|
||||
|
||||
val isEndToEndEncrypted = MutableLiveData<Boolean>()
|
||||
|
||||
val subject = MutableLiveData<String>()
|
||||
|
||||
val sipUri = MutableLiveData<String>()
|
||||
|
|
@ -451,6 +453,9 @@ class ConversationInfoViewModel @UiThread constructor() : AbstractConversationVi
|
|||
|
||||
val isGroupChatRoom = LinphoneUtils.isChatRoomAGroup(chatRoom)
|
||||
isGroup.postValue(isGroupChatRoom)
|
||||
isEndToEndEncrypted.postValue(
|
||||
chatRoom.hasCapability(ChatRoom.Capabilities.Encrypted.toInt())
|
||||
)
|
||||
|
||||
val empty = chatRoom.hasCapability(ChatRoom.Capabilities.Conference.toInt()) && chatRoom.participants.isEmpty()
|
||||
val readOnly = chatRoom.isReadOnly || empty
|
||||
|
|
|
|||
|
|
@ -63,6 +63,8 @@ class SendMessageInConversationViewModel @UiThread constructor() : ViewModel() {
|
|||
|
||||
val textToSend = MutableLiveData<String>()
|
||||
|
||||
val isFileTransferServerAvailable = MutableLiveData<Boolean>()
|
||||
|
||||
val isEmojiPickerOpen = MutableLiveData<Boolean>()
|
||||
|
||||
val isParticipantsListOpen = MutableLiveData<Boolean>()
|
||||
|
|
@ -141,6 +143,10 @@ class SendMessageInConversationViewModel @UiThread constructor() : ViewModel() {
|
|||
}
|
||||
|
||||
init {
|
||||
coreContext.postOnCoreThread { core ->
|
||||
isFileTransferServerAvailable.postValue(!core.fileTransferServer.isNullOrEmpty())
|
||||
}
|
||||
|
||||
isEmojiPickerOpen.value = false
|
||||
isPlayingVoiceRecord.value = false
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,6 +48,10 @@ class HelpViewModel @UiThread constructor() : ViewModel() {
|
|||
|
||||
val printLogInLogcatEnabled = MutableLiveData<Boolean>()
|
||||
|
||||
val checkUpdateAvailable = MutableLiveData<Boolean>()
|
||||
|
||||
val uploadLogsAvailable = MutableLiveData<Boolean>()
|
||||
|
||||
val newVersionAvailableEvent: MutableLiveData<Event<Pair<String, String>>> by lazy {
|
||||
MutableLiveData<Event<Pair<String, String>>>()
|
||||
}
|
||||
|
|
@ -128,6 +132,10 @@ class HelpViewModel @UiThread constructor() : ViewModel() {
|
|||
coreContext.postOnCoreThread { core ->
|
||||
core.addListener(coreListener)
|
||||
printLogInLogcatEnabled.postValue(corePreferences.printLogsInLogcat)
|
||||
|
||||
val checkUpdateServerUrl = core.config.getString("misc", "version_check_url_root", "")
|
||||
checkUpdateAvailable.postValue(!checkUpdateServerUrl.isNullOrEmpty())
|
||||
uploadLogsAvailable.postValue(!core.logCollectionUploadServerUrl.isNullOrEmpty())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -57,6 +57,7 @@ class CardDavAddressBookConfigurationFragment : GenericFragment() {
|
|||
viewModel.cardDavOperationSuccessfulEvent.observe(viewLifecycleOwner) {
|
||||
it.consume {
|
||||
Log.i("$TAG CardDAV friend list operation was successful, going back")
|
||||
// TODO FIXME: show green toast
|
||||
goBack()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -98,6 +98,7 @@
|
|||
android:onClick="@{openFilePickerClickListener}"
|
||||
android:padding="8dp"
|
||||
android:src="@drawable/paperclip"
|
||||
android:visibility="@{viewModel.isFileTransferServerAvailable ? View.VISIBLE : View.GONE}"
|
||||
app:layout_constraintBottom_toBottomOf="@id/message_area_background"
|
||||
app:layout_constraintEnd_toStartOf="@id/capture_image"
|
||||
app:layout_constraintStart_toEndOf="@id/emoji_picker_toggle"
|
||||
|
|
@ -112,6 +113,7 @@
|
|||
android:onClick="@{openCameraClickListener}"
|
||||
android:padding="8dp"
|
||||
android:src="@drawable/camera"
|
||||
android:visibility="@{viewModel.isFileTransferServerAvailable ? View.VISIBLE : View.GONE}"
|
||||
app:layout_constraintBottom_toBottomOf="@id/message_area_background"
|
||||
app:layout_constraintEnd_toStartOf="@id/message_area_background"
|
||||
app:layout_constraintStart_toEndOf="@id/attach_file"
|
||||
|
|
@ -180,7 +182,7 @@
|
|||
android:layout_width="40dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginEnd="4dp"
|
||||
android:visibility="@{viewModel.textToSend.length() > 0 || viewModel.attachments.size() > 0 || viewModel.isVoiceRecording ? View.GONE : View.VISIBLE}"
|
||||
android:visibility="@{viewModel.textToSend.length() > 0 || viewModel.attachments.size() > 0 || viewModel.isVoiceRecording || !viewModel.isFileTransferServerAvailable ? View.GONE : View.VISIBLE}"
|
||||
android:onClick="@{() -> viewModel.startVoiceMessageRecording()}"
|
||||
android:padding="8dp"
|
||||
android:src="@drawable/microphone"
|
||||
|
|
|
|||
|
|
@ -396,7 +396,7 @@
|
|||
android:drawableStart="@drawable/clock_countdown"
|
||||
android:onClick="@{configureEphemeralMessagesClickListener}"
|
||||
android:text="@string/conversation_action_configure_ephemeral_messages"
|
||||
android:visibility="@{!viewModel.isReadOnly ? View.VISIBLE : View.GONE}"
|
||||
android:visibility="@{viewModel.isEndToEndEncrypted && !viewModel.isReadOnly ? View.VISIBLE : View.GONE}"
|
||||
app:layout_constraintEnd_toEndOf="@id/actions_background"
|
||||
app:layout_constraintStart_toStartOf="@id/actions_background"
|
||||
app:layout_constraintTop_toBottomOf="@id/action_add_to_contacts" />
|
||||
|
|
|
|||
|
|
@ -126,6 +126,7 @@
|
|||
android:text="@string/help_troubleshooting_share_logs"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
android:visibility="@{viewModel.uploadLogsAvailable ? View.VISIBLE : View.GONE}"
|
||||
app:layout_constraintStart_toEndOf="@id/clean_logs"
|
||||
app:layout_constraintTop_toBottomOf="@id/print_logs_in_logcat_subtitle"/>
|
||||
|
||||
|
|
|
|||
|
|
@ -171,6 +171,7 @@
|
|||
android:text="@string/help_about_check_for_update"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
android:visibility="@{viewModel.checkUpdateAvailable ? View.VISIBLE : View.GONE}"
|
||||
app:layout_constraintStart_toEndOf="@id/version_title"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/version_title"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue