Skip to content

Commit 6cc9426

Browse files
lividclaude
andcommitted
Add Revert to Original flow and compression status report for Writer video
Allow users to revert a compressed video to the original and try a different preset. The original is backed up to temp storage when disk space permits (10x headroom). After compression, a summary row shows size reduction, elapsed time, and average fps. Backup and summary are cleaned up on revert, delete, or window close. Disk space is checked before compression with a blocking alert when insufficient. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 0caaac3 commit 6cc9426

7 files changed

Lines changed: 447 additions & 35 deletions

File tree

Planet/Entities/DraftModel.swift

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,10 +342,23 @@ class DraftModel: Identifiable, Equatable, Hashable, Codable, ObservableObject {
342342
_ attachment: Attachment,
343343
withCompressedVideoAt compressedURL: URL,
344344
compressionPreset: String
345+
) throws -> Attachment {
346+
try replaceVideoAttachment(
347+
attachment,
348+
withVideoAt: compressedURL,
349+
compressionPreset: compressionPreset
350+
)
351+
}
352+
353+
@discardableResult
354+
func replaceVideoAttachment(
355+
_ attachment: Attachment,
356+
withVideoAt videoURL: URL,
357+
compressionPreset: String?
345358
) throws -> Attachment {
346359
let oldName = attachment.name
347360
let oldPath = attachment.path
348-
let newAttachment = try addAttachment(path: compressedURL, type: .video)
361+
let newAttachment = try addAttachment(path: videoURL, type: .video)
349362
newAttachment.videoCompressionPreset = compressionPreset
350363

351364
if oldName != newAttachment.name {

0 commit comments

Comments
 (0)