Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
1
1weather
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dmitriy Stepanets
1weather
Commits
cdeebaa9
Commit
cdeebaa9
authored
Aug 25, 2021
by
Demid Merzlyakov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
IOS-176: move some ad control to feature availability.
parent
0d5742e2
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
5 deletions
+11
-5
1Weather/UI/View controllers/Forecast/Cells/ForecastCellFactory.swift
+4
-3
1Weather/UI/View controllers/NWSAlert/Cells/NWSAlertCellFactory.swift
+2
-1
1Weather/UI/View controllers/Today/Cells/TodayCellFactory.swift
+5
-1
No files found.
1Weather/UI/View controllers/Forecast/Cells/ForecastCellFactory.swift
View file @
cdeebaa9
...
@@ -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
{
...
...
1Weather/UI/View controllers/NWSAlert/Cells/NWSAlertCellFactory.swift
View file @
cdeebaa9
...
@@ -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
{
...
...
1Weather/UI/View controllers/Today/Cells/TodayCellFactory.swift
View file @
cdeebaa9
...
@@ -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
)
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment