File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed
WordPress/Classes/System/Root View Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -64,6 +64,10 @@ final class SplitViewRootPresenter: RootViewPresenter {
6464 self ? . handleCoreDataChanges ( $0)
6565 }
6666 . store ( in: & cancellables)
67+
68+ NotificationCenter . default. publisher ( for: UIApplication . didBecomeActiveNotification)
69+ . sink { [ weak self] _ in self ? . applicationDidBecomeActive ( ) }
70+ . store ( in: & cancellables)
6771 }
6872
6973 private func configure( for selection: SidebarSelection ) {
@@ -112,6 +116,8 @@ final class SplitViewRootPresenter: RootViewPresenter {
112116 DispatchQueue . main. async {
113117 self . splitVC. hide ( . primary)
114118 }
119+
120+ trackAnalytics ( for: selection)
115121 }
116122
117123 private func makeRootNavigationController( with viewController: UIViewController ) -> UINavigationController {
@@ -198,6 +204,23 @@ final class SplitViewRootPresenter: RootViewPresenter {
198204 }
199205 }
200206
207+ // MARK: Analytics
208+
209+ private func applicationDidBecomeActive( ) {
210+ guard let selection = sidebarViewModel. selection, splitVC. isViewOnScreen ( ) else {
211+ return
212+ }
213+ trackAnalytics ( for: selection)
214+ }
215+
216+ private func trackAnalytics( for selection: SidebarSelection ) {
217+ switch selection {
218+ case . blog: WPAnalytics . track ( . mySitesTabAccessed)
219+ case . reader: WPAnalytics . track ( . readerAccessed)
220+ default : break
221+ }
222+ }
223+
201224 // MARK: – RootViewPresenter
202225
203226 // MARK: RootViewPresenter (General)
You can’t perform that action at this time.
0 commit comments