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
3b2b8b58
Commit
3b2b8b58
authored
Oct 13, 2021
by
Dmitry Stepanets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[IOS-276]: Fixed Ads showing for pro users
parent
c464fb65
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
10 deletions
+24
-10
1Weather/InApps/StoreManager.swift
+6
-5
1Weather/UI/SharedViews/MinutelyForecastView/MinutelyForecastView.swift
+8
-0
1Weather/ViewModels/TodayViewModel.swift
+10
-5
No files found.
1Weather/InApps/StoreManager.swift
View file @
3b2b8b58
...
...
@@ -101,10 +101,13 @@ public class StoreManager {
private
func
completeTransactions
()
{
// This SHOULD ONLY BE CALLED ONCE, in the AppDelegate
let
log
=
self
.
log
log
.
info
(
"Started complete transaction..."
)
SwiftyStoreKit
.
completeTransactions
(
atomically
:
true
)
{
purchases
in
log
.
info
(
"Complete transactions for
\(
purchases
.
count
)
purchases"
)
for
purchase
in
purchases
{
log
.
info
(
"Purchase
\(
purchase
.
productId
)
:
\(
purchase
.
transaction
.
transactionState
)
"
)
switch
purchase
.
transaction
.
transactionState
{
case
.
purchased
,
.
restored
:
if
purchase
.
needsFinishTransaction
{
...
...
@@ -179,6 +182,8 @@ public class StoreManager {
if
product
.
needsFinishTransaction
{
SwiftyStoreKit
.
finishTransaction
(
product
.
transaction
)
}
self
.
hasSubscription
=
true
self
.
everHadSubscription
=
true
completion
(
true
)
case
.
error
(
error
:
let
error
):
log
.
error
(
"Purchase: error for
\(
product
.
productIdentifier
)
:
\(
error
)
"
)
...
...
@@ -272,15 +277,11 @@ public class StoreManager {
}
case
.
error
(
let
error
):
log
.
error
(
"Receipt verification failed:
\(
error
)
"
)
self
.
hasSubscription
=
false
self
.
everHadSubscription
=
false
self
.
removeAdsPurchased
=
false
self
.
subscriptionExpirationDate
=
nil
}
}
}
//MARK: - Observers management
//MARK: - Observers management
public
func
add
(
observer
:
StoreManagerObserver
)
{
observers
.
add
(
delegate
:
observer
)
}
...
...
1Weather/UI/SharedViews/MinutelyForecastView/MinutelyForecastView.swift
View file @
3b2b8b58
...
...
@@ -137,6 +137,7 @@ class MinutelyForecastView: UIView {
private
var
minutelyForecast
=
[
MinutelyItem
]()
private
var
timer
:
Timer
?
private
var
trackUserSwipe
=
false
private
var
initialyConfigured
=
false
private
var
forecastType
=
MinutelyForecastType
.
temperature
private
var
smartTextProvider
:
SmartTextProvider
=
SmartTextProvider
(
prioritizedSmartTexts
:
[])
...
...
@@ -213,6 +214,13 @@ class MinutelyForecastView: UIView {
updateChart
()
configureTimer
()
updateCurrentSelectedLevel
()
if
let
firstItem
=
location
.
minutely
?
.
forecast
.
first
{
if
initialyConfigured
==
false
{
updateDetailsView
(
minutelyItem
:
firstItem
)
initialyConfigured
=
true
}
}
}
private
func
configureTimer
()
{
...
...
1Weather/ViewModels/TodayViewModel.swift
View file @
3b2b8b58
...
...
@@ -52,7 +52,11 @@ class TodayViewModel: ViewModelProtocol {
NotificationCenter
.
default
.
removeObserver
(
self
)
}
public
init
(
locationManager
:
LocationManager
=
LocationManager
.
shared
,
configManager
:
ConfigManager
=
ConfigManager
.
shared
,
shortsManager
:
ShortsManager
=
ShortsManager
.
shared
,
storeManager
:
StoreManager
=
StoreManager
.
shared
)
{
public
init
(
locationManager
:
LocationManager
=
LocationManager
.
shared
,
configManager
:
ConfigManager
=
ConfigManager
.
shared
,
shortsManager
:
ShortsManager
=
ShortsManager
.
shared
,
storeManager
:
StoreManager
=
StoreManager
.
shared
)
{
self
.
locationManager
=
locationManager
self
.
configManager
=
configManager
self
.
shortsManager
=
shortsManager
...
...
@@ -183,7 +187,7 @@ class TodayViewModel: ViewModelProtocol {
}
}
//MARK:
-
LocationManager Delegate
//MARK: LocationManager Delegate
extension
TodayViewModel
:
LocationManagerDelegate
{
func
locationManager
(
_
locationManager
:
LocationManager
,
changedSelectedLocation
newLocation
:
Location
?)
{
onMain
{
...
...
@@ -201,27 +205,28 @@ extension TodayViewModel: LocationManagerDelegate {
}
}
//MARK: StoreManager Observer
extension
TodayViewModel
:
StoreManagerObserver
{
func
storeManagerUpdatedStatus
(
_
storeManager
:
StoreManager
)
{
handlePremiumStateChange
()
}
}
//MARK:
-
Settings Delegate
//MARK: Settings Delegate
extension
TodayViewModel
:
SettingsDelegate
{
func
settingsDidChange
()
{
delegate
?
.
viewModelDidChange
(
model
:
self
)
}
}
//
MARK: CellFactoryDelegate
//MARK: CellFactoryDelegate
extension
TodayViewModel
:
CellFactoryDelegate
{
func
cellFactoryCellsChanged
(
_
factory
:
CellFactory
)
{
delegate
?
.
viewModelDidChange
(
model
:
self
)
}
}
//MARK:
-
ShortsManager Delegate
//MARK: ShortsManager Delegate
extension
TodayViewModel
:
ShortsManagerDelegate
{
func
shortsDidChange
()
{
onMain
{
...
...
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