Commit cdeebaa9 by Demid Merzlyakov

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

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