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
87d13ddf
Commit
87d13ddf
authored
Oct 26, 2021
by
Dmitry Stepanets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[IOS-276]: Fixed Ads showing for Pro users
parent
8320c224
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
16 deletions
+16
-16
1Weather/UI/View controllers/Forecast/Cells/ForecastCellFactory.swift
+5
-6
1Weather/UI/View controllers/Forecast/ForecastViewController.swift
+8
-6
1Weather/ViewModels/ForecastViewModel.swift
+2
-3
1Weather/ViewModels/TodayViewModel.swift
+1
-1
No files found.
1Weather/UI/View controllers/Forecast/Cells/ForecastCellFactory.swift
View file @
87d13ddf
...
@@ -31,21 +31,20 @@ private enum ForecastCellType {
...
@@ -31,21 +31,20 @@ private enum ForecastCellType {
}
}
private
struct
HourlySection
{
private
struct
HourlySection
{
let
rows
:
[
ForecastCellType
]
=
{
var
rows
:
[
ForecastCellType
]
{
// TODO: use dependency injection instead of a singleton
// TODO: use dependency injection instead of a singleton
let
showAds
=
FeatureAvailabilityManager
.
shared
.
isAvailable
(
feature
:
.
ads
)
let
showAds
=
FeatureAvailabilityManager
.
shared
.
isAvailable
(
feature
:
.
ads
)
//TODO: dependency injection
if
showAds
{
if
FeatureAvailabilityManager
.
shared
.
isAvailable
(
feature
:
.
ads
)
{
return
[
.
day
,
.
forecastHourly
,
.
adBanner
,
.
precipitation
,
.
wind
,
.
adMREC
]
return
[
.
day
,
.
forecastHourly
,
.
adBanner
,
.
precipitation
,
.
wind
,
.
adMREC
]
}
}
else
{
else
{
return
[
.
day
,
.
forecastHourly
,
.
precipitation
,
.
wind
]
return
[
.
day
,
.
forecastHourly
,
.
precipitation
,
.
wind
]
}
}
}
()
}
}
}
private
struct
DailySection
{
private
struct
DailySection
{
let
rows
:
[
ForecastCellType
]
=
{
var
rows
:
[
ForecastCellType
]
{
//TODO: dependency injection
//TODO: dependency injection
if
FeatureAvailabilityManager
.
shared
.
isAvailable
(
feature
:
.
ads
)
{
if
FeatureAvailabilityManager
.
shared
.
isAvailable
(
feature
:
.
ads
)
{
return
[
.
forecastDaily
,
.
forecastDailyInfo
,
.
adBanner
,
.
sun
,
.
moon
,
.
adMREC
]
return
[
.
forecastDaily
,
.
forecastDailyInfo
,
.
adBanner
,
.
sun
,
.
moon
,
.
adMREC
]
...
@@ -53,7 +52,7 @@ private struct DailySection {
...
@@ -53,7 +52,7 @@ private struct DailySection {
else
{
else
{
return
[
.
forecastDaily
,
.
forecastDailyInfo
,
.
sun
,
.
moon
]
return
[
.
forecastDaily
,
.
forecastDailyInfo
,
.
sun
,
.
moon
]
}
}
}
()
}
}
}
...
...
1Weather/UI/View controllers/Forecast/ForecastViewController.swift
View file @
87d13ddf
...
@@ -11,7 +11,7 @@ import OneWeatherCore
...
@@ -11,7 +11,7 @@ import OneWeatherCore
class
ForecastViewController
:
UIViewController
{
class
ForecastViewController
:
UIViewController
{
//Private
//Private
private
let
forecastCellFactory
:
ForecastCellFactory
private
let
forecastCellFactory
:
ForecastCellFactory
private
let
cityButton
=
NavigationCityButton
()
private
let
cityButton
=
NavigationCityButton
()
private
let
daysControlView
=
DaysControlView
()
private
let
daysControlView
=
DaysControlView
()
private
let
coordinator
:
ForecastCoordinator
private
let
coordinator
:
ForecastCoordinator
...
@@ -278,11 +278,13 @@ extension ForecastViewController: UITableViewDataSource {
...
@@ -278,11 +278,13 @@ extension ForecastViewController: UITableViewDataSource {
//MARK:- ViewModel Delegate
//MARK:- ViewModel Delegate
extension
ForecastViewController
:
ForecastViewModelDelegate
{
extension
ForecastViewController
:
ForecastViewModelDelegate
{
func
viewModelDidChange
<
P
>
(
model
:
P
)
where
P
:
ViewModelProtocol
{
func
viewModelDidChange
<
P
>
(
model
:
P
)
where
P
:
ViewModelProtocol
{
refreshCityButton
()
onMain
{
refreshTimePeriodControl
()
self
.
refreshCityButton
()
forecastCellFactory
.
setNeedsUpdate
()
self
.
refreshTimePeriodControl
()
tableView
.
reloadData
()
self
.
forecastCellFactory
.
setNeedsUpdate
()
refreshDayButtons
()
self
.
tableView
.
reloadData
()
self
.
refreshDayButtons
()
}
}
}
func
selectedWeatherDidChange
()
{
func
selectedWeatherDidChange
()
{
...
...
1Weather/ViewModels/ForecastViewModel.swift
View file @
87d13ddf
...
@@ -100,10 +100,9 @@ extension ForecastViewModel: SettingsDelegate {
...
@@ -100,10 +100,9 @@ extension ForecastViewModel: SettingsDelegate {
}
}
}
}
//MARK: - StoreManager Observer
extension
ForecastViewModel
:
StoreManagerObserver
{
extension
ForecastViewModel
:
StoreManagerObserver
{
func
storeManagerUpdatedStatus
(
_
storeManager
:
StoreManager
)
{
func
storeManagerUpdatedStatus
(
_
storeManager
:
StoreManager
)
{
onMain
{
self
.
delegate
?
.
viewModelDidChange
(
model
:
self
)
self
.
delegate
?
.
viewModelDidChange
(
model
:
self
)
}
}
}
}
}
1Weather/ViewModels/TodayViewModel.swift
View file @
87d13ddf
...
@@ -41,7 +41,7 @@ class TodayViewModel: ViewModelProtocol {
...
@@ -41,7 +41,7 @@ class TodayViewModel: ViewModelProtocol {
FeatureAvailabilityManager
.
shared
FeatureAvailabilityManager
.
shared
}
}
public
lazy
var
todayCellFactory
:
TodayCellFactory
=
{
public
lazy
var
todayCellFactory
:
TodayCellFactory
=
{
let
factory
=
TodayCellFactory
(
viewModel
:
self
)
let
factory
=
TodayCellFactory
(
viewModel
:
self
)
factory
.
delegate
=
self
factory
.
delegate
=
self
return
factory
return
factory
...
...
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