Skip to content

Commit

Permalink
Fix brave/brave-ios#8673: Move NTP P3A helper creation outside of NTP (
Browse files Browse the repository at this point in the history
…brave/brave-ios#8676)

There was a chance that a user would simply never load a NTP during their session which means that P3A rotations wouldn't trigger new NTP-SI reports each day. This report was supposed to occur each rotation, not specifically per NTP view.
  • Loading branch information
kylehickinson authored Jan 29, 2024
1 parent d5edb2a commit b0ca0ad
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,8 @@ public class BrowserViewController: UIViewController {

/// In app purchase obsever for VPN Subscription action
let iapObserver: IAPObserver

private let ntpP3AHelper: NewTabPageP3AHelper

public init(
windowId: UUID,
Expand Down Expand Up @@ -334,6 +336,7 @@ public class BrowserViewController: UIViewController {
}

iapObserver = BraveVPN.iapObserver
ntpP3AHelper = .init(p3aUtils: braveCore.p3aUtils)

super.init(nibName: nil, bundle: nil)
didInit()
Expand Down Expand Up @@ -1419,7 +1422,7 @@ public class BrowserViewController: UIViewController {
feedDataSource: feedDataSource,
rewards: rewards,
privateBrowsingManager: privateBrowsingManager,
p3aUtils: braveCore.p3aUtils
p3aHelper: ntpP3AHelper
)
// Donate NewTabPage Activity For Custom Suggestions
let newTabPageActivity =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,14 +140,14 @@ class NewTabPageViewController: UIViewController {
feedDataSource: FeedDataSource,
rewards: BraveRewards,
privateBrowsingManager: PrivateBrowsingManager,
p3aUtils: BraveP3AUtils
p3aHelper: NewTabPageP3AHelper
) {
self.tab = tab
self.rewards = rewards
self.feedDataSource = feedDataSource
self.privateBrowsingManager = privateBrowsingManager
self.backgroundButtonsView = NewTabPageBackgroundButtonsView(privateBrowsingManager: privateBrowsingManager)
self.p3aHelper = .init(p3aUtils: p3aUtils)
self.p3aHelper = p3aHelper
background = NewTabPageBackground(dataSource: dataSource)
notifications = NewTabPageNotifications(rewards: rewards)
collectionView = NewTabCollectionView(frame: .zero, collectionViewLayout: layout)
Expand Down

0 comments on commit b0ca0ad

Please sign in to comment.