Skip to content

Commit

Permalink
Merge pull request #2027 from Infomaniak/update-sentry
Browse files Browse the repository at this point in the history
Update Attachments Sentry padding
  • Loading branch information
KevinBoulongne authored Sep 2, 2024
2 parents 2682435 + a7b5f19 commit 991b8ce
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,10 @@ class Attachment : EmbeddedRealmObject, Attachable {
* After uploading an Attachment, we replace the local version with the remote one.
* The remote one doesn't know about local data, so we have to backup them.
*/
fun backupLocalData(oldAttachment: Attachment, uploadStatus: UploadStatus, draft: Draft) {
fun backupLocalData(oldAttachment: Attachment, draft: Draft) {
localUuid = oldAttachment.localUuid
uploadLocalUri = oldAttachment.uploadLocalUri
setUploadStatus(uploadStatus, draft, "backupLocalData -> setUploadStatus")
setUploadStatus(UploadStatus.FINISHED, draft, "backupLocalData -> setUploadStatus")
}

fun setUploadStatus(uploadStatus: UploadStatus, draft: Draft? = null, step: String = "") {
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/com/infomaniak/mail/utils/SentryDebug.kt
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ object SentryDebug {
fun Int.countPadding(): String = toString().padStart(length = 2, '0')

fun addData(category: String, key: String = "", value: String) {
data[count.countPadding() + "." + category.padStart(length = 15) + key] = value
data[count.countPadding() + "." + (category + key).padStart(length = 19)] = value
count++
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ import com.infomaniak.mail.R
import com.infomaniak.mail.data.api.ApiRoutes
import com.infomaniak.mail.data.cache.mailboxContent.DraftController
import com.infomaniak.mail.data.models.Attachment
import com.infomaniak.mail.data.models.Attachment.UploadStatus
import com.infomaniak.mail.data.models.mailbox.Mailbox
import com.infomaniak.mail.ui.main.SnackbarManager
import com.infomaniak.mail.ui.main.thread.actions.DownloadAttachmentProgressDialogArgs
Expand Down Expand Up @@ -191,7 +190,7 @@ object AttachmentExtensions {
SentryLog.d(ATTACHMENT_TAG, "When removing uploaded attachment, we found (uuids to localUris): $uuidToLocalUri")
SentryLog.d(ATTACHMENT_TAG, "Target uploadLocalUri is: $uploadLocalUri")

remoteAttachment.backupLocalData(oldAttachment = this@updateLocalAttachment, UploadStatus.FINISHED, draft)
remoteAttachment.backupLocalData(oldAttachment = this@updateLocalAttachment, draft)

SentryLog.d(ATTACHMENT_TAG, "Uploaded attachment uuid: ${remoteAttachment.uuid}")
SentryLog.d(ATTACHMENT_TAG, "Uploaded attachment localUuid: ${remoteAttachment.localUuid}")
Expand Down

0 comments on commit 991b8ce

Please sign in to comment.