mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-20 03:59:35 +01:00
check capabilities to use/ignore typing indicators
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
parent
d3d8e2abef
commit
231cfef8c3
@ -323,6 +323,7 @@ class ChatActivity :
|
||||
|
||||
private val conversationMessageListener = object : SignalingMessageReceiver.ConversationMessageListener {
|
||||
override fun onStartTyping(session: String) {
|
||||
if (!CapabilitiesUtilNew.isTypingStatusPrivate(conversationUser!!)) {
|
||||
var name = webSocketInstance?.getDisplayNameForSession(session)
|
||||
|
||||
if (name != null && !typingParticipants.contains(session)) {
|
||||
@ -333,12 +334,15 @@ class ChatActivity :
|
||||
updateTypingIndicator()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onStopTyping(session: String) {
|
||||
if (!CapabilitiesUtilNew.isTypingStatusPrivate(conversationUser!!)) {
|
||||
typingParticipants.remove(session)
|
||||
updateTypingIndicator()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateTypingIndicator() {
|
||||
val participantNames = ArrayList(typingParticipants.values)
|
||||
@ -388,7 +392,7 @@ class ChatActivity :
|
||||
}
|
||||
}
|
||||
|
||||
val typingIndicatorHeight = DisplayUtils.convertDpToPixel(20f,context)
|
||||
val typingIndicatorHeight = DisplayUtils.convertDpToPixel(20f, context)
|
||||
|
||||
runOnUiThread {
|
||||
if (participantNames.size > 0) {
|
||||
@ -396,7 +400,6 @@ class ChatActivity :
|
||||
.translationY(binding.messageInputView.y - typingIndicatorHeight)
|
||||
.setInterpolator(AccelerateDecelerateInterpolator())
|
||||
.duration = TYPING_INDICATOR_ANIMATION_DURATION
|
||||
|
||||
} else {
|
||||
binding.typingIndicatorWrapper.animate()
|
||||
.translationY(binding.messageInputView.y)
|
||||
@ -733,6 +736,7 @@ class ChatActivity :
|
||||
return
|
||||
}
|
||||
|
||||
if (!CapabilitiesUtilNew.isTypingStatusPrivate(conversationUser!!)) {
|
||||
if (typingTimer == null) {
|
||||
for ((sessionId, participant) in webSocketInstance?.getUserMap()!!) {
|
||||
val ncSignalingMessage = NCSignalingMessage()
|
||||
@ -755,6 +759,7 @@ class ChatActivity :
|
||||
typingTimer?.start()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun sendStopTypingMessage() {
|
||||
for ((sessionId, participant) in webSocketInstance?.getUserMap()!!) {
|
||||
|
@ -103,7 +103,7 @@ object CapabilitiesUtilNew {
|
||||
|
||||
fun isTypingStatusAvailable(user: User): Boolean {
|
||||
if (user.capabilities?.spreedCapability?.config?.containsKey("chat") == true) {
|
||||
val map: Map<String, Any>? = user.capabilities!!.spreedCapability!!.config!!["chat"]
|
||||
val map = user.capabilities!!.spreedCapability!!.config!!["chat"]
|
||||
return map != null && map.containsKey("typing-privacy")
|
||||
}
|
||||
return false
|
||||
|
Loading…
Reference in New Issue
Block a user