Remove multi listener for file transfer
This commit is contained in:
parent
7f2b3e9f5e
commit
99d9ec8508
1 changed files with 3 additions and 4 deletions
|
@ -76,14 +76,13 @@ class ChatMessageContentViewModel(
|
|||
val percent = offset * 100 / total
|
||||
Log.d("[Content] Download progress is: $offset / $total ($percent%)")
|
||||
downloadProgress.postValue(percent)
|
||||
|
||||
if (offset == total) {
|
||||
chatMessage.removeListener(this)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onMsgStateChanged(message: ChatMessage, state: ChatMessage.State) {
|
||||
if (state == ChatMessage.State.FileTransferDone || state == ChatMessage.State.FileTransferError) {
|
||||
message.removeListener(this)
|
||||
}
|
||||
downloadEnabled.postValue(chatMessage.state != ChatMessage.State.FileTransferInProgress)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue