Commit 80b5e714 by Demid Merzlyakov

IOS-73: native ad layout.

parent a3a4eb93
......@@ -10,14 +10,33 @@ import Foundation
import GoogleMobileAds
class BRNativeBannerView: GADNativeAdView {
@IBOutlet weak var sponsoredLabel: UILabel!
@IBOutlet weak var adChoicesViewCustomOutlet: GADAdChoicesView!
class func instantiateWithXib() -> BRNativeBannerView? {
let nib = UINib(nibName: "\(BRNativeBannerView.self)", bundle: nil)
let bView = nib.instantiate(withOwner: self, options: nil).first as? BRNativeBannerView
bView?.setupPostXib()
return bView
}
private func setupPostXib() {
let currentTheme = ThemeManager.currentTheme
self.callToActionView?.backgroundColor = currentTheme.nativeAdCallToActionColor
self.callToActionView?.layer.cornerRadius = 2
self.callToActionView?.clipsToBounds = true
(self.headlineView as? UILabel)?.textColor = currentTheme.primaryTextColor
(self.advertiserView as? UILabel)?.textColor = currentTheme.primaryTextColor
self.adChoicesView = self.adChoicesViewCustomOutlet
sponsoredLabel.text = "ads.native.sponsored".localized()
sponsoredLabel.textColor = currentTheme.primaryTextColor
}
var nativeAdItem: NativeAdItem? {
willSet {
self.adChoicesView = self.adChoicesViewCustomOutlet
}
didSet {
nativeAd = nativeAdItem?.nativeAd
setupView()
......@@ -29,6 +48,7 @@ class BRNativeBannerView: GADNativeAdView {
(iconView as? UIImageView)?.image = nativeAd?.icon?.image
(advertiserView as? UILabel)?.text = nativeAd?.advertiser
(callToActionView as? UILabel)?.text = nativeAd?.callToAction
setupPostXib()
}
}
......
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "group4Copy2.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"template-rendering-intent" : "template"
}
}
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"colors" : [
{
"color" : {
"color-space" : "display-p3",
"components" : {
"alpha" : "1.000",
"blue" : "0.286",
"green" : "0.434",
"red" : "0.182"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "display-p3",
"components" : {
"alpha" : "1.000",
"blue" : "0.286",
"green" : "0.434",
"red" : "0.182"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
......@@ -268,3 +268,6 @@
// Humidity type, for smart texts
"humidity.type.high" = "high";
"humidity.type.low" = "low";
// Ads
"ads.native.sponsored" = "Sponsored";
......@@ -115,4 +115,9 @@ struct DefaultTheme: ThemeProtocol {
var mapControlsColor: UIColor {
return UIColor(named: "map_controls_color") ?? .red
}
//Ads
var nativeAdCallToActionColor: UIColor {
return UIColor(named: "native_ad_call_to_action_background") ?? .red
}
}
......@@ -49,4 +49,7 @@ public protocol ThemeProtocol {
//Map
var mapControlsColor:UIColor { get }
//Ads
var nativeAdCallToActionColor: UIColor { get }
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment