Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Failed image message are not visible on chat #WPB-11035 #3516

Open
wants to merge 2 commits into
base: release/candidate
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ import com.wire.kalium.logic.data.message.DeliveryStatus
import com.wire.kalium.logic.data.message.Message
import com.wire.kalium.logic.data.message.MessageContent
import com.wire.kalium.logic.data.message.MessageContent.Asset
import com.wire.kalium.logic.data.message.hasValidData
import com.wire.kalium.logic.data.user.AssetId
import com.wire.kalium.logic.data.user.SelfUser
import com.wire.kalium.logic.data.user.User
import com.wire.kalium.logic.sync.receiver.conversation.message.hasValidRemoteData
import com.wire.kalium.logic.util.isGreaterThan
import kotlinx.collections.immutable.toPersistentList
import kotlinx.collections.immutable.toPersistentMap
Expand Down Expand Up @@ -239,7 +239,8 @@ class RegularMessageMapper @Inject constructor(
with(assetMessageContentMetadata.assetMessageContent) {
when {
// If some of image data are still missing, we mark it as incomplete which won't be shown until we get missing data
assetMessageContentMetadata.isIncompleteImage() -> {
// But we also check if isnt our own message, if its our own, most likely the there was an error sending the image.
assetMessageContentMetadata.isIncompleteImage() && message.sender != sender -> {
UIMessageContent.IncompleteAssetMessage
}

Expand Down Expand Up @@ -306,7 +307,7 @@ class AssetMessageContentMetadata(val assetMessageContent: AssetContent) {

// Sometimes client receives two events for the same asset, first one with only part of the data ("preview" type from web),
// so such asset shouldn't be shown until all the required data is received.
fun isIncompleteImage(): Boolean = isDisplayableImage() && !assetMessageContent.hasValidRemoteData()
fun isIncompleteImage(): Boolean = isDisplayableImage() && !assetMessageContent.remoteData.hasValidData()
}

private fun String?.orUnknownName(): UIText = when {
Expand Down
Loading