Commit cdeebaa9 by Demid Merzlyakov

IOS-176: move some ad control to feature availability.

parent 0d5742e2
......@@ -29,7 +29,8 @@ private enum ForecastCellType {
private struct HourlySection {
let rows: [ForecastCellType] = {
let showAds = !isAppPro() && AdConfigManager.shared.adConfig.adsEnabled
if showAds {
//TODO: dependency injection
if FeatureAvailabilityManager.shared.isAvailable(feature: .ads) {
return [.day, .forecastHourly, .adBanner, .precipitation, .wind, .adMREC]
}
else {
......@@ -40,8 +41,8 @@ private struct HourlySection {
private struct DailySection {
let rows: [ForecastCellType] = {
let showAds = !isAppPro() && AdConfigManager.shared.adConfig.adsEnabled
if showAds {
//TODO: dependency injection
if FeatureAvailabilityManager.shared.isAvailable(feature: .ads) {
return [.forecastDaily, .forecastDailyInfo, .adBanner, .sun, .moon, .adMREC]
}
else {
......
......@@ -33,7 +33,8 @@ fileprivate struct HeaderSection: NWSAlertTableViewSection {
}
private let rows: [NWSAlertCellType] = {
if !isAppPro() && AdConfigManager.shared.adConfig.adsEnabled {
//TODO: dependency injection
if FeatureAvailabilityManager.shared.isAvailable(feature: .ads) {
return [.header, .forecastOffice, .adBanner]
}
else {
......
......@@ -62,6 +62,10 @@ class TodayCellFactory: CellFactory {
private var adViewCache = [IndexPath: AdView]()
private var featureAvailabilityManager: FeatureAvailabilityManager {
FeatureAvailabilityManager.shared
}
//Public
public var delegate: CellFactoryDelegate?
init(viewModel: TodayViewModel) {
......@@ -227,7 +231,7 @@ class TodayCellFactory: CellFactory {
private func setupHiddenRows() {
var rowsToHide = Set<TodayCellType>()
if isAppPro() || !AdConfigManager.shared.adConfig.adsEnabled {
if !featureAvailabilityManager.isAvailable(feature: .ads) {
rowsToHide.insert(.adBanner)
rowsToHide.insert(.adMREC)
}
......
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