From fe33e551fc4802663e322607edcc51ef6b09a889 Mon Sep 17 00:00:00 2001 From: Hassaan El-Garem Date: Tue, 20 Feb 2024 01:36:56 +0200 Subject: [PATCH 1/2] Update: only track reader accessed if not a static screen --- .../System/WPTabBarController+Swift.swift | 19 +++++++++++++++++++ .../ViewRelated/System/WPTabBarController.h | 1 + .../ViewRelated/System/WPTabBarController.m | 2 -- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/WordPress/Classes/ViewRelated/System/WPTabBarController+Swift.swift b/WordPress/Classes/ViewRelated/System/WPTabBarController+Swift.swift index f3617c48ca4b..2084356c1070 100644 --- a/WordPress/Classes/ViewRelated/System/WPTabBarController+Swift.swift +++ b/WordPress/Classes/ViewRelated/System/WPTabBarController+Swift.swift @@ -1,6 +1,21 @@ // MARK: - Tab Access Tracking +extension WPTab { + var hasStaticScreen: Bool { + switch self { + case .reader: + return true + case .notifications: + return true + case .mySites: + return false + case .me: + return false + } + } +} + extension WPTabBarController { private static let tabIndexToStatMap: [WPTab: WPAnalyticsStat] = [.mySites: .mySitesTabAccessed, .reader: .readerAccessed] @@ -84,6 +99,10 @@ extension WPTabBarController { return false } + if tabType.hasStaticScreen && shouldUseStaticScreens { + return false + } + WPAppAnalytics.track(stat) return true diff --git a/WordPress/Classes/ViewRelated/System/WPTabBarController.h b/WordPress/Classes/ViewRelated/System/WPTabBarController.h index 4313105dfb8f..c827b6ad195c 100644 --- a/WordPress/Classes/ViewRelated/System/WPTabBarController.h +++ b/WordPress/Classes/ViewRelated/System/WPTabBarController.h @@ -31,6 +31,7 @@ extern NSNotificationName const WPTabBarHeightChangedNotification; @property (nonatomic, strong, readonly, nullable) ReaderCoordinator *readerCoordinator; @property (nonatomic, strong) id meScenePresenter; @property (nonatomic, strong, readonly) ReaderTabViewModel *readerTabViewModel; +@property (nonatomic, assign) BOOL shouldUseStaticScreens; - (instancetype)initWithStaticScreens:(BOOL)shouldUseStaticScreens; diff --git a/WordPress/Classes/ViewRelated/System/WPTabBarController.m b/WordPress/Classes/ViewRelated/System/WPTabBarController.m index cf722e609c93..b493002cb3c8 100644 --- a/WordPress/Classes/ViewRelated/System/WPTabBarController.m +++ b/WordPress/Classes/ViewRelated/System/WPTabBarController.m @@ -49,8 +49,6 @@ @interface WPTabBarController () -@property (nonatomic, assign) BOOL shouldUseStaticScreens; - @property (nonatomic, strong) NotificationsViewController *notificationsViewController; @property (nonatomic, strong) UINavigationController *readerNavigationController; From 015a20616c11a2710f6edb9a6a9eb5b9b538e3bc Mon Sep 17 00:00:00 2001 From: Hassaan El-Garem Date: Thu, 22 Feb 2024 15:35:31 +0200 Subject: [PATCH 2/2] Update: Make `WPTab` extension private --- .../Classes/ViewRelated/System/WPTabBarController+Swift.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WordPress/Classes/ViewRelated/System/WPTabBarController+Swift.swift b/WordPress/Classes/ViewRelated/System/WPTabBarController+Swift.swift index 2084356c1070..3ea982042130 100644 --- a/WordPress/Classes/ViewRelated/System/WPTabBarController+Swift.swift +++ b/WordPress/Classes/ViewRelated/System/WPTabBarController+Swift.swift @@ -1,7 +1,7 @@ // MARK: - Tab Access Tracking -extension WPTab { +fileprivate extension WPTab { var hasStaticScreen: Bool { switch self { case .reader: