Download thumbnails (#690)

This commit is contained in:
Nathan Mattes 2022-12-15 21:11:14 +01:00
parent 29cd795718
commit d102e090ea
2 changed files with 11 additions and 2 deletions

View File

@ -63,7 +63,13 @@ extension PickServerSection {
]
)
}()
if let proxiedThumbnail = server.proxiedThumbnail, let thumbnailUrl = URL(string: proxiedThumbnail) {
cell.thumbnailImageView.af.setImage(withURL: thumbnailUrl) { _ in
OperationQueue.main.addOperation {
cell.thumbnailImageView.isHidden = false
}
}
}
attribute.isLast
.receive(on: DispatchQueue.main)
.sink { [weak cell] isLast in

View File

@ -31,6 +31,8 @@ class PickServerCell: UITableViewCell {
thumbnail.translatesAutoresizingMaskIntoConstraints = false
thumbnail.backgroundColor = Asset.Colors.brand.color
thumbnail.layer.cornerRadius = 8
thumbnail.contentMode = .scaleAspectFill
thumbnail.layer.masksToBounds = true
return thumbnail
}()
@ -66,7 +68,8 @@ class PickServerCell: UITableViewCell {
override func prepareForReuse() {
super.prepareForReuse()
thumbnailImageView.isHidden = true
thumbnailImageView.image = nil
disposeBag.removeAll()
}