





override func awakeFromNib() {
super.awakeFromNib()
guard let adView = nativeAdView else {
return
}
adView.callToActionView?.layer.masksToBounds = true
adView.callToActionView?.layer.cornerRadius = 4
}
func configureCard(adHolder: AdHolder?, font: UIFont){
guard adHolder != nil else {
return
}
guard let adView = nativeAdView else {
return
}
let logHelper = LogHelper(subsystem: "NativeAdCardCell", category: "configure")
let nativeAd = adHolder?.ad
// if let network = nativeAd?.responseInfo.adNetworkClassName {
// logHelper.d(network)
// }
// else {
// logHelper.d("Network not found.")
// }
sponsoredTopView?.textColor = property.ansiColorSet.secondary
sponsoredBottomView?.textColor = property.ansiColorSet.secondary
adView.backgroundColor = property.ansiColorSet.primaryBackground
adView.nativeAd = nativeAd
adView.mediaView?.mediaContent = nativeAd?.mediaContent
(adView.headlineView as? UILabel)?.text = nativeAd?.headline
(adView.headlineView as? UILabel)?.font = font
(adView.headlineView as? UILabel)?.textColor = property.ansiColorSet.primary
adView.headlineView?.isHidden = nativeAd?.headline == nil
(adView.advertiserView as? UILabel)?.text = nativeAd?.advertiser
(adView.advertiserView as? UILabel)?.font = property.fontSet.misc
(adView.advertiserView as? UILabel)?.textColor = property.ansiColorSet.misc
adView.advertiserView?.isHidden = nativeAd?.advertiser == nil
(adView.callToActionView as? UILabel)?.text = nativeAd?.callToAction
adView.callToActionView?.isHidden = nativeAd?.callToAction == nil
(adView.iconView as? UIImageView)?.image = nativeAd?.icon?.image
adView.iconView?.isHidden = nativeAd?.icon == nil
adHolder?.impression = true
}
func configureBanner(adHolder: AdHolder?, font: UIFont){
guard adHolder != nil else {
return
}
guard let adView = nativeAdView else {
return
}
let logHelper = LogHelper(subsystem: "NativeAdBannerCell", category: "configure")
let nativeAd = adHolder?.ad
// if let network = nativeAd?.responseInfo.adNetworkClassName {
// logHelper.d(network)
// }
// else {
// logHelper.d("Network not found.")
// }
adView.backgroundColor = property.ansiColorSet.primaryBackground
adView.nativeAd = nativeAd
(adView.headlineView as? UILabel)?.text = nativeAd?.headline
(adView.headlineView as? UILabel)?.font = font
(adView.headlineView as? UILabel)?.textColor = property.ansiColorSet.primary
adView.headlineView?.isHidden = nativeAd?.headline == nil
(adView.advertiserView as? UILabel)?.text = nativeAd?.advertiser
(adView.advertiserView as? UILabel)?.font = property.fontSet.misc
(adView.advertiserView as? UILabel)?.textColor = property.ansiColorSet.misc
adView.advertiserView?.isHidden = nativeAd?.advertiser == nil
(adView.callToActionView as? UILabel)?.text = nativeAd?.callToAction
adView.callToActionView?.isHidden = nativeAd?.callToAction == nil
(adView.iconView as? UIImageView)?.image = nativeAd?.icon?.image
adView.iconView?.isHidden = nativeAd?.icon == nil
adHolder?.impression = true
}
func tableView(_ tableView: UITableView, willSelectRowAt indexPath: IndexPath) -> IndexPath? {
let model = viewModelController.model(at: indexPath)
return model.adType == .none ? indexPath : nil
}
(adView.bodyView as? UILabel)?.text = nativeAd?.body?.ellipsis(size: 90)
adView.bodyView?.isHidden = nativeAd?.body == nil
(adView.iconView as? UIImageView)?.image = nativeAd?.icon?.image
adView.iconView?.isHidden = nativeAd?.icon == nil
// These assets are not guaranteed to be present. Check that they are before
// showing or hiding them.
(nativeAdView.bodyView as? UILabel)?.text = nativeAd.body
nativeAdView.bodyView?.isHidden = nativeAd.body == nil
(nativeAdView.callToActionView as? UIButton)?.setTitle(nativeAd.callToAction, for: .normal)
nativeAdView.callToActionView?.isHidden = nativeAd.callToAction == nil
(nativeAdView.iconView as? UIImageView)?.image = nativeAd.icon?.image
nativeAdView.iconView?.isHidden = nativeAd.icon == nil
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath)
func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath)