mirror of
https://github.com/oxen-io/session-android.git
synced 2025-01-11 16:33:39 +00:00
fix: only show loader if the message isn't failed, fix attachment upload and message send pending states in the conversation
This commit is contained in:
parent
ab876ca9b8
commit
d98f34fa73
@ -149,9 +149,5 @@ public class AlbumThumbnailView extends FrameLayout {
|
||||
}
|
||||
|
||||
private void setSlide(@NonNull GlideRequests glideRequests, @NonNull Slide slide, @IdRes int id) {
|
||||
KThumbnailView cell = findViewById(id);
|
||||
cell.setImageResource(glideRequests, slide, false);
|
||||
cell.setThumbnailClickListener(defaultThumbnailClickListener);
|
||||
cell.setOnLongClickListener(defaultLongClickListener);
|
||||
}
|
||||
}
|
||||
|
@ -1182,6 +1182,11 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
|
||||
}
|
||||
message.addSignalAttachments(mmsMessageRecord.slideDeck.asAttachments())
|
||||
}
|
||||
val sentTimestamp = message.sentTimestamp
|
||||
val sender = MessagingModuleConfiguration.shared.storage.getUserPublicKey()
|
||||
if (sentTimestamp != null && sender != null) {
|
||||
MessagingModuleConfiguration.shared.storage.markAsSending(sentTimestamp, sender)
|
||||
}
|
||||
MessageSender.send(message, recipient.address)
|
||||
}
|
||||
endActionMode()
|
||||
|
@ -115,7 +115,7 @@ class AlbumThumbnailView : FrameLayout {
|
||||
// iterate binding
|
||||
slides.take(5).forEachIndexed { position, slide ->
|
||||
val thumbnailView = getThumbnailView(position)
|
||||
thumbnailView.setImageResource(glideRequests, slide, isPreview = false)
|
||||
thumbnailView.setImageResource(glideRequests, slide, isPreview = false, mms = message)
|
||||
}
|
||||
albumCellBodyParent.isVisible = message.body.isNotEmpty()
|
||||
albumCellBodyText.text = message.body
|
||||
|
@ -48,7 +48,7 @@ class LinkPreviewView : LinearLayout {
|
||||
// Thumbnail
|
||||
if (linkPreview.getThumbnail().isPresent) {
|
||||
// This internally fetches the thumbnail
|
||||
thumbnailImageView.setImageResource(glide, ImageSlide(context, linkPreview.getThumbnail().get()), isPreview = false)
|
||||
thumbnailImageView.setImageResource(glide, ImageSlide(context, linkPreview.getThumbnail().get()), isPreview = false, message)
|
||||
thumbnailImageView.loadIndicator.isVisible = false
|
||||
}
|
||||
// Title
|
||||
|
@ -21,9 +21,9 @@ import org.session.libsignal.utilities.ListenableFuture
|
||||
import org.session.libsignal.utilities.SettableFuture
|
||||
import org.thoughtcrime.securesms.components.GlideBitmapListeningTarget
|
||||
import org.thoughtcrime.securesms.components.GlideDrawableListeningTarget
|
||||
import org.thoughtcrime.securesms.database.model.MmsMessageRecord
|
||||
import org.thoughtcrime.securesms.mms.*
|
||||
import org.thoughtcrime.securesms.mms.DecryptableStreamUriLoader.DecryptableUri
|
||||
import org.thoughtcrime.securesms.util.MediaUtil
|
||||
|
||||
open class KThumbnailView: FrameLayout {
|
||||
|
||||
@ -43,8 +43,6 @@ open class KThumbnailView: FrameLayout {
|
||||
|
||||
private val dimensDelegate = ThumbnailDimensDelegate()
|
||||
|
||||
var thumbnailClickListener: SlideClickListener? = null
|
||||
|
||||
private var slide: Slide? = null
|
||||
private var radius: Int = 0
|
||||
|
||||
@ -84,13 +82,13 @@ open class KThumbnailView: FrameLayout {
|
||||
// endregion
|
||||
|
||||
// region Interaction
|
||||
fun setImageResource(glide: GlideRequests, slide: Slide, isPreview: Boolean): ListenableFuture<Boolean> {
|
||||
return setImageResource(glide, slide, isPreview, 0, 0)
|
||||
fun setImageResource(glide: GlideRequests, slide: Slide, isPreview: Boolean, mms: MmsMessageRecord): ListenableFuture<Boolean> {
|
||||
return setImageResource(glide, slide, isPreview, 0, 0, mms)
|
||||
}
|
||||
|
||||
fun setImageResource(glide: GlideRequests, slide: Slide,
|
||||
isPreview: Boolean, naturalWidth: Int,
|
||||
naturalHeight: Int): ListenableFuture<Boolean> {
|
||||
naturalHeight: Int, mms: MmsMessageRecord): ListenableFuture<Boolean> {
|
||||
|
||||
val currentSlide = this.slide
|
||||
|
||||
@ -110,7 +108,7 @@ open class KThumbnailView: FrameLayout {
|
||||
|
||||
this.slide = slide
|
||||
|
||||
loadIndicator.isVisible = slide.isInProgress
|
||||
loadIndicator.isVisible = slide.isInProgress && !mms.isFailed
|
||||
|
||||
dimensDelegate.setDimens(naturalWidth, naturalHeight)
|
||||
invalidate()
|
||||
|
@ -122,7 +122,7 @@ class AttachmentUploadJob(val attachmentID: Long, val threadID: String, val mess
|
||||
private fun handleFailure(e: Exception) {
|
||||
Log.w(TAG, "Attachment upload failed due to error: $this.")
|
||||
delegate?.handleJobFailed(this, e)
|
||||
if (failureCount + 1 == maxFailureCount) {
|
||||
if (failureCount + 1 >= maxFailureCount) {
|
||||
failAssociatedMessageSendJob(e)
|
||||
}
|
||||
}
|
||||
|
@ -37,6 +37,13 @@ class MessageSendJob(val message: Message, val destination: Destination) : Job {
|
||||
val messageDataProvider = MessagingModuleConfiguration.shared.messageDataProvider
|
||||
val message = message as? VisibleMessage
|
||||
val storage = MessagingModuleConfiguration.shared.storage
|
||||
|
||||
val sentTimestamp = this.message.sentTimestamp
|
||||
val sender = storage.getUserPublicKey()
|
||||
if (sentTimestamp != null && sender != null) {
|
||||
storage.markAsSending(sentTimestamp, sender)
|
||||
}
|
||||
|
||||
if (message != null) {
|
||||
if (!messageDataProvider.isOutgoingMessage(message.sentTimestamp!!)) return // The message has been deleted
|
||||
val attachmentIDs = mutableListOf<Long>()
|
||||
@ -58,11 +65,6 @@ class MessageSendJob(val message: Message, val destination: Destination) : Job {
|
||||
return
|
||||
} // Wait for all attachments to upload before continuing
|
||||
}
|
||||
val sentTimestamp = this.message.sentTimestamp
|
||||
val sender = storage.getUserPublicKey()
|
||||
if (sentTimestamp != null && sender != null) {
|
||||
storage.markAsSending(sentTimestamp, sender)
|
||||
}
|
||||
val promise = MessageSender.send(this.message, this.destination).success {
|
||||
this.handleSuccess()
|
||||
}.fail { exception ->
|
||||
|
Loading…
x
Reference in New Issue
Block a user