Skip to content

Commit

Permalink
fix: Crash during asset sharing [WPB-10700] (#3518)
Browse files Browse the repository at this point in the history
Co-authored-by: yamilmedina <[email protected]>
  • Loading branch information
borichellow and yamilmedina authored Oct 21, 2024
1 parent df8040c commit 8ecd559
Showing 1 changed file with 21 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -290,22 +290,27 @@ class SendMessageViewModel @Inject constructor(
attachmentBundle?.run {
when (assetType) {
AttachmentType.IMAGE -> {
val (imgWidth, imgHeight) = imageUtil.extractImageWidthAndHeight(
kaliumFileSystem,
attachmentBundle.dataPath
)
sendAssetMessage(
conversationId = conversationId,
assetDataPath = dataPath,
assetName = fileName,
assetWidth = imgWidth,
assetHeight = imgHeight,
assetDataSize = dataSize,
assetMimeType = mimeType,
audioLengthInMs = 0L
)
.handleLegalHoldFailureAfterSendingMessage(conversationId)
.handleAssetContributionEvent(assetType)
if (kaliumFileSystem.exists(attachmentBundle.dataPath)) {
val (imgWidth, imgHeight) = imageUtil.extractImageWidthAndHeight(
kaliumFileSystem,
attachmentBundle.dataPath
)
sendAssetMessage(
conversationId = conversationId,
assetDataPath = dataPath,
assetName = fileName,
assetWidth = imgWidth,
assetHeight = imgHeight,
assetDataSize = dataSize,
assetMimeType = mimeType,
audioLengthInMs = 0L
)
.handleLegalHoldFailureAfterSendingMessage(conversationId)
.handleAssetContributionEvent(assetType)
} else {
appLogger.e("There was a FileNotFoundException error while sending image asset")
onSnackbarMessage(ConversationSnackbarMessages.ErrorSendingImage)
}
}

AttachmentType.VIDEO,
Expand Down

0 comments on commit 8ecd559

Please sign in to comment.