Commit b071d02c by Demid Merzlyakov

iOS-106: MREC layout fix

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