diff --git a/Signal/src/ViewControllers/PhotoLibrary/ImagePickerController.swift b/Signal/src/ViewControllers/PhotoLibrary/ImagePickerController.swift index c753b452c..f48ea7c4a 100644 --- a/Signal/src/ViewControllers/PhotoLibrary/ImagePickerController.swift +++ b/Signal/src/ViewControllers/PhotoLibrary/ImagePickerController.swift @@ -241,12 +241,12 @@ class ImagePickerGridController: UICollectionViewController, PhotoLibraryDelegat isInBatchSelectMode = true for attachment in attachments { - guard let assetId = attachment.sourceId else { + guard let assetId = attachment.assetId else { owsFailDebug("Attachment is missing asset id.") continue } // Link the attachment with its asset to ensure caption continuity. - attachment.sourceId = assetId + attachment.assetId = assetId // Restore any existing caption for this attachment. attachment.captionText = assetIdToCommentMap[assetId] } @@ -349,7 +349,6 @@ class ImagePickerGridController: UICollectionViewController, PhotoLibraryDelegat if isInBatchSelectMode { updateDoneButton() } else { - let asset = photoCollectionContents.asset(at: indexPath.row) complete(withAssets: [asset]) } } @@ -404,7 +403,7 @@ class ImagePickerGridController: UICollectionViewController, PhotoLibraryDelegat func attachmentApproval(_ attachmentApproval: AttachmentApprovalViewController, changedCaptionOfAttachment attachment: SignalAttachment) { AssertIsOnMainThread() - guard let assetId = attachment.sourceId else { + guard let assetId = attachment.assetId else { owsFailDebug("Attachment missing source id.") return } diff --git a/Signal/src/ViewControllers/PhotoLibrary/PhotoLibrary.swift b/Signal/src/ViewControllers/PhotoLibrary/PhotoLibrary.swift index 9fd41b896..bbcbc45dc 100644 --- a/Signal/src/ViewControllers/PhotoLibrary/PhotoLibrary.swift +++ b/Signal/src/ViewControllers/PhotoLibrary/PhotoLibrary.swift @@ -151,13 +151,13 @@ class PhotoCollectionContents { case .image: return requestImageDataSource(for: asset).map { (dataSource: DataSource, dataUTI: String) in let attachment = SignalAttachment.attachment(dataSource: dataSource, dataUTI: dataUTI, imageQuality: .medium) - attachment.sourceId = asset.localIdentifier + attachment.assetId = asset.localIdentifier return attachment } case .video: return requestVideoDataSource(for: asset).map { (dataSource: DataSource, dataUTI: String) in let attachment = SignalAttachment.attachment(dataSource: dataSource, dataUTI: dataUTI) - attachment.sourceId = asset.localIdentifier + attachment.assetId = asset.localIdentifier return attachment } default: diff --git a/SignalMessaging/attachments/SignalAttachment.swift b/SignalMessaging/attachments/SignalAttachment.swift index 972962f03..8f5320244 100644 --- a/SignalMessaging/attachments/SignalAttachment.swift +++ b/SignalMessaging/attachments/SignalAttachment.swift @@ -160,9 +160,9 @@ public class SignalAttachment: NSObject { @objc public let dataUTI: String - // Can be used by views to link this SignalAttachment with an arbitrary source. + // Can be used by views to link this SignalAttachment with an Photos framework asset. @objc - public var sourceId: String? + public var assetId: String? var error: SignalAttachmentError? { didSet {