Commit b071d02c by Demid Merzlyakov

iOS-106: MREC layout fix

parent 3b01922f
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
<rect key="frame" x="0.0" y="0.0" width="300" height="155"/> <rect key="frame" x="0.0" y="0.0" width="300" height="155"/>
<constraints> <constraints>
<constraint firstAttribute="height" constant="155" id="2of-WV-KVU"/> <constraint firstAttribute="height" constant="155" id="2of-WV-KVU"/>
<constraint firstAttribute="width" constant="300" id="fBU-Kp-e3s"/>
</constraints> </constraints>
</imageView> </imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Headline" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ALU-9y-yCS"> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Headline" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ALU-9y-yCS">
......
...@@ -50,11 +50,8 @@ class MRECAdCell: UITableViewCell, AdCell { ...@@ -50,11 +50,8 @@ class MRECAdCell: UITableViewCell, AdCell {
switch interfaceStyle { switch interfaceStyle {
case .light: case .light:
gradientView.isHidden = false gradientView.isHidden = false
container.layer.borderWidth = 1 / UIScreen.main.scale
container.layer.borderColor = UIColor(hex: 0xc7c7c7).cgColor
case .dark: case .dark:
gradientView.isHidden = true gradientView.isHidden = true
container.layer.borderWidth = 0
} }
} }
} }
...@@ -83,7 +80,7 @@ private extension MRECAdCell { ...@@ -83,7 +80,7 @@ private extension MRECAdCell {
make.height.equalTo(250) make.height.equalTo(250)
make.bottom.equalToSuperview().inset(18) make.bottom.equalToSuperview().inset(18)
make.centerX.equalToSuperview() make.centerX.equalToSuperview()
make.width.equalTo(300) make.width.greaterThanOrEqualTo(300)
} }
} }
...@@ -91,10 +88,6 @@ private extension MRECAdCell { ...@@ -91,10 +88,6 @@ private extension MRECAdCell {
for subview in container.subviews { for subview in container.subviews {
subview.removeFromSuperview() subview.removeFromSuperview()
} }
label.snp.makeConstraints { (make) in
make.center.equalToSuperview()
}
if let adView = adView { if let adView = adView {
container.addSubview(adView) container.addSubview(adView)
adView.snp.makeConstraints { (make) in adView.snp.makeConstraints { (make) in
......
...@@ -114,16 +114,34 @@ class ForecastCellFactory: CellFactoryProtocol { ...@@ -114,16 +114,34 @@ class ForecastCellFactory: CellFactoryProtocol {
let adView = AdView() let adView = AdView()
var placementName: String! var placementName: String!
var timePeriodString: String! var timePeriodString: String!
var adType = AdType.banner
var adTypeString = "Banner"
var adLoggingEmoji = "🔹"
switch timePeriod { switch timePeriod {
case .daily: case .daily:
placementName = placementNameForecastDailyBanner
timePeriodString = "D" timePeriodString = "D"
placementName = placementNameForecastDailyBanner
let cellType = DailyForecastCellType(rawValue: indexPath.row)
if cellType == .adMREC {
placementName = placementNameForecastDailySquare
adType = .square
adTypeString = "MREC"
adLoggingEmoji = "✅"
}
case .hourly: case .hourly:
placementName = placementNameForecastHourlyBanner placementName = placementNameForecastHourlyBanner
timePeriodString = "H" timePeriodString = "H"
let cellType = HourlyForecastCellType(rawValue: indexPath.row)
if cellType == .adMREC {
placementName = placementNameForecastHourlySquare
adType = .square
adTypeString = "MREC"
adLoggingEmoji = "✅"
}
} }
adView.set(placementName: placementName, adType: .banner)
adView.loggingAlias = "🔹 Forecast \(timePeriodString!) Banner" adView.set(placementName: placementName, adType: adType)
adView.loggingAlias = "\(adLoggingEmoji) Forecast \(timePeriodString!) \(adTypeString)"
var edited = adViewCache[timePeriod] ?? [IndexPath: AdView]() var edited = adViewCache[timePeriod] ?? [IndexPath: AdView]()
edited[indexPath] = adView edited[indexPath] = adView
adViewCache[timePeriod] = edited adViewCache[timePeriod] = edited
......
...@@ -97,6 +97,7 @@ class TodayCellFactory: CellFactoryProtocol { ...@@ -97,6 +97,7 @@ class TodayCellFactory: CellFactoryProtocol {
var adType = AdType.banner var adType = AdType.banner
if cellType(at: indexPath) == .adMREC { if cellType(at: indexPath) == .adMREC {
adType = .square adType = .square
adView.loggingAlias = "📅 Today MREC"
} }
adView.set(placementName: placementNameTodayBanner, adType: adType) adView.set(placementName: placementNameTodayBanner, adType: adType)
adViewCache[indexPath] = adView adViewCache[indexPath] = adView
......
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