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 {
|
private val conversationMessageListener = object : SignalingMessageReceiver.ConversationMessageListener {
|
||||||
override fun onStartTyping(session: String) {
|
override fun onStartTyping(session: String) {
|
||||||
|
if (!CapabilitiesUtilNew.isTypingStatusPrivate(conversationUser!!)) {
|
||||||
var name = webSocketInstance?.getDisplayNameForSession(session)
|
var name = webSocketInstance?.getDisplayNameForSession(session)
|
||||||
|
|
||||||
if (name != null && !typingParticipants.contains(session)) {
|
if (name != null && !typingParticipants.contains(session)) {
|
||||||
@ -333,12 +334,15 @@ class ChatActivity :
|
|||||||
updateTypingIndicator()
|
updateTypingIndicator()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override fun onStopTyping(session: String) {
|
override fun onStopTyping(session: String) {
|
||||||
|
if (!CapabilitiesUtilNew.isTypingStatusPrivate(conversationUser!!)) {
|
||||||
typingParticipants.remove(session)
|
typingParticipants.remove(session)
|
||||||
updateTypingIndicator()
|
updateTypingIndicator()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun updateTypingIndicator() {
|
private fun updateTypingIndicator() {
|
||||||
val participantNames = ArrayList(typingParticipants.values)
|
val participantNames = ArrayList(typingParticipants.values)
|
||||||
@ -396,7 +400,6 @@ class ChatActivity :
|
|||||||
.translationY(binding.messageInputView.y - typingIndicatorHeight)
|
.translationY(binding.messageInputView.y - typingIndicatorHeight)
|
||||||
.setInterpolator(AccelerateDecelerateInterpolator())
|
.setInterpolator(AccelerateDecelerateInterpolator())
|
||||||
.duration = TYPING_INDICATOR_ANIMATION_DURATION
|
.duration = TYPING_INDICATOR_ANIMATION_DURATION
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
binding.typingIndicatorWrapper.animate()
|
binding.typingIndicatorWrapper.animate()
|
||||||
.translationY(binding.messageInputView.y)
|
.translationY(binding.messageInputView.y)
|
||||||
@ -733,6 +736,7 @@ class ChatActivity :
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!CapabilitiesUtilNew.isTypingStatusPrivate(conversationUser!!)) {
|
||||||
if (typingTimer == null) {
|
if (typingTimer == null) {
|
||||||
for ((sessionId, participant) in webSocketInstance?.getUserMap()!!) {
|
for ((sessionId, participant) in webSocketInstance?.getUserMap()!!) {
|
||||||
val ncSignalingMessage = NCSignalingMessage()
|
val ncSignalingMessage = NCSignalingMessage()
|
||||||
@ -755,6 +759,7 @@ class ChatActivity :
|
|||||||
typingTimer?.start()
|
typingTimer?.start()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun sendStopTypingMessage() {
|
fun sendStopTypingMessage() {
|
||||||
for ((sessionId, participant) in webSocketInstance?.getUserMap()!!) {
|
for ((sessionId, participant) in webSocketInstance?.getUserMap()!!) {
|
||||||
|
@ -103,7 +103,7 @@ object CapabilitiesUtilNew {
|
|||||||
|
|
||||||
fun isTypingStatusAvailable(user: User): Boolean {
|
fun isTypingStatusAvailable(user: User): Boolean {
|
||||||
if (user.capabilities?.spreedCapability?.config?.containsKey("chat") == true) {
|
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 map != null && map.containsKey("typing-privacy")
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
|
Loading…
Reference in New Issue
Block a user