Skip to content

Commit

Permalink
Fix incorrectly tracking reader accessed event in the WordPress app (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
hassaanelgarem authored Feb 22, 2024
2 parents 4f4cfc0 + 015a206 commit 39f08e5
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@

// MARK: - Tab Access Tracking

fileprivate 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]

Expand Down Expand Up @@ -84,6 +99,10 @@ extension WPTabBarController {
return false
}

if tabType.hasStaticScreen && shouldUseStaticScreens {
return false
}

WPAppAnalytics.track(stat)

return true
Expand Down
1 change: 1 addition & 0 deletions WordPress/Classes/ViewRelated/System/WPTabBarController.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ extern NSNotificationName const WPTabBarHeightChangedNotification;
@property (nonatomic, strong, readonly, nullable) ReaderCoordinator *readerCoordinator;
@property (nonatomic, strong) id<ScenePresenter> meScenePresenter;
@property (nonatomic, strong, readonly) ReaderTabViewModel *readerTabViewModel;
@property (nonatomic, assign) BOOL shouldUseStaticScreens;

- (instancetype)initWithStaticScreens:(BOOL)shouldUseStaticScreens;

Expand Down
2 changes: 0 additions & 2 deletions WordPress/Classes/ViewRelated/System/WPTabBarController.m
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@

@interface WPTabBarController () <UITabBarControllerDelegate, UIViewControllerRestoration>

@property (nonatomic, assign) BOOL shouldUseStaticScreens;

@property (nonatomic, strong) NotificationsViewController *notificationsViewController;

@property (nonatomic, strong) UINavigationController *readerNavigationController;
Expand Down

0 comments on commit 39f08e5

Please sign in to comment.