Commit 3b01922f by Demid Merzlyakov

IOS-106: MREC support.

parent cc6ee399
......@@ -157,7 +157,6 @@
CE13B80D262480B3007CBD4D /* AdConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE13B7F1262480B3007CBD4D /* AdConfig.swift */; };
CE13B80F262480B3007CBD4D /* NativeBannerContainerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE13B7F4262480B3007CBD4D /* NativeBannerContainerView.swift */; };
CE13B812262480B3007CBD4D /* NativeAdItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE13B7F7262480B3007CBD4D /* NativeAdItem.swift */; };
CE13B814262480B3007CBD4D /* NativeBannerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE13B7F9262480B3007CBD4D /* NativeBannerView.swift */; };
CE13B816262480B3007CBD4D /* NativeAdLoader.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE13B7FB262480B3007CBD4D /* NativeAdLoader.swift */; };
CE13B817262480B3007CBD4D /* NativeBannerView.xib in Resources */ = {isa = PBXBuildFile; fileRef = CE13B7FC262480B3007CBD4D /* NativeBannerView.xib */; };
CE13B818262480B3007CBD4D /* A9BidObject.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE13B7FF262480B3007CBD4D /* A9BidObject.swift */; };
......@@ -181,10 +180,12 @@
CE578FE725FB415F00E8B85D /* LocationsViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE578FE425FB415F00E8B85D /* LocationsViewModel.swift */; };
CE6BE4942634170800626822 /* USStateCode.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE6BE4932634170800626822 /* USStateCode.swift */; };
CE6F5F0C263C8B3D00973137 /* SmartTextProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE6F5F0B263C8B3C00973137 /* SmartTextProvider.swift */; };
CE81A422266E289E00800EFF /* NativeAdView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE81A421266E289E00800EFF /* NativeAdView.swift */; };
CE849DB82638C33600DEFFBD /* NotificationService.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE849DB72638C33600DEFFBD /* NotificationService.swift */; };
CE849DBC2638C33600DEFFBD /* OneWeatherNotificationServiceExtension.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = CE849DB52638C33600DEFFBD /* OneWeatherNotificationServiceExtension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
CE849E382638CE8000DEFFBD /* UserNotifications.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CE849E372638CE8000DEFFBD /* UserNotifications.framework */; };
CE895F0F26393FD800214175 /* WeatherImageProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE895F0E26393FD800214175 /* WeatherImageProvider.swift */; };
CE9C0780266A4768004197FC /* NativeMRECView.xib in Resources */ = {isa = PBXBuildFile; fileRef = CE9C077F266A4768004197FC /* NativeMRECView.xib */; };
CEAD00A12577B2D5003596AD /* StuffThatIsPresentInTheMainProject.swift in Sources */ = {isa = PBXBuildFile; fileRef = CEAD00A02577B2D5003596AD /* StuffThatIsPresentInTheMainProject.swift */; };
CEAFF0A325E0FF0800DF4EBF /* LocationManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = CEAFF0A225E0FF0800DF4EBF /* LocationManager.swift */; };
CEBAC1C62638236D00A89681 /* PushNotificationsManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = CEBAC1C52638236D00A89681 /* PushNotificationsManager.swift */; };
......@@ -194,6 +195,8 @@
CEC8FBB2263976240001A6BF /* OnboardingCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = CEC8FBB1263976240001A6BF /* OnboardingCoordinator.swift */; };
CEC8FBB5263976400001A6BF /* OnboardingViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = CEC8FBB4263976400001A6BF /* OnboardingViewModel.swift */; };
CEE0A1A426317A8F0044C257 /* NWSAlertInfoParser.swift in Sources */ = {isa = PBXBuildFile; fileRef = CEE0A1A326317A8F0044C257 /* NWSAlertInfoParser.swift */; };
CEEB3547266F5D9900E16F90 /* BannerAdCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = CEEB3546266F5D9900E16F90 /* BannerAdCell.swift */; };
CEEB3549266F5DA900E16F90 /* MRECAdCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = CEEB3548266F5DA900E16F90 /* MRECAdCell.swift */; };
CEEF4100265E47FF00425D8F /* BlendFIPSSource.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CEEF40FF265E47FF00425D8F /* BlendFIPSSource.framework */; };
CEEF4101265E47FF00425D8F /* BlendFIPSSource.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = CEEF40FF265E47FF00425D8F /* BlendFIPSSource.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
CEF959652600C2F900975FAA /* AnalyticsService.swift in Sources */ = {isa = PBXBuildFile; fileRef = CEF959642600C2F900975FAA /* AnalyticsService.swift */; };
......@@ -406,7 +409,6 @@
CE13B7F1262480B3007CBD4D /* AdConfig.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AdConfig.swift; sourceTree = "<group>"; };
CE13B7F4262480B3007CBD4D /* NativeBannerContainerView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NativeBannerContainerView.swift; sourceTree = "<group>"; };
CE13B7F7262480B3007CBD4D /* NativeAdItem.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NativeAdItem.swift; sourceTree = "<group>"; };
CE13B7F9262480B3007CBD4D /* NativeBannerView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NativeBannerView.swift; sourceTree = "<group>"; };
CE13B7FB262480B3007CBD4D /* NativeAdLoader.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NativeAdLoader.swift; sourceTree = "<group>"; };
CE13B7FC262480B3007CBD4D /* NativeBannerView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = NativeBannerView.xib; sourceTree = "<group>"; };
CE13B7FD262480B3007CBD4D /* BRMoPubAdView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BRMoPubAdView.h; sourceTree = "<group>"; };
......@@ -430,12 +432,14 @@
CE578FE425FB415F00E8B85D /* LocationsViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LocationsViewModel.swift; sourceTree = "<group>"; };
CE6BE4932634170800626822 /* USStateCode.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = USStateCode.swift; sourceTree = "<group>"; };
CE6F5F0B263C8B3C00973137 /* SmartTextProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SmartTextProvider.swift; sourceTree = "<group>"; };
CE81A421266E289E00800EFF /* NativeAdView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NativeAdView.swift; sourceTree = "<group>"; };
CE849DB52638C33600DEFFBD /* OneWeatherNotificationServiceExtension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = OneWeatherNotificationServiceExtension.appex; sourceTree = BUILT_PRODUCTS_DIR; };
CE849DB72638C33600DEFFBD /* NotificationService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationService.swift; sourceTree = "<group>"; };
CE849DB92638C33600DEFFBD /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
CE849DE82638C59800DEFFBD /* OneWeatherNotificationServiceExtension.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = OneWeatherNotificationServiceExtension.entitlements; sourceTree = "<group>"; };
CE849E372638CE8000DEFFBD /* UserNotifications.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UserNotifications.framework; path = System/Library/Frameworks/UserNotifications.framework; sourceTree = SDKROOT; };
CE895F0E26393FD800214175 /* WeatherImageProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WeatherImageProvider.swift; sourceTree = "<group>"; };
CE9C077F266A4768004197FC /* NativeMRECView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = NativeMRECView.xib; sourceTree = "<group>"; };
CEAD00A02577B2D5003596AD /* StuffThatIsPresentInTheMainProject.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StuffThatIsPresentInTheMainProject.swift; sourceTree = "<group>"; };
CEAFF0A225E0FF0800DF4EBF /* LocationManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocationManager.swift; sourceTree = "<group>"; };
CEBAC1C52638236D00A89681 /* PushNotificationsManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PushNotificationsManager.swift; sourceTree = "<group>"; };
......@@ -445,6 +449,8 @@
CEC8FBB1263976240001A6BF /* OnboardingCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnboardingCoordinator.swift; sourceTree = "<group>"; };
CEC8FBB4263976400001A6BF /* OnboardingViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnboardingViewModel.swift; sourceTree = "<group>"; };
CEE0A1A326317A8F0044C257 /* NWSAlertInfoParser.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NWSAlertInfoParser.swift; sourceTree = "<group>"; };
CEEB3546266F5D9900E16F90 /* BannerAdCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BannerAdCell.swift; sourceTree = "<group>"; };
CEEB3548266F5DA900E16F90 /* MRECAdCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MRECAdCell.swift; sourceTree = "<group>"; };
CEEF40FF265E47FF00425D8F /* BlendFIPSSource.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = BlendFIPSSource.framework; sourceTree = BUILT_PRODUCTS_DIR; };
CEF959642600C2F900975FAA /* AnalyticsService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AnalyticsService.swift; sourceTree = "<group>"; };
CEF959682600C30500975FAA /* AnalyticsGlobal.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AnalyticsGlobal.swift; sourceTree = "<group>"; };
......@@ -797,7 +803,6 @@
isa = PBXGroup;
children = (
CDA5542725EF734200A2E08C /* TodayCellFactory.swift */,
CD822FFD25D6976F00A05501 /* AdCell.swift */,
CD822FF425D6817000A05501 /* TodayForecastCell.swift */,
CD15DB4125DA806C00024727 /* TodayForecastTimePeriodCell.swift */,
CD82300125D69DB900A05501 /* TodayConditions */,
......@@ -927,6 +932,7 @@
CDC0C7AE261310DB0030607A /* SharedCells */ = {
isa = PBXGroup;
children = (
CEEB354A266F687300E16F90 /* AdCells */,
CD86246325E66E6B0097F3FB /* PrecipCell */,
CD86245B25E646000097F3FB /* SunPhaseCell */,
CDC6126025E8DA2900188DA7 /* MoonPhaseCell */,
......@@ -1076,11 +1082,10 @@
CE13B7F2262480B3007CBD4D /* Native */ = {
isa = PBXGroup;
children = (
CE81A420266E288C00800EFF /* NativeAdViews */,
CE13B7F4262480B3007CBD4D /* NativeBannerContainerView.swift */,
CE13B7F7262480B3007CBD4D /* NativeAdItem.swift */,
CE13B7FB262480B3007CBD4D /* NativeAdLoader.swift */,
CE13B7F9262480B3007CBD4D /* NativeBannerView.swift */,
CE13B7FC262480B3007CBD4D /* NativeBannerView.xib */,
);
path = Native;
sourceTree = "<group>";
......@@ -1150,6 +1155,16 @@
path = Cells;
sourceTree = "<group>";
};
CE81A420266E288C00800EFF /* NativeAdViews */ = {
isa = PBXGroup;
children = (
CE81A421266E289E00800EFF /* NativeAdView.swift */,
CE13B7FC262480B3007CBD4D /* NativeBannerView.xib */,
CE9C077F266A4768004197FC /* NativeMRECView.xib */,
);
path = NativeAdViews;
sourceTree = "<group>";
};
CE849DB62638C33600DEFFBD /* OneWeatherNotificationServiceExtension */ = {
isa = PBXGroup;
children = (
......@@ -1210,6 +1225,16 @@
path = Onboarding;
sourceTree = "<group>";
};
CEEB354A266F687300E16F90 /* AdCells */ = {
isa = PBXGroup;
children = (
CD822FFD25D6976F00A05501 /* AdCell.swift */,
CEEB3546266F5D9900E16F90 /* BannerAdCell.swift */,
CEEB3548266F5DA900E16F90 /* MRECAdCell.swift */,
);
path = AdCells;
sourceTree = "<group>";
};
CEF959632600C2E300975FAA /* Analytics */ = {
isa = PBXGroup;
children = (
......@@ -1360,6 +1385,7 @@
CE13B88F26248A77007CBD4D /* GoogleService-Info-Staging.plist in Resources */,
87B66BF12667AF1C00B9A59A /* SF-Compact-Display-Light.otf in Resources */,
87B66BED2667A45B00B9A59A /* SF-Compact-Display-Regular.otf in Resources */,
CE9C0780266A4768004197FC /* NativeMRECView.xib in Resources */,
CE13B88E26248A77007CBD4D /* GoogleService-Info-Production.plist in Resources */,
CD1237CC255D5C5C00C98139 /* Assets.xcassets in Resources */,
CD822FFA25D6890900A05501 /* OneWeatherColorsAsset.xcassets in Resources */,
......@@ -1560,9 +1586,9 @@
CE13B80F262480B3007CBD4D /* NativeBannerContainerView.swift in Sources */,
CD6761842625B6A10079D273 /* RadarLayersCellFactory.swift in Sources */,
CD67617C2625A60B0079D273 /* MapLayersDismissAnimator.swift in Sources */,
CE13B814262480B3007CBD4D /* NativeBannerView.swift in Sources */,
CD18728B2624763000AFEDAA /* MapLegendView.swift in Sources */,
CE13B80D262480B3007CBD4D /* AdConfig.swift in Sources */,
CEEB3549266F5DA900E16F90 /* MRECAdCell.swift in Sources */,
CE13B80A262480B3007CBD4D /* EnvironmentManager.swift in Sources */,
CE13B818262480B3007CBD4D /* A9BidObject.swift in Sources */,
CDD0F1E82572429E00CF5017 /* AppFont.swift in Sources */,
......@@ -1586,6 +1612,7 @@
CD39F2F225DE94C4009FE398 /* SunPhaseCell.swift in Sources */,
CD6B304325726AD1004B34B3 /* DefaultTheme.swift in Sources */,
CEC8FBB2263976240001A6BF /* OnboardingCoordinator.swift in Sources */,
CEEB3547266F5D9900E16F90 /* BannerAdCell.swift in Sources */,
CD8B60B626381E0F0055CB3F /* AdsUserDefaultsWrapper.swift in Sources */,
CD9B6B1425DBCDE2001D9B80 /* GraphView.swift in Sources */,
87DE8C81263BFBCE00E1C8D4 /* LegacyMigrationManager.swift in Sources */,
......@@ -1660,6 +1687,7 @@
CDDE8D7C262EED3C00267931 /* MapLegendSevereView.swift in Sources */,
CD6761882625C3360079D273 /* RadarViewModel.swift in Sources */,
CDF8F12A262089A200DB384A /* MapTimeView.swift in Sources */,
CE81A422266E289E00800EFF /* NativeAdView.swift in Sources */,
CE13B81D262480B3007CBD4D /* BRMoPubAdView.m in Sources */,
CD37D3DE260C9E37002669D6 /* MenuCell.swift in Sources */,
CD822FFE25D6976F00A05501 /* AdCell.swift in Sources */,
......
......@@ -124,17 +124,11 @@ public class AdManager {
a9Cache.addToPreload(placementName: placementNameTodayBanner, adType: .banner, count: 1)
a9Cache.addToPreload(placementName: placementNameTodaySquare, adType: .square, count: 1)
a9Cache.addToPreload(placementName: placementNameDiscussionSquare, adType: .square, count: 1)
a9Cache.addToPreload(placementName: placementNameExtendedSquare, adType: .square, count: 1)
a9Cache.addToPreload(placementName: placementName12WeekInterstitial, adType: .interstitial, count: 1)
a9Cache.addToPreload(placementName: placementNameForecastHourlyBanner, adType: .banner, count: 1)
a9Cache.addToPreload(placementName: placementNameForecastHourlySquare, adType: .square, count: 1)
a9Cache.addToPreload(placementName: placementNameForecastExtendedBanner, adType: .banner, count: 1)
a9Cache.addToPreload(placementName: placementNameForecastExtendedSquare, adType: .square, count: 1)
a9Cache.addToPreload(placementName: placementNameForecast12WeekSquare, adType: .square, count: 1)
a9Cache.addToPreload(placementName: placementNamePrecipitationBanner, adType: .banner, count: 1)
a9Cache.addToPreload(placementName: placementNameRadarInterstitial, adType: .interstitial, count: 1)
a9Cache.addToPreload(placementName: placementNameSunMoonBanner, adType: .banner, count: 1)
a9Cache.addToPreload(placementName: placementNameForecastDailyBanner, adType: .banner, count: 1)
a9Cache.addToPreload(placementName: placementNameForecastDailySquare, adType: .square, count: 1)
a9Cache.addToPreload(placementName: placementNameNWSAlertBanner, adType: .banner, count: 1)
a9Cache.startPreloadingBids()
}
......
......@@ -127,7 +127,7 @@ public class AdView: UIView {
log.warning("failed to guess the top view controller.")
return
}
bannerView = NativeBannerContainerView(adUnitId: placement.adUnitId, rootViewController: topViewController)
bannerView = NativeBannerContainerView(adUnitId: placement.adUnitId, adType: adType, rootViewController: topViewController)
if let bannerView = bannerView {
......
......@@ -14,19 +14,13 @@ extension Notification.Name {
typealias AdPlacementName = String
let placementNameTodayBanner: AdPlacementName = "1W_iOS_Native_Banner_ForD_ATF" //TODO: wrong?
let placementNameTodaySquare: AdPlacementName = "1W_iOS_Native_MREC_Today_BTF2"
let placementNameDiscussionSquare: AdPlacementName = "1W_iOS_Native_MREC_Forecast_discussion"
let placementNameExtendedSquare: AdPlacementName = "1W_iOS_Native_MREC_Forecast_discussion" // TODO: wrong?
let placementName12WeekInterstitial: AdPlacementName = "1W_iOS_Int" //TODO: definitely wrong
let placementNameForecastHourlyBanner: AdPlacementName = "1W_iOS_Native_Banner_Hourly_ATF"
let placementNameForecastHourlySquare: AdPlacementName = "1W_iOS_Native_MREC_Forecast_Hourly_BTF1"
let placementNameForecastExtendedBanner: AdPlacementName = "1W_iOS_Native_Banner_ForD_ATF" // TODO: definitely wrong
let placementNameForecastExtendedSquare: AdPlacementName = "1W_iOS_Native_MREC_Forecast_discussion" // TODO: definitely wrong
let placementNameForecast12WeekSquare: AdPlacementName = "1W_iOS_Native_MREC_Today_Details" //TODO: definitely wrong
let placementNamePrecipitationBanner: AdPlacementName = "1W_iOS_Native_Banner_Precipitation_ATF"
let placementNameRadarInterstitial: AdPlacementName = "1W_iOS_Int" //TODO: definitely wrong
let placementNameSunMoonBanner: AdPlacementName = "1W_iOS_Native_Banner_Sunmoon_ATF"
let placementNameTodayBanner: AdPlacementName = "today_banner"
let placementNameTodaySquare: AdPlacementName = "today_square"
let placementNameForecastHourlyBanner: AdPlacementName = "forecast_hourly_banner"
let placementNameForecastHourlySquare: AdPlacementName = "forecast_hourly_square"
let placementNameForecastDailyBanner: AdPlacementName = "forecast_daily_banner"
let placementNameForecastDailySquare: AdPlacementName = "forecast_daily_square"
let placementNameNWSAlertBanner: AdPlacementName = "nws_alert_banner"
class AdConfigManager: NSObject {
@objc
......
......@@ -98,12 +98,12 @@ extension NativeAdItem: GADNativeAdDelegate {
}
extension NativeAdItem: GADBannerViewDelegate {
func adViewDidRecordImpression(_ bannerView: GADBannerView) {
func bannerViewDidRecordImpression(_ bannerView: GADBannerView) {
log.info("Impression recorded (banner)")
analytics(log: .ANALYTICS_AD_IMPRESSION)
}
func adViewWillPresentScreen(_ bannerView: GADBannerView) {
func bannerViewWillPresentScreen(_ bannerView: GADBannerView) {
log.info("Click recorded (will present screen)")
analytics(log: .ANALYTICS_AD_CLICKED)
}
......
//
// NativeBannerView.swift
// BaconReader
// NativeAdView.swift
// 1Weather
//
// Created by Rishab Dutta on 24/07/20.
// Copyright © 2020 OneLouder Apps. All rights reserved.
// Created by Demid Merzlyakov on 07.06.2021.
//
import Foundation
import GoogleMobileAds
class NativeBannerView: GADNativeAdView {
@IBOutlet weak var sponsoredLabel: UILabel!
@IBOutlet weak var adChoicesViewCustomOutlet: GADAdChoicesView!
class NativeAdView: GADNativeAdView {
@IBOutlet weak var sponsoredLabel: UILabel?
@IBOutlet weak var adChoicesViewCustomOutlet: GADAdChoicesView?
var headlineLabel: UILabel? {
headlineView as? UILabel
......@@ -22,6 +20,10 @@ class NativeBannerView: GADNativeAdView {
advertiserView as? UILabel
}
var bodyLabel: UILabel? {
bodyView as? UILabel
}
var iconImageView: UIImageView? {
iconView as? UIImageView
}
......@@ -30,14 +32,28 @@ class NativeBannerView: GADNativeAdView {
callToActionView as? UILabel
}
class func instantiateWithXib() -> NativeBannerView? {
let nib = UINib(nibName: "\(NativeBannerView.self)", bundle: nil)
let bView = nib.instantiate(withOwner: self, options: nil).first as? NativeBannerView
var mainImageView: UIImageView? {
imageView as? UIImageView
}
public class func instantiateWithXib(adType: AdType) -> NativeAdView? {
var xibName: String!
switch adType {
case .banner:
xibName = "NativeBannerView"
case .square:
xibName = "NativeMRECView"
case .interstitial:
assertionFailure("Incorrect ad type - interstitial")
return nil
}
let nib = UINib(nibName: xibName, bundle: nil)
let bView = nib.instantiate(withOwner: self, options: nil).first as? NativeAdView
bView?.setupPostXib()
return bView
}
private func setupPostXib() {
func setupPostXib() {
let currentTheme = ThemeManager.currentTheme
callToActionLabel?.backgroundColor = currentTheme.nativeAdCallToActionColor
callToActionLabel?.layer.cornerRadius = 2
......@@ -47,17 +63,20 @@ class NativeBannerView: GADNativeAdView {
advertiserLabel?.textColor = currentTheme.primaryTextColor
self.adChoicesView = self.adChoicesViewCustomOutlet
sponsoredLabel.text = "ads.native.sponsored".localized()
sponsoredLabel.textColor = currentTheme.primaryTextColor
sponsoredLabel?.text = "ads.native.sponsored".localized()
sponsoredLabel?.textColor = currentTheme.primaryTextColor
bodyLabel?.textColor = currentTheme.secondaryTextColor
setupFonts()
}
private func setupFonts() {
callToActionLabel?.font = AppFont.SFCompactDisplay.regular(size: 10)
sponsoredLabel.font = AppFont.SFCompactDisplay.regular(size: 10)
sponsoredLabel?.font = AppFont.SFCompactDisplay.regular(size: 10)
headlineLabel?.font = AppFont.SFCompactDisplay.semibold(size: 18)
advertiserLabel?.font = AppFont.SFCompactDisplay.regular(size: 12)
callToActionLabel?.font = AppFont.SFCompactDisplay.light(size: 10)
bodyLabel?.font = AppFont.SFCompactDisplay.regular(size: 10)
}
var nativeAdItem: NativeAdItem? {
......@@ -75,9 +94,10 @@ class NativeBannerView: GADNativeAdView {
iconImageView?.image = nativeAd?.icon?.image
advertiserLabel?.text = nativeAd?.advertiser
callToActionLabel?.text = nativeAd?.callToAction
bodyLabel?.text = nativeAd?.body
mainImageView?.image = nativeAd?.images?.first?.image
setupPostXib()
}
}
......@@ -17,7 +17,7 @@
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="iN0-l3-epB" customClass="NativeBannerView" customModule="_Weather" customModuleProvider="target">
<view contentMode="scaleToFill" id="iN0-l3-epB" customClass="NativeAdView" customModule="_Weather" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="320" height="64"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
......
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="18122" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="18093"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="GADNativeAdView"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="A8i-el-bXZ" customClass="NativeAdView" customModule="_Weather" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="300" height="250"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="TNc-iz-mnZ">
<rect key="frame" x="0.0" y="0.0" width="300" height="155"/>
<constraints>
<constraint firstAttribute="height" constant="155" id="2of-WV-KVU"/>
</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">
<rect key="frame" x="10" y="160" width="280" height="20"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Body" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="b9r-uH-Qrr">
<rect key="frame" x="10" y="180" width="222" height="11"/>
<fontDescription key="fontDescription" type="system" pointSize="9"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="CTA" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="7po-us-Uyw">
<rect key="frame" x="10" y="210" width="78" height="26"/>
<color key="backgroundColor" red="0.066666666669999999" green="0.49803921569999998" blue="1" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="height" constant="26" id="5wk-Js-TvA"/>
<constraint firstAttribute="width" constant="78" id="mQK-sj-eIi"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="k7n-sU-yPp">
<rect key="frame" x="236" y="184" width="54" height="54"/>
<constraints>
<constraint firstAttribute="width" constant="54" id="DaG-29-Yci"/>
<constraint firstAttribute="height" constant="54" id="Ol9-Ch-SAu"/>
</constraints>
</imageView>
</subviews>
<viewLayoutGuide key="safeArea" id="4vU-qI-YDI"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstItem="k7n-sU-yPp" firstAttribute="leading" secondItem="b9r-uH-Qrr" secondAttribute="trailing" constant="4" id="42b-ug-6to"/>
<constraint firstItem="TNc-iz-mnZ" firstAttribute="leading" secondItem="A8i-el-bXZ" secondAttribute="leading" id="5EK-gf-w66"/>
<constraint firstItem="7po-us-Uyw" firstAttribute="leading" secondItem="A8i-el-bXZ" secondAttribute="leading" constant="10" id="5FJ-Je-u1p"/>
<constraint firstItem="b9r-uH-Qrr" firstAttribute="top" secondItem="ALU-9y-yCS" secondAttribute="bottom" id="7uv-BN-qIz"/>
<constraint firstAttribute="bottom" secondItem="7po-us-Uyw" secondAttribute="bottom" constant="14" id="Apu-0q-oJC"/>
<constraint firstAttribute="bottom" secondItem="k7n-sU-yPp" secondAttribute="bottom" constant="12" id="CRP-vK-rgT"/>
<constraint firstAttribute="trailing" secondItem="k7n-sU-yPp" secondAttribute="trailing" constant="10" id="IBC-YR-xho"/>
<constraint firstItem="b9r-uH-Qrr" firstAttribute="leading" secondItem="ALU-9y-yCS" secondAttribute="leading" id="aoN-Pv-cUM"/>
<constraint firstItem="ALU-9y-yCS" firstAttribute="leading" secondItem="A8i-el-bXZ" secondAttribute="leading" constant="10" id="dBl-Mj-Bmh"/>
<constraint firstItem="ALU-9y-yCS" firstAttribute="top" secondItem="TNc-iz-mnZ" secondAttribute="bottom" constant="5" id="j1x-NM-1zu"/>
<constraint firstAttribute="trailing" secondItem="TNc-iz-mnZ" secondAttribute="trailing" id="o1v-BR-AAi"/>
<constraint firstAttribute="trailing" secondItem="ALU-9y-yCS" secondAttribute="trailing" constant="10" id="tNs-jB-g7c"/>
<constraint firstItem="TNc-iz-mnZ" firstAttribute="top" secondItem="A8i-el-bXZ" secondAttribute="top" id="u0g-go-6RF"/>
</constraints>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<connections>
<outlet property="bodyView" destination="b9r-uH-Qrr" id="mHO-sW-gX7"/>
<outlet property="callToActionView" destination="7po-us-Uyw" id="VBG-Fk-Pn7"/>
<outlet property="headlineView" destination="ALU-9y-yCS" id="pHO-sW-gXV"/>
<outlet property="iconView" destination="k7n-sU-yPp" id="4P6-sq-Gob"/>
<outlet property="imageView" destination="TNc-iz-mnZ" id="TN6-iz-mnZ"/>
</connections>
<point key="canvasLocation" x="214.49275362318843" y="-94.419642857142847"/>
</view>
</objects>
<resources>
<systemColor name="systemBackgroundColor">
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</systemColor>
</resources>
</document>
......@@ -21,6 +21,7 @@ class NativeBannerContainerView: UIView {
private let log = AdLogger(componentName: "NativeBannerContainerView")
private var adLoader: NativeAdLoader
private let adType: AdType
weak var delegate: NativeBannerContainerViewDelegate?
......@@ -30,7 +31,8 @@ class NativeBannerContainerView: UIView {
}
}
init(adUnitId: String, rootViewController: UIViewController) {
init(adUnitId: String, adType: AdType, rootViewController: UIViewController) {
self.adType = adType
self.adLoader = NativeAdLoader(adUnitId: adUnitId, rootViewController: rootViewController, adTypes: [.native, .gamBanner])
super.init(frame: .zero)
self.adLoader.delegate = self
......@@ -76,17 +78,12 @@ private extension NativeBannerContainerView {
extension NativeBannerContainerView: NativeAdLoaderDelegate {
func adLoader(_ adLoader: GADAdLoader, didReceive nativeAd: GADNativeAd) {
log.debug("Banner ad recieved (native_banner) by: \(String(describing: nativeAd.responseInfo.adNetworkClassName))")
guard let nativeBannerView = NativeBannerView.instantiateWithXib() else { return }
guard let adView = NativeAdView.instantiateWithXib(adType: adType) else { return }
let nativeAdItem = NativeAdItem(nativeAd: nativeAd, adUnitId: adLoader.adUnitID)
nativeBannerView.nativeAdItem = nativeAdItem
addAsSubview(view: nativeBannerView)
adView.nativeAdItem = nativeAdItem
addAsSubview(view: adView)
print("native ad loader: \(String(describing: nativeAd.headline))")
delegate?.adLoader(adLoader, didReceive: nativeAd)
}
func adLoader(_ adLoader: GADAdLoader, didFailToReceiveAdWithError error: Error) {
......
......@@ -271,3 +271,4 @@
// Ads
"ads.native.sponsored" = "Sponsored";
"ads.placeholder" = "Advertisment";
......@@ -165,7 +165,6 @@ class ForecastTimePeriodView: UIView {
}
private func updateGraphLayout() {
print("[ForecastTimePeriod] Update graph layout")
graphRect = (stackView.arrangedSubviews.first as? PeriodButtonProtocol)?.graphRect ?? .zero
graphView.frame = .init(x: 0,
y: graphRect.origin.y,
......@@ -299,8 +298,6 @@ class ForecastTimePeriodView: UIView {
self.graphView.drawAdditionalGraph(with: [CGPoint]())
self.tintGraphAt(button: selectedButton)
}
print("[ForecastTimePeriod] Draw graph")
}
private func tintGraphAt(button:PeriodButtonProtocol) {
......
//
// TodayAdCell.swift
// 1Weather
//
// Created by Dmitry Stepanets on 12.02.2021.
//
import UIKit
protocol AdCell {
var adView: AdView? { get set }
}
//
// TodayAdCell.swift
// BannerAdCell.swift
// 1Weather
//
// Created by Dmitry Stepanets on 12.02.2021.
......@@ -7,7 +7,8 @@
import UIKit
class AdCell: UITableViewCell {
class BannerAdCell: UITableViewCell, AdCell {
//Private
private let container = UIView()
private let label = UILabel()
......@@ -60,7 +61,7 @@ class AdCell: UITableViewCell {
}
//MARK:- Prepare
private extension AdCell {
private extension BannerAdCell {
func prepareCellStyle() {
selectionStyle = .none
}
......@@ -82,7 +83,7 @@ private extension AdCell {
subview.removeFromSuperview()
}
label.text = "Advertisment"
label.text = "ads.placeholder".localized()
label.font = AppFont.SFPro.regular(size: 14)
container.addSubview(label)
......
//
// MRECAdCell.swift
// 1Weather
//
// Created by Demid Merzlyakov on 08.06.2021.
//
import UIKit
class MRECAdCell: UITableViewCell, AdCell {
//Private
private let container = UIView()
private let label = UILabel()
public var adView: AdView? = nil {
didSet {
guard adView != oldValue else {
return
}
prepareAd()
}
}
private let gradientView = GradientView(startColor: UIColor.white.withAlphaComponent(0),
endColor: UIColor(hex: 0xdaddec),
opacity: 0.5)
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
prepareCellStyle()
prepareContainer()
prepareAd()
prepareGradient()
updateUI()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
super.traitCollectionDidChange(previousTraitCollection)
updateUI()
}
private func updateUI() {
contentView.backgroundColor = ThemeManager.currentTheme.baseBackgroundColor
container.backgroundColor = ThemeManager.currentTheme.containerBackgroundColor
label.textColor = ThemeManager.currentTheme.secondaryTextColor
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
}
}
}
//MARK:- Prepare
private extension MRECAdCell {
func prepareCellStyle() {
selectionStyle = .none
}
func prepareContainer() {
label.text = "ads.placeholder".localized()
label.font = AppFont.SFPro.regular(size: 10)
label.textColor = ThemeManager.currentTheme.secondaryTextColor
contentView.addSubview(label)
contentView.addSubview(container)
label.snp.makeConstraints { make in
make.top.equalToSuperview().inset(18)
make.trailing.equalTo(container.snp.trailing)
}
container.snp.makeConstraints { (make) in
make.top.equalTo(label.snp.bottom).offset(6)
make.height.equalTo(250)
make.bottom.equalToSuperview().inset(18)
make.centerX.equalToSuperview()
make.width.equalTo(300)
}
}
func prepareAd() {
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
make.center.equalToSuperview()
make.size.equalToSuperview()
}
}
}
func prepareGradient() {
contentView.addSubview(gradientView)
contentView.bringSubviewToFront(container)
gradientView.snp.makeConstraints { (make) in
make.left.bottom.right.equalToSuperview()
make.height.equalToSuperview().multipliedBy(0.5)
}
}
}
......@@ -10,11 +10,8 @@ import UIKit
private enum DailyForecastCellType:Int, CaseIterable {
case forecast = 0
case forecastInfo
case ad
// case forecast
// case conditions
// case precipitation
// case dayTime
case adBanner
case adMREC
case sun
case moon
}
......@@ -22,7 +19,8 @@ private enum DailyForecastCellType:Int, CaseIterable {
private enum HourlyForecastCellType: Int, CaseIterable {
case day
case forecastHourly
case ad
case adBanner
case adMREC
case precipitation
case wind
}
......@@ -66,7 +64,8 @@ class ForecastCellFactory: CellFactoryProtocol {
registerCell(type: ForecastWindSpeedCell.self, tableView: tableView)
registerCell(type: SunPhaseCell.self, tableView: tableView)
registerCell(type: MoonPhaseCell.self, tableView: tableView)
registerCell(type: AdCell.self, tableView: tableView)
registerCell(type: BannerAdCell.self, tableView: tableView)
registerCell(type: MRECAdCell.self, tableView: tableView)
}
public func cellFromTableView(tableView:UITableView, indexPath:IndexPath) -> UITableViewCell {
......@@ -117,7 +116,7 @@ class ForecastCellFactory: CellFactoryProtocol {
var timePeriodString: String!
switch timePeriod {
case .daily:
placementName = placementNameForecastExtendedBanner
placementName = placementNameForecastDailyBanner
timePeriodString = "D"
case .hourly:
placementName = placementNameForecastHourlyBanner
......@@ -175,8 +174,12 @@ class ForecastCellFactory: CellFactoryProtocol {
cell.configure(with: loc)
}
return cell
case .ad:
let cell = dequeueReusableCell(type: AdCell.self, tableView: tableView, indexPath: indexPath)
case .adBanner:
let cell = dequeueReusableCell(type: BannerAdCell.self, tableView: tableView, indexPath: indexPath)
cell.adView = adView(for: timePeriod, indexPath: indexPath)
return cell
case .adMREC:
let cell = dequeueReusableCell(type: MRECAdCell.self, tableView: tableView, indexPath: indexPath)
cell.adView = adView(for: timePeriod, indexPath: indexPath)
return cell
}
......@@ -221,8 +224,12 @@ class ForecastCellFactory: CellFactoryProtocol {
}
}
return cell
case .ad:
let cell = dequeueReusableCell(type: AdCell.self, tableView: tableView, indexPath: indexPath)
case .adBanner:
let cell = dequeueReusableCell(type: BannerAdCell.self, tableView: tableView, indexPath: indexPath)
cell.adView = adView(for: timePeriod, indexPath: indexPath)
return cell
case .adMREC:
let cell = dequeueReusableCell(type: MRECAdCell.self, tableView: tableView, indexPath: indexPath)
cell.adView = adView(for: timePeriod, indexPath: indexPath)
return cell
}
......
......@@ -12,7 +12,8 @@ fileprivate enum NWSAlertCellType: Int {
case header = 0
case forecastOffice
case extendedInfoBlock
case ad
case adBanner
case adMREC
}
fileprivate protocol NWSAlertTableViewSection {
......@@ -67,11 +68,11 @@ fileprivate struct ExtendedInfoSection: NWSAlertTableViewSection {
return .extendedInfoBlock
}
if numberOfRows == 1 {
return .ad
return .adBanner
}
else {
if row == 1 {
return .ad
return .adBanner
}
else {
return .extendedInfoBlock
......@@ -115,7 +116,7 @@ class NWSAlertCellFactory: CellFactoryProtocol {
}
let adView = adViewCache[indexPath] ?? AdView()
adView.loggingAlias = "⚠️ Alert Banner"
adView.set(placementName: placementNamePrecipitationBanner, adType: .banner)
adView.set(placementName: placementNameNWSAlertBanner, adType: .banner)
adViewCache[indexPath] = adView
return adView
}
......@@ -124,7 +125,8 @@ class NWSAlertCellFactory: CellFactoryProtocol {
registerCell(type: NWSAlertCell.self, tableView: tableView)
registerCell(type: NWSForecastOfficeTableViewCell.self, tableView: tableView)
registerCell(type: NWSAlertInfoBlockTableViewCell.self, tableView: tableView)
registerCell(type: AdCell.self, tableView: tableView)
registerCell(type: BannerAdCell.self, tableView: tableView)
registerCell(type: MRECAdCell.self, tableView: tableView)
}
func cellFromTableView(tableView: UITableView, indexPath: IndexPath) -> UITableViewCell {
......@@ -147,10 +149,14 @@ class NWSAlertCellFactory: CellFactoryProtocol {
let extendedInfoBlockCell = dequeueReusableCell(type: NWSAlertInfoBlockTableViewCell.self, tableView: tableView, indexPath: indexPath)
extendedInfoBlockCell.configure(with: info)
return extendedInfoBlockCell
case .ad:
let adCell = dequeueReusableCell(type: AdCell.self, tableView: tableView, indexPath: indexPath)
adCell.adView = adView(for: indexPath)
return adCell
case .adBanner:
let cell = dequeueReusableCell(type: BannerAdCell.self, tableView: tableView, indexPath: indexPath)
cell.adView = adView(for: indexPath)
return cell
case .adMREC:
let cell = dequeueReusableCell(type: MRECAdCell.self, tableView: tableView, indexPath: indexPath)
cell.adView = adView(for: indexPath)
return cell
}
}
......
......@@ -11,7 +11,8 @@ import OneWeatherCore
public enum TodayCellType:Int {
case alert = 0
case forecast
case ad
case adBanner
case adMREC
case conditions
case forecastPeriod
case precipitation
......@@ -54,9 +55,9 @@ class TodayCellFactory: CellFactoryProtocol {
private var cellsToUpdate:CellsToUpdate = [.condition, .timePeriod, .precipitation, .dayTime]
private let todayViewModel:TodayViewModel
private var todaySection = TodaySection(allRows: [.alert, .forecast, .ad,
private var todaySection = TodaySection(allRows: [.alert, .forecast, .adBanner,
.conditions, .forecastPeriod, .precipitation,
.airQuality, .dayTime, .sun, .moon])
.airQuality, .dayTime, .sun, .moon, .adMREC])
private var adViewCache = [IndexPath: AdView]()
......@@ -76,7 +77,8 @@ class TodayCellFactory: CellFactoryProtocol {
public func registerCells(on tableView:UITableView) {
registerCell(type: TodayAlertCell.self, tableView: tableView)
registerCell(type: TodayForecastCell.self, tableView: tableView)
registerCell(type: AdCell.self, tableView: tableView)
registerCell(type: BannerAdCell.self, tableView: tableView)
registerCell(type: MRECAdCell.self, tableView: tableView)
registerCell(type: TodayConditionsCell.self, tableView: tableView)
registerCell(type: TodayForecastTimePeriodCell.self, tableView: tableView)
registerCell(type: PrecipitationCell.self, tableView: tableView)
......@@ -92,7 +94,11 @@ class TodayCellFactory: CellFactoryProtocol {
}
let adView = AdView()
adView.loggingAlias = "📍 Today Banner"
adView.set(placementName: placementNameTodayBanner, adType: .banner)
var adType = AdType.banner
if cellType(at: indexPath) == .adMREC {
adType = .square
}
adView.set(placementName: placementNameTodayBanner, adType: adType)
adViewCache[indexPath] = adView
return adView
}
......@@ -117,16 +123,17 @@ class TodayCellFactory: CellFactoryProtocol {
let cell = dequeueReusableCell(type: TodayForecastCell.self, tableView: tableView, indexPath: indexPath)
cell.configure(with: loc)
return cell
case .ad:
let cell = dequeueReusableCell(type: AdCell.self, tableView: tableView, indexPath: indexPath)
case .adBanner:
let cell = dequeueReusableCell(type: BannerAdCell.self, tableView: tableView, indexPath: indexPath)
cell.adView = adView(for: indexPath)
return cell
case .adMREC:
let cell = dequeueReusableCell(type: MRECAdCell.self, tableView: tableView, indexPath: indexPath)
cell.adView = adView(for: indexPath)
return cell
case .conditions:
let cell = dequeueReusableCell(type: TodayConditionsCell.self, tableView: tableView, indexPath: indexPath)
// if cellsToUpdate.contains(.condition) {
cell.configure(with: loc)
// cellsToUpdate.remove(.condition)
// }
return cell
case .forecastPeriod:
let cell = dequeueReusableCell(type: TodayForecastTimePeriodCell.self, tableView: tableView, indexPath: indexPath)
......@@ -195,7 +202,8 @@ class TodayCellFactory: CellFactoryProtocol {
var rowsToHide = Set<TodayCellType>()
if isAppPro() || !AdConfigManager.shared.adConfig.adsEnabled {
rowsToHide.insert(.ad)
rowsToHide.insert(.adBanner)
rowsToHide.insert(.adMREC)
}
let location = self.todayViewModel.location
......
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