|
|
@ -81,12 +81,27 @@ class PhotoCollectionPickerController: OWSTableViewController, PhotoLibraryDeleg
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// MARK: -
|
|
|
|
|
|
|
|
|
|
|
|
private func updateContents() {
|
|
|
|
private func updateContents() {
|
|
|
|
photoCollections = library.allPhotoCollections()
|
|
|
|
photoCollections = library.allPhotoCollections()
|
|
|
|
|
|
|
|
|
|
|
|
let section = OWSTableSection()
|
|
|
|
let sectionItems = photoCollections.map { collection in
|
|
|
|
for collection in photoCollections {
|
|
|
|
return OWSTableItem(customCellBlock: { self.buildTableCell(collection: collection) },
|
|
|
|
section.add(OWSTableItem.init(customCellBlock: { () -> UITableViewCell in
|
|
|
|
customRowHeight: UITableViewAutomaticDimension,
|
|
|
|
|
|
|
|
actionBlock: { [weak self] in
|
|
|
|
|
|
|
|
guard let strongSelf = self else { return }
|
|
|
|
|
|
|
|
strongSelf.didSelectCollection(collection: collection)
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let section = OWSTableSection(title: nil, items: sectionItems)
|
|
|
|
|
|
|
|
let contents = OWSTableContents()
|
|
|
|
|
|
|
|
contents.addSection(section)
|
|
|
|
|
|
|
|
self.contents = contents
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func buildTableCell(collection: PhotoCollection) -> UITableViewCell {
|
|
|
|
let cell = OWSTableItem.newCell()
|
|
|
|
let cell = OWSTableItem.newCell()
|
|
|
|
|
|
|
|
|
|
|
|
cell.backgroundColor = .ows_gray95
|
|
|
|
cell.backgroundColor = .ows_gray95
|
|
|
@ -126,16 +141,6 @@ class PhotoCollectionPickerController: OWSTableViewController, PhotoLibraryDeleg
|
|
|
|
stackView.ows_autoPinToSuperviewMargins()
|
|
|
|
stackView.ows_autoPinToSuperviewMargins()
|
|
|
|
|
|
|
|
|
|
|
|
return cell
|
|
|
|
return cell
|
|
|
|
},
|
|
|
|
|
|
|
|
customRowHeight: UITableViewAutomaticDimension,
|
|
|
|
|
|
|
|
actionBlock: { [weak self] in
|
|
|
|
|
|
|
|
guard let strongSelf = self else { return }
|
|
|
|
|
|
|
|
strongSelf.didSelectCollection(collection: collection)
|
|
|
|
|
|
|
|
}))
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
let contents = OWSTableContents()
|
|
|
|
|
|
|
|
contents.addSection(section)
|
|
|
|
|
|
|
|
self.contents = contents
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@objc
|
|
|
|
@objc
|
|
|
|