@@ -323,13 +323,13 @@ public open class AttachmentQueue(
323323 @Throws(PowerSyncException ::class , CancellationException ::class )
324324 public open suspend fun processWatchedAttachments (items : List <WatchedAttachmentItem >): Unit =
325325 runWrapped {
326- /* *
326+ /*
327327 * Use a lock here to prevent conflicting state updates.
328328 */
329329 attachmentsService.withContext { attachmentsContext ->
330330 logger.v { " processWatchedAttachments($items )" }
331331
332- /* *
332+ /*
333333 * Need to get all the attachments which are tracked in the DB.
334334 * We might need to restore an archived attachment.
335335 */
@@ -370,7 +370,7 @@ public open class AttachmentQueue(
370370 existingQueueItem.copy(state = AttachmentState .SYNCED ),
371371 )
372372 } else {
373- /* *
373+ /*
374374 * The localURI should be set if the record was meant to be downloaded
375375 * and has been synced. If it's missing and hasSynced is false then
376376 * it must be an upload operation.
@@ -389,7 +389,7 @@ public open class AttachmentQueue(
389389 }
390390 }
391391
392- /* *
392+ /*
393393 * Archive any items not specified in the watched items.
394394 * For QUEUED_DELETE or QUEUED_UPLOAD states, archive only if hasSynced is true.
395395 * For other states, archive if the record is not found in the items.
@@ -402,6 +402,7 @@ public open class AttachmentQueue(
402402 when (attachment.state) {
403403 // Archive these record if they have synced
404404 AttachmentState .QUEUED_DELETE , AttachmentState .QUEUED_UPLOAD -> attachment.hasSynced
405+
405406 // Other states, such as QUEUED_DOWNLOAD can be archived if they are not present in watched items
406407 else -> true
407408 }
@@ -446,7 +447,7 @@ public open class AttachmentQueue(
446447 // Write the file to the filesystem.
447448 val fileSize = localStorage.saveFile(localUri, data)
448449
449- /* *
450+ /*
450451 * Starts a write transaction. The attachment record and relevant local relationship
451452 * assignment should happen in the same transaction.
452453 */
@@ -463,7 +464,7 @@ public open class AttachmentQueue(
463464 metaData = metaData,
464465 )
465466
466- /* *
467+ /*
467468 * Allow consumers to set relationships to this attachment ID.
468469 */
469470 updateHook.invoke(tx, attachment)
@@ -549,7 +550,7 @@ public open class AttachmentQueue(
549550 }
550551 val exists = localStorage.fileExists(attachment.localUri)
551552 if (
552- attachment.state == AttachmentState .SYNCED || attachment.state == AttachmentState .QUEUED_UPLOAD && ! exists
553+ ( attachment.state == AttachmentState .SYNCED || attachment.state == AttachmentState .QUEUED_UPLOAD ) && ! exists
553554 ) {
554555 updates.add(
555556 attachment.copy(
0 commit comments