Skip to content

Commit

Permalink
[PBE-5896] Fix/async voice compose render (#5395)
Browse files Browse the repository at this point in the history
* Remove local uploadId property after the attachment is updated

* Reorder attachmentFactories to ensure async-voice attachment is not used by wrong factory

* Update CHANGELOG.md

---------

Co-authored-by: kanat <kijalbaev@gmail.com>
  • Loading branch information
JcMinarro and kanat authored Sep 6, 2024
1 parent 8d9ff3c commit 7d67509
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
### 🐞 Fixed

### ⬆️ Improved
- `Attachment.uploadId` is only used locally and removed whenever the attachments are uploaded. [#5395](https://github.com/GetStream/stream-chat-android/pull/5395)

### ✅ Added

Expand Down Expand Up @@ -68,6 +69,7 @@

## stream-chat-android-compose
### 🐞 Fixed
- Fix condition to show async-voice attachments on MessageList. [#5395](https://github.com/GetStream/stream-chat-android/pull/5395)

### ⬆️ Improved

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package io.getstream.chat.android.client.attachment

import android.webkit.MimeTypeMap
import io.getstream.chat.android.client.ChatClient
import io.getstream.chat.android.client.extensions.EXTRA_UPLOAD_ID
import io.getstream.chat.android.client.extensions.uploadId
import io.getstream.chat.android.client.uploader.StreamCdnImageMimeTypes
import io.getstream.chat.android.client.utils.ProgressCallback
Expand Down Expand Up @@ -266,7 +267,7 @@ public class AttachmentUploader(private val client: ChatClient = ChatClient.inst
else -> imageUrl
},
assetUrl = uploadedFile.file,
extraData = extraData + uploadedFile.extraData,
extraData = (extraData + uploadedFile.extraData) - EXTRA_UPLOAD_ID,
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ internal class AttachmentUploaderTests {
name = attachment.upload!!.name,
title = attachment.upload!!.name,
uploadState = Attachment.UploadState.Success,
extraData = attachment.extraData - EXTRA_UPLOAD_ID,
)
val result = sut.uploadAttachment(channelType, channelId, attachment)
result.shouldBeInstanceOf(Result.Success::class)
Expand All @@ -150,6 +151,7 @@ internal class AttachmentUploaderTests {
name = attachment.upload!!.name,
title = attachment.upload!!.name,
uploadState = Attachment.UploadState.Success,
extraData = attachment.extraData - EXTRA_UPLOAD_ID,
)
val result = sut.uploadAttachment(
channelType,
Expand Down

0 comments on commit 7d67509

Please sign in to comment.