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
b49a5aba
Commit
b49a5aba
authored
Oct 21, 2021
by
Dmitry Stepanets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Working on presentation logic
parent
a936f5c7
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
1 deletions
+42
-1
1Weather/AppDelegate.swift
+2
-1
1Weather/Coordinators/TodayCoordinator.swift
+34
-0
OneWeatherCore/OneWeatherCore/Settings/Settings.swift
+6
-0
No files found.
1Weather/AppDelegate.swift
View file @
b49a5aba
...
...
@@ -149,6 +149,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
EssentialDependencies
()
.
resolve
()
storeManager
.
add
(
observer
:
LocationManager
.
shared
)
Settings
.
shared
.
appLaunchCount
+=
1
return
true
}
...
...
@@ -270,7 +271,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
case
.
subscriptionNudge
:
break
//config only
case
.
initialSubscriptionNudge
:
availabilityCheckers
[
feature
]
=
!
initialSubscriptionShown
&&
firstTimeUser
&&
!
premium
availabilityCheckers
[
feature
]
=
!
initialSubscriptionShown
&&
firstTimeUser
&&
!
activeProSubscription
case
.
subscriptionForPro
:
availabilityCheckers
[
feature
]
=
premium
case
.
extendedDailyForecast
:
...
...
1Weather/Coordinators/TodayCoordinator.swift
View file @
b49a5aba
...
...
@@ -16,6 +16,7 @@ class TodayCoordinator: Coordinator {
// MARK: - Private
private
let
navigationController
=
ColoredNavigationController
(
nibName
:
nil
,
bundle
:
nil
)
private
var
tabBarController
:
UITabBarController
?
private
var
waitingForConfig
=
true
var
todayViewController
:
TodayViewController
?
// MARK: - Public
...
...
@@ -35,6 +36,11 @@ class TodayCoordinator: Coordinator {
}
navigationController
.
viewControllers
=
[
todayViewController
]
tabBarController
?
.
add
(
viewController
:
navigationController
)
ConfigManager
.
shared
.
add
(
delegate
:
self
)
if
waitingForConfig
==
false
{
showPremiumNudgeIfNeeded
()
}
}
public
func
showOnboardingOrPrivacyNoticeIfNeeded
()
{
...
...
@@ -104,4 +110,32 @@ class TodayCoordinator: Coordinator {
}
}
}
public
func
showPremiumNudgeIfNeeded
()
{
guard
tabBarController
?
.
viewControllers
?
.
isEmpty
==
false
else
{
return
}
let
appLaunchCount
=
Settings
.
shared
.
appLaunchCount
let
currentAttemptsCount
=
Settings
.
shared
.
premiumNudgeAttempstCount
let
totalAttempts
=
ConfigManager
.
shared
.
config
.
premiumNudgeTotalTimes
let
sessionCount
=
ConfigManager
.
shared
.
config
.
premiumNudgeSessionShowing
guard
appLaunchCount
!=
0
&&
currentAttemptsCount
<=
totalAttempts
&&
!
StoreManager
.
shared
.
hasSubscription
else
{
return
}
if
appLaunchCount
%
sessionCount
==
0
{
Settings
.
shared
.
premiumNudgeAttempstCount
+=
1
self
.
openSubscriptionStorePopUp
()
}
}
}
//MARK: - ConfigManager Delegate
extension
TodayCoordinator
:
ConfigManagerDelegate
{
func
dataUpdated
(
by
configManager
:
ConfigManager
)
{
waitingForConfig
=
false
showPremiumNudgeIfNeeded
()
}
}
OneWeatherCore/OneWeatherCore/Settings/Settings.swift
View file @
b49a5aba
...
...
@@ -104,6 +104,12 @@ public class Settings {
@UserDefaultsBasicValue(key: "initial_subscription_shown", userDefaults: UserDefaults.appDefaults)
public
var
initialSubscriptionShown
=
false
@UserDefaultsBasicValue(key: "appLaunchCount", userDefaults: UserDefaults.appDefaults)
public
var
appLaunchCount
=
0
@UserDefaultsBasicValue(key: "premiumNudgeAttemptsCount", userDefaults: UserDefaults.appDefaults)
public
var
premiumNudgeAttempstCount
=
0
#warning("Not implemented!")
//TODO: implement store in UserDefaults and configure via UI in debug builds.
public
var
adLogging
:
Bool
=
true
...
...
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