public fun deleteCurrentImage(currentImage: Attachment) {val attachments = message.attachmentsval numberOfAttachments = attachments.sizeif (message.text.isNotEmpty() || numberOfAttachments > 1) {val imageUrl = currentImage.assetUrl ?: currentImage.imageUrlval message = message attachments.removeAll { it.assetUrl == imageUrl || it.imageUrl == imageUrl} chatClient.updateMessage(message).enqueue()} else if (message.text.isEmpty() && numberOfAttachments == 1) { chatClient.deleteMessage(message.id).enqueue { result ->if (result.isSuccess) { message = result.data()}}}}
Deletes the current image from the message we're observing, if possible. This will in turn update the UI accordingly or finish this screen in case there are no more images to show.