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
26b4dba9
Commit
26b4dba9
authored
Oct 15, 2021
by
Dmitry Stepanets
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'bugfix/iOS-276-pro-getting-ads' into develop
parents
e9df79fd
b0525afd
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 @
26b4dba9
...
@@ -101,10 +101,13 @@ public class StoreManager {
...
@@ -101,10 +101,13 @@ public class StoreManager {
private
func
completeTransactions
()
{
private
func
completeTransactions
()
{
// This SHOULD ONLY BE CALLED ONCE, in the AppDelegate
// This SHOULD ONLY BE CALLED ONCE, in the AppDelegate
let
log
=
self
.
log
let
log
=
self
.
log
log
.
info
(
"Started complete transaction..."
)
SwiftyStoreKit
.
completeTransactions
(
atomically
:
true
)
{
purchases
in
SwiftyStoreKit
.
completeTransactions
(
atomically
:
true
)
{
purchases
in
log
.
info
(
"Complete transactions for
\(
purchases
.
count
)
purchases"
)
log
.
info
(
"Complete transactions for
\(
purchases
.
count
)
purchases"
)
for
purchase
in
purchases
{
for
purchase
in
purchases
{
log
.
info
(
"Purchase
\(
purchase
.
productId
)
:
\(
purchase
.
transaction
.
transactionState
)
"
)
log
.
info
(
"Purchase
\(
purchase
.
productId
)
:
\(
purchase
.
transaction
.
transactionState
)
"
)
switch
purchase
.
transaction
.
transactionState
{
switch
purchase
.
transaction
.
transactionState
{
case
.
purchased
,
.
restored
:
case
.
purchased
,
.
restored
:
if
purchase
.
needsFinishTransaction
{
if
purchase
.
needsFinishTransaction
{
...
@@ -179,6 +182,8 @@ public class StoreManager {
...
@@ -179,6 +182,8 @@ public class StoreManager {
if
product
.
needsFinishTransaction
{
if
product
.
needsFinishTransaction
{
SwiftyStoreKit
.
finishTransaction
(
product
.
transaction
)
SwiftyStoreKit
.
finishTransaction
(
product
.
transaction
)
}
}
self
.
hasSubscription
=
true
self
.
everHadSubscription
=
true
completion
(
true
)
completion
(
true
)
case
.
error
(
error
:
let
error
):
case
.
error
(
error
:
let
error
):
log
.
error
(
"Purchase: error for
\(
product
.
productIdentifier
)
:
\(
error
)
"
)
log
.
error
(
"Purchase: error for
\(
product
.
productIdentifier
)
:
\(
error
)
"
)
...
@@ -272,15 +277,11 @@ public class StoreManager {
...
@@ -272,15 +277,11 @@ public class StoreManager {
}
}
case
.
error
(
let
error
):
case
.
error
(
let
error
):
log
.
error
(
"Receipt verification failed:
\(
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
)
{
public
func
add
(
observer
:
StoreManagerObserver
)
{
observers
.
add
(
delegate
:
observer
)
observers
.
add
(
delegate
:
observer
)
}
}
...
...
1Weather/UI/SharedViews/MinutelyForecastView/MinutelyForecastView.swift
View file @
26b4dba9
...
@@ -137,6 +137,7 @@ class MinutelyForecastView: UIView {
...
@@ -137,6 +137,7 @@ class MinutelyForecastView: UIView {
private
var
minutelyForecast
=
[
MinutelyItem
]()
private
var
minutelyForecast
=
[
MinutelyItem
]()
private
var
timer
:
Timer
?
private
var
timer
:
Timer
?
private
var
trackUserSwipe
=
false
private
var
trackUserSwipe
=
false
private
var
initialyConfigured
=
false
private
var
forecastType
=
MinutelyForecastType
.
temperature
private
var
forecastType
=
MinutelyForecastType
.
temperature
private
var
smartTextProvider
:
SmartTextProvider
=
SmartTextProvider
(
prioritizedSmartTexts
:
[])
private
var
smartTextProvider
:
SmartTextProvider
=
SmartTextProvider
(
prioritizedSmartTexts
:
[])
...
@@ -213,6 +214,13 @@ class MinutelyForecastView: UIView {
...
@@ -213,6 +214,13 @@ class MinutelyForecastView: UIView {
updateChart
()
updateChart
()
configureTimer
()
configureTimer
()
updateCurrentSelectedLevel
()
updateCurrentSelectedLevel
()
if
let
firstItem
=
location
.
minutely
?
.
forecast
.
first
{
if
initialyConfigured
==
false
{
updateDetailsView
(
minutelyItem
:
firstItem
)
initialyConfigured
=
true
}
}
}
}
private
func
configureTimer
()
{
private
func
configureTimer
()
{
...
...
1Weather/ViewModels/TodayViewModel.swift
View file @
26b4dba9
...
@@ -52,7 +52,11 @@ class TodayViewModel: ViewModelProtocol {
...
@@ -52,7 +52,11 @@ class TodayViewModel: ViewModelProtocol {
NotificationCenter
.
default
.
removeObserver
(
self
)
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
.
locationManager
=
locationManager
self
.
configManager
=
configManager
self
.
configManager
=
configManager
self
.
shortsManager
=
shortsManager
self
.
shortsManager
=
shortsManager
...
@@ -183,7 +187,7 @@ class TodayViewModel: ViewModelProtocol {
...
@@ -183,7 +187,7 @@ class TodayViewModel: ViewModelProtocol {
}
}
}
}
//MARK:
-
LocationManager Delegate
//MARK: LocationManager Delegate
extension
TodayViewModel
:
LocationManagerDelegate
{
extension
TodayViewModel
:
LocationManagerDelegate
{
func
locationManager
(
_
locationManager
:
LocationManager
,
changedSelectedLocation
newLocation
:
Location
?)
{
func
locationManager
(
_
locationManager
:
LocationManager
,
changedSelectedLocation
newLocation
:
Location
?)
{
onMain
{
onMain
{
...
@@ -201,27 +205,28 @@ extension TodayViewModel: LocationManagerDelegate {
...
@@ -201,27 +205,28 @@ extension TodayViewModel: LocationManagerDelegate {
}
}
}
}
//MARK: StoreManager Observer
extension
TodayViewModel
:
StoreManagerObserver
{
extension
TodayViewModel
:
StoreManagerObserver
{
func
storeManagerUpdatedStatus
(
_
storeManager
:
StoreManager
)
{
func
storeManagerUpdatedStatus
(
_
storeManager
:
StoreManager
)
{
handlePremiumStateChange
()
handlePremiumStateChange
()
}
}
}
}
//MARK:
-
Settings Delegate
//MARK: Settings Delegate
extension
TodayViewModel
:
SettingsDelegate
{
extension
TodayViewModel
:
SettingsDelegate
{
func
settingsDidChange
()
{
func
settingsDidChange
()
{
delegate
?
.
viewModelDidChange
(
model
:
self
)
delegate
?
.
viewModelDidChange
(
model
:
self
)
}
}
}
}
//
MARK: CellFactoryDelegate
//MARK: CellFactoryDelegate
extension
TodayViewModel
:
CellFactoryDelegate
{
extension
TodayViewModel
:
CellFactoryDelegate
{
func
cellFactoryCellsChanged
(
_
factory
:
CellFactory
)
{
func
cellFactoryCellsChanged
(
_
factory
:
CellFactory
)
{
delegate
?
.
viewModelDidChange
(
model
:
self
)
delegate
?
.
viewModelDidChange
(
model
:
self
)
}
}
}
}
//MARK:
-
ShortsManager Delegate
//MARK: ShortsManager Delegate
extension
TodayViewModel
:
ShortsManagerDelegate
{
extension
TodayViewModel
:
ShortsManagerDelegate
{
func
shortsDidChange
()
{
func
shortsDidChange
()
{
onMain
{
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