Skip to content

Commit e06b63b

Browse files
committed
move survey trigger to app coordinator
1 parent a5f48e9 commit e06b63b

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

WooCommerce/Classes/POS/TabBar/POSTabCoordinator.swift

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -116,21 +116,11 @@ final class POSTabCoordinator {
116116
}
117117

118118
func onTabSelected() {
119-
schedulePOSSurveyNotificationIfNeeded()
120119
presentPOSView(siteID: siteID)
121120
}
122121
}
123122

124123
private extension POSTabCoordinator {
125-
func schedulePOSSurveyNotificationIfNeeded() {
126-
Task { @MainActor in
127-
await POSNotificationScheduler().scheduleLocalNotificationIfEligible(for: .currentMerchant)
128-
129-
let action = AppSettingsAction.setHasPOSBeenOpenedAtLeastOnce { _ in }
130-
storesManager.dispatch(action)
131-
}
132-
}
133-
134124
func presentPOSView(siteID: Int64) {
135125
Task { @MainActor [weak self] in
136126
guard let self else { return }

WooCommerce/Classes/ViewRelated/AppCoordinator.swift

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ final class AppCoordinator {
6565

6666
// Configures authenticator first in case `WordPressAuthenticator` is used in other `AppDelegate` launch events.
6767
configureAuthenticator()
68+
69+
schedulePOSSurveyNotificationIfNeeded()
6870
}
6971

7072
func start() {
@@ -101,6 +103,17 @@ final class AppCoordinator {
101103
}
102104
}
103105

106+
private extension AppCoordinator {
107+
func schedulePOSSurveyNotificationIfNeeded() {
108+
Task { @MainActor in
109+
await POSNotificationScheduler(stores: stores).scheduleLocalNotificationIfEligible(for: .currentMerchant)
110+
111+
let action = AppSettingsAction.setHasPOSBeenOpenedAtLeastOnce { _ in }
112+
stores.dispatch(action)
113+
}
114+
}
115+
}
116+
104117
private extension AppCoordinator {
105118
// Fetch latest site properties and update the default store if anything has changed:
106119
//

0 commit comments

Comments
 (0)