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
e26369f0
Commit
e26369f0
authored
Oct 21, 2021
by
Dmitry Stepanets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[IOS-287]: Finished appear logic, added instrumentation
parent
b49a5aba
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
33 additions
and
34 deletions
+33
-34
1Weather/Coordinators/AppCoordinator.swift
+25
-0
1Weather/Coordinators/TodayCoordinator.swift
+0
-34
1Weather/UI/View controllers/Subscriptions/SubscriptionPopUpViewController.swift
+5
-0
1Weather/UI/View controllers/Subscriptions/SubscriptionStoreViewController.swift
+1
-0
OneWeatherAnalytics/OneWeatherAnalytics/AnalyticsEvent.swift
+2
-0
No files found.
1Weather/Coordinators/AppCoordinator.swift
View file @
e26369f0
...
...
@@ -145,6 +145,7 @@ class AppCoordinator: Coordinator {
//Search the TodayCoordinator
let
todayCoordinator
=
(
self
.
childCoordinators
.
first
{
$0
is
TodayCoordinator
}
as?
TodayCoordinator
)
todayCoordinator
?
.
showOnboardingOrPrivacyNoticeIfNeeded
()
self
.
showPremiumNudgeIfNeeded
()
})
}
}
...
...
@@ -207,6 +208,30 @@ class AppCoordinator: Coordinator {
tabBarController
.
updateTabs
()
}
private
func
openSubscriptionStorePopUp
()
{
let
subscriptionCoordinator
=
SubscriptionCoordinator
(
parentViewController
:
tabBarController
)
subscriptionCoordinator
.
parentCoordinator
=
self
childCoordinators
.
append
(
subscriptionCoordinator
)
subscriptionCoordinator
.
startPopUp
()
AppAnalytics
.
shared
.
log
(
event
:
.
ANALYTICS_PREMIUM_NUDGE_VIEW
)
}
private
func
showPremiumNudgeIfNeeded
()
{
let
appLaunchCount
=
Settings
.
shared
.
appLaunchCount
let
currentAttemptsCount
=
Settings
.
shared
.
premiumNudgeAttempstCount
let
totalAttempts
=
ConfigManager
.
shared
.
config
.
premiumNudgeTotalTimes
let
sessionCount
=
ConfigManager
.
shared
.
config
.
premiumNudgeSessionShowing
guard
appLaunchCount
>
1
&&
currentAttemptsCount
<
totalAttempts
&&
!
StoreManager
.
shared
.
hasSubscription
else
{
return
}
if
appLaunchCount
%
sessionCount
==
0
{
Settings
.
shared
.
premiumNudgeAttempstCount
+=
1
self
.
openSubscriptionStorePopUp
()
}
}
func
viewControllerDidEnd
(
controller
:
UIViewController
)
{
//do nothing
}
...
...
1Weather/Coordinators/TodayCoordinator.swift
View file @
e26369f0
...
...
@@ -16,7 +16,6 @@ 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
...
...
@@ -36,11 +35,6 @@ class TodayCoordinator: Coordinator {
}
navigationController
.
viewControllers
=
[
todayViewController
]
tabBarController
?
.
add
(
viewController
:
navigationController
)
ConfigManager
.
shared
.
add
(
delegate
:
self
)
if
waitingForConfig
==
false
{
showPremiumNudgeIfNeeded
()
}
}
public
func
showOnboardingOrPrivacyNoticeIfNeeded
()
{
...
...
@@ -110,32 +104,4 @@ 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
()
}
}
1Weather/UI/View controllers/Subscriptions/SubscriptionPopUpViewController.swift
View file @
e26369f0
...
...
@@ -43,6 +43,11 @@ class SubscriptionPopUpViewController: UIViewController {
Settings
.
shared
.
initialSubscriptionShown
=
true
}
override
func
viewDidDisappear
(
_
animated
:
Bool
)
{
super
.
viewDidDisappear
(
animated
)
AppAnalytics
.
shared
.
log
(
event
:
.
ANALYTICS_PREMIUM_NUDGE_CLOSE
)
}
}
private
extension
SubscriptionPopUpViewController
{
...
...
1Weather/UI/View controllers/Subscriptions/SubscriptionStoreViewController.swift
View file @
e26369f0
...
...
@@ -131,6 +131,7 @@ private extension SubscriptionStoreViewController {
}
}
//MARK: - Header Delegate
extension
SubscriptionStoreViewController
:
SubscriptionTopViewDelegate
{
func
handleCloseButton
()
{
self
.
dismiss
(
animated
:
true
)
...
...
OneWeatherAnalytics/OneWeatherAnalytics/AnalyticsEvent.swift
View file @
e26369f0
...
...
@@ -147,6 +147,8 @@ public enum AnalyticsEvent: String {
case
ANALYTICS_SUBSCRIPTION_UPGRADE_MONTHLY_CLICK
=
"UPGRADE_MONTHLY_CLICK"
case
ANALYTICS_SUBSCRIPTION_VIEW_PREMIUM_SUCCESS
=
"VIEW_PREMIUM_SUCCESS"
case
ANALYTICS_SUBSCRIPTION_PREMIUM_HAMBURGER_CLICK
=
"PREMIUM_HAMBURGER_CLICK"
case
ANALYTICS_PREMIUM_NUDGE_VIEW
=
"VIEW_PREMIUM_NUDGE"
case
ANALYTICS_PREMIUM_NUDGE_CLOSE
=
"CLOSE_PREMIUM_NUDGE"
// MARK: Minutely
case
ANALYTICS_MINUTELY_PRECIP_TODAY_SEEN
=
"MINUTELY_PRECIP_TODAY_SEEN"
...
...
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