Refactor and simplify attachment archiving.

This commit is contained in:
Greyson Parrelli
2024-09-12 10:58:48 -04:00
committed by Cody Henthorne
parent 816006c67e
commit e80ebd87fe
23 changed files with 627 additions and 481 deletions

View File

@@ -38,6 +38,9 @@ class DatabaseAttachment : Attachment {
@JvmField
val thumbnailRestoreState: AttachmentTable.ThumbnailRestoreState
@JvmField
val archiveTransferState: AttachmentTable.ArchiveTransferState
private val hasArchiveThumbnail: Boolean
private val hasThumbnail: Boolean
val displayOrder: Int
@@ -78,6 +81,7 @@ class DatabaseAttachment : Attachment {
archiveMediaName: String?,
archiveMediaId: String?,
thumbnailRestoreState: AttachmentTable.ThumbnailRestoreState,
archiveTransferState: AttachmentTable.ArchiveTransferState,
uuid: UUID?
) : super(
contentType = contentType,
@@ -116,6 +120,7 @@ class DatabaseAttachment : Attachment {
this.archiveMediaName = archiveMediaName
this.archiveMediaId = archiveMediaId
this.thumbnailRestoreState = thumbnailRestoreState
this.archiveTransferState = archiveTransferState
}
constructor(parcel: Parcel) : super(parcel) {
@@ -130,6 +135,7 @@ class DatabaseAttachment : Attachment {
archiveMediaId = parcel.readString()
hasArchiveThumbnail = ParcelUtil.readBoolean(parcel)
thumbnailRestoreState = AttachmentTable.ThumbnailRestoreState.deserialize(parcel.readInt())
archiveTransferState = AttachmentTable.ArchiveTransferState.deserialize(parcel.readInt())
}
override fun writeToParcel(dest: Parcel, flags: Int) {
@@ -145,6 +151,7 @@ class DatabaseAttachment : Attachment {
dest.writeString(archiveMediaId)
ParcelUtil.writeBoolean(dest, hasArchiveThumbnail)
dest.writeInt(thumbnailRestoreState.value)
dest.writeInt(archiveTransferState.value)
}
override val uri: Uri?