Skip to content
This repository was archived by the owner on May 10, 2024. It is now read-only.

Commit 2b9b57e

Browse files
committed
[ads] Unify iOS kBraveNTPBrandedWallpaper
1 parent 6a8cc08 commit 2b9b57e

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

Sources/Brave/Frontend/Browser/HomePanel/NTPDataSource.swift

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,6 @@ public class NTPDataSource {
7171
/// This is reset on each launch, so `3` can be shown again if app is removed from memory.
7272
/// This number _must_ be less than the number of backgrounds!
7373
private static let numberOfDuplicateAvoidance = 6
74-
/// The number of images in a sponsorship rotation.
75-
/// i.e. This number will be repeated before a new sponsorship is shown.
76-
/// If sposnored image is shown as Nth image, this number of normal images will be shown before Nth is reached again.
77-
private static let sponsorshipShowRate = 4
78-
/// On this value, a sponsored image will be shown.
79-
private static let sponsorshipShowValue = 2
8074

8175
/// The counter that indicates what background should be shown, this is used to determine when a new
8276
/// sponsored image should be shown. (`1` means, first image in cycle N, should be shown).
@@ -133,7 +127,7 @@ public class NTPDataSource {
133127
if let sponsor = service.sponsoredImageData {
134128
let attemptSponsored =
135129
Preferences.NewTabPage.backgroundSponsoredImages.value
136-
&& backgroundRotationCounter == NTPDataSource.sponsorshipShowValue
130+
&& backgroundRotationCounter == service.initialCountToBrandedWallpaper
137131
&& !privateBrowsingManager.isPrivateBrowsing
138132

139133
if attemptSponsored {
@@ -186,7 +180,7 @@ public class NTPDataSource {
186180
}()
187181

188182
// Force back to `0` if at end
189-
backgroundRotationCounter %= NTPDataSource.sponsorshipShowRate
183+
backgroundRotationCounter %= service.countToBrandedWallpaper
190184
// Increment regardless, this is a counter, not an index, so smallest should be `1`
191185
backgroundRotationCounter += 1
192186

0 commit comments

Comments
 (0)