mirror of
https://github.com/wahyd4/Yep.git
synced 2026-08-16 16:28:45 +10:00
refactor feedURLContainerView.configureWithFeedURLInfoType
This commit is contained in:
@@ -60,16 +60,8 @@ class FeedURLCell: FeedBasicCell {
|
||||
|
||||
if let attachment = feed.attachment {
|
||||
if case let .URL(URLInfo) = attachment {
|
||||
feedURLContainerView.siteNameLabel.text = URLInfo.siteName
|
||||
feedURLContainerView.titleLabel.text = URLInfo.title
|
||||
feedURLContainerView.descriptionLabel.text = URLInfo.description
|
||||
|
||||
if let thumbnailImageURL = NSURL(string: URLInfo.thumbnailImageURLString) {
|
||||
feedURLContainerView.thumbnailImageView.kf_setImageWithURL(thumbnailImageURL, placeholderImage: nil)
|
||||
} else {
|
||||
feedURLContainerView.thumbnailImageView.image = nil
|
||||
feedURLContainerView.thumbnailImageView.backgroundColor = UIColor.lightGrayColor()
|
||||
}
|
||||
feedURLContainerView.configureWithFeedURLInfoType(URLInfo)
|
||||
|
||||
feedURLContainerView.tapAction = { [weak self] in
|
||||
self?.tapURLAction?(URLInfo.URL)
|
||||
|
||||
@@ -125,5 +125,19 @@ class FeedURLContainerView: UIView {
|
||||
@objc private func tap(sender: UITapGestureRecognizer) {
|
||||
tapAction?()
|
||||
}
|
||||
|
||||
func configureWithFeedURLInfoType(URLInfo: FeedURLInfoType) {
|
||||
|
||||
siteNameLabel.text = URLInfo.siteName
|
||||
titleLabel.text = URLInfo.title
|
||||
descriptionLabel.text = URLInfo.infoDescription
|
||||
|
||||
if let thumbnailImageURL = NSURL(string: URLInfo.thumbnailImageURLString) {
|
||||
thumbnailImageView.kf_setImageWithURL(thumbnailImageURL, placeholderImage: nil)
|
||||
} else {
|
||||
thumbnailImageView.image = nil
|
||||
thumbnailImageView.backgroundColor = UIColor.lightGrayColor()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -353,15 +353,7 @@ class FeedView: UIView {
|
||||
socialWorkContainerViewHeightConstraint.constant = 80
|
||||
|
||||
if let URLInfo = feed.URLInfo {
|
||||
feedURLContainerView.siteNameLabel.text = URLInfo.siteName
|
||||
feedURLContainerView.titleLabel.text = URLInfo.title
|
||||
feedURLContainerView.descriptionLabel.text = URLInfo.infoDescription
|
||||
if let thumbnailImageURL = NSURL(string: URLInfo.thumbnailImageURLString) {
|
||||
feedURLContainerView.thumbnailImageView.kf_setImageWithURL(thumbnailImageURL, placeholderImage: nil)
|
||||
} else {
|
||||
feedURLContainerView.thumbnailImageView.image = nil
|
||||
feedURLContainerView.thumbnailImageView.backgroundColor = UIColor.lightGrayColor()
|
||||
}
|
||||
feedURLContainerView.configureWithFeedURLInfoType(URLInfo)
|
||||
}
|
||||
|
||||
case .Image:
|
||||
|
||||
Reference in New Issue
Block a user