From 8701f68292ac69d8aa1b600398a67a9561ef1184 Mon Sep 17 00:00:00 2001 From: jubb Date: Thu, 1 Jul 2021 13:43:48 +1000 Subject: [PATCH 1/2] fix: prevent crash in audio view --- .../securesms/conversation/v2/messages/VoiceMessageView.kt | 4 +++- .../session/libsession/messaging/jobs/AttachmentUploadJob.kt | 2 +- .../org/session/libsession/messaging/jobs/MessageSendJob.kt | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/messages/VoiceMessageView.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/messages/VoiceMessageView.kt index b5fea727c7..b957b0a166 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/messages/VoiceMessageView.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/messages/VoiceMessageView.kt @@ -45,7 +45,9 @@ class VoiceMessageView : LinearLayout, AudioSlidePlayer.Listener { val player = AudioSlidePlayer.createFor(context, audio, this) this.player = player isPreparing = true - player.play(0.0) + if (!audio.isPendingDownload && !audio.isInProgress) { + player.play(0.0) + } voiceMessageViewLoader.isVisible = audio.isPendingDownload val cornerRadii = MessageBubbleUtilities.calculateRadii(context, isStartOfMessageCluster, isEndOfMessageCluster, message.isOutgoing) cornerMask.setTopLeftRadius(cornerRadii[0]) diff --git a/libsession/src/main/java/org/session/libsession/messaging/jobs/AttachmentUploadJob.kt b/libsession/src/main/java/org/session/libsession/messaging/jobs/AttachmentUploadJob.kt index e4cc76974f..11d9298428 100644 --- a/libsession/src/main/java/org/session/libsession/messaging/jobs/AttachmentUploadJob.kt +++ b/libsession/src/main/java/org/session/libsession/messaging/jobs/AttachmentUploadJob.kt @@ -33,7 +33,7 @@ class AttachmentUploadJob(val attachmentID: Long, val threadID: String, val mess } // Settings - override val maxFailureCount: Int = 20 + override val maxFailureCount: Int = 2 companion object { val TAG = AttachmentUploadJob::class.simpleName diff --git a/libsession/src/main/java/org/session/libsession/messaging/jobs/MessageSendJob.kt b/libsession/src/main/java/org/session/libsession/messaging/jobs/MessageSendJob.kt index 274f11c3e3..7d25debe40 100644 --- a/libsession/src/main/java/org/session/libsession/messaging/jobs/MessageSendJob.kt +++ b/libsession/src/main/java/org/session/libsession/messaging/jobs/MessageSendJob.kt @@ -22,7 +22,7 @@ class MessageSendJob(val message: Message, val destination: Destination) : Job { override var id: String? = null override var failureCount: Int = 0 - override val maxFailureCount: Int = 10 + override val maxFailureCount: Int = 2 companion object { val TAG = MessageSendJob::class.simpleName From 9566120d662340023b88f73390f757e84eb42e33 Mon Sep 17 00:00:00 2001 From: jubb Date: Thu, 1 Jul 2021 13:45:14 +1000 Subject: [PATCH 2/2] fix: revert max failure count on upload and send jobs --- .../session/libsession/messaging/jobs/AttachmentUploadJob.kt | 2 +- .../org/session/libsession/messaging/jobs/MessageSendJob.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libsession/src/main/java/org/session/libsession/messaging/jobs/AttachmentUploadJob.kt b/libsession/src/main/java/org/session/libsession/messaging/jobs/AttachmentUploadJob.kt index 11d9298428..e4cc76974f 100644 --- a/libsession/src/main/java/org/session/libsession/messaging/jobs/AttachmentUploadJob.kt +++ b/libsession/src/main/java/org/session/libsession/messaging/jobs/AttachmentUploadJob.kt @@ -33,7 +33,7 @@ class AttachmentUploadJob(val attachmentID: Long, val threadID: String, val mess } // Settings - override val maxFailureCount: Int = 2 + override val maxFailureCount: Int = 20 companion object { val TAG = AttachmentUploadJob::class.simpleName diff --git a/libsession/src/main/java/org/session/libsession/messaging/jobs/MessageSendJob.kt b/libsession/src/main/java/org/session/libsession/messaging/jobs/MessageSendJob.kt index 7d25debe40..274f11c3e3 100644 --- a/libsession/src/main/java/org/session/libsession/messaging/jobs/MessageSendJob.kt +++ b/libsession/src/main/java/org/session/libsession/messaging/jobs/MessageSendJob.kt @@ -22,7 +22,7 @@ class MessageSendJob(val message: Message, val destination: Destination) : Job { override var id: String? = null override var failureCount: Int = 0 - override val maxFailureCount: Int = 2 + override val maxFailureCount: Int = 10 companion object { val TAG = MessageSendJob::class.simpleName