Respond to CR.

pull/1/head
Matthew Chen 7 years ago
parent 8b24fba095
commit 8eb2550e0c

@ -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
}

@ -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:

@ -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 {

Loading…
Cancel
Save