diff --git a/components/brave_ads/browser/ads_service.cc b/components/brave_ads/browser/ads_service.cc index 0a5b61b2c75c..923921246a2f 100644 --- a/components/brave_ads/browser/ads_service.cc +++ b/components/brave_ads/browser/ads_service.cc @@ -54,7 +54,7 @@ void AdsService::RegisterProfilePrefs( registry->RegisterUint64Pref( ads::prefs::kAdsPerHour, 2); registry->RegisterUint64Pref( - ads::prefs::kAdsPerDay, 20); + ads::prefs::kAdsPerDay, 40); registry->RegisterIntegerPref( ads::prefs::kIdleThreshold, 15); diff --git a/components/brave_ads/browser/ads_service_impl.cc b/components/brave_ads/browser/ads_service_impl.cc index 8723a44e7a27..ea61962ecb3d 100644 --- a/components/brave_ads/browser/ads_service_impl.cc +++ b/components/brave_ads/browser/ads_service_impl.cc @@ -514,7 +514,7 @@ uint64_t AdsServiceImpl::GetAdsPerHour() const { uint64_t AdsServiceImpl::GetAdsPerDay() const { return base::ClampToRange(GetUint64Pref(ads::prefs::kAdsPerDay), - static_cast(1), static_cast(20)); + static_cast(1), static_cast(40)); } bool AdsServiceImpl::ShouldAllowAdsSubdivisionTargeting() const { @@ -1342,7 +1342,8 @@ bool AdsServiceImpl::MigratePrefs( {{4, 5}, &AdsServiceImpl::MigratePrefsVersion4To5}, {{5, 6}, &AdsServiceImpl::MigratePrefsVersion5To6}, {{6, 7}, &AdsServiceImpl::MigratePrefsVersion6To7}, - {{7, 8}, &AdsServiceImpl::MigratePrefsVersion7To8} + {{7, 8}, &AdsServiceImpl::MigratePrefsVersion7To8}, + {{8, 9}, &AdsServiceImpl::MigratePrefsVersion8To9} }; // Cycle through migration paths, i.e. if upgrading from version 2 to 5 we @@ -1553,6 +1554,13 @@ void AdsServiceImpl::MigratePrefsVersion7To8() { } } +void AdsServiceImpl::MigratePrefsVersion8To9() { + // Unlike Muon, ads per day are not configurable in the UI so we can safely + // migrate to the new value + + SetUint64Pref(ads::prefs::kAdsPerDay, 40); +} + int AdsServiceImpl::GetPrefsVersion() const { return GetIntegerPref(prefs::kVersion); } diff --git a/components/brave_ads/browser/ads_service_impl.h b/components/brave_ads/browser/ads_service_impl.h index 2b03a86bde47..3211a121088e 100644 --- a/components/brave_ads/browser/ads_service_impl.h +++ b/components/brave_ads/browser/ads_service_impl.h @@ -323,6 +323,7 @@ class AdsServiceImpl : public AdsService, void MigratePrefsVersion5To6(); void MigratePrefsVersion6To7(); void MigratePrefsVersion7To8(); + void MigratePrefsVersion8To9(); int GetPrefsVersion() const; bool IsUpgradingFromPreBraveAdsBuild(); diff --git a/components/brave_ads/common/pref_names.cc b/components/brave_ads/common/pref_names.cc index 269aa0ff57db..6d25f14536d3 100644 --- a/components/brave_ads/common/pref_names.cc +++ b/components/brave_ads/common/pref_names.cc @@ -34,7 +34,7 @@ const int kSupportedCountryCodesSchemaVersionNumber = 9; // Stores the preferences version number const char kVersion[] = "brave.brave_ads.prefs.version"; -const int kCurrentVersionNumber = 8; +const int kCurrentVersionNumber = 9; } // namespace prefs diff --git a/vendor/bat-native-ads/src/bat/ads/internal/frequency_capping/permission_rules/ads_per_day_frequency_cap.cc b/vendor/bat-native-ads/src/bat/ads/internal/frequency_capping/permission_rules/ads_per_day_frequency_cap.cc index 50479e8c6cb8..dca2dead6318 100644 --- a/vendor/bat-native-ads/src/bat/ads/internal/frequency_capping/permission_rules/ads_per_day_frequency_cap.cc +++ b/vendor/bat-native-ads/src/bat/ads/internal/frequency_capping/permission_rules/ads_per_day_frequency_cap.cc @@ -47,7 +47,7 @@ bool AdsPerDayFrequencyCap::DoesRespectCap( base::Time::kHoursPerDay; const uint64_t cap = - AdsClientHelper::Get()->GetUint64Pref(prefs::kAdsPerHour); + AdsClientHelper::Get()->GetUint64Pref(prefs::kAdsPerDay); return DoesHistoryRespectCapForRollingTimeConstraint( history, time_constraint, cap); diff --git a/vendor/bat-native-ads/src/bat/ads/internal/unittest_util.cc b/vendor/bat-native-ads/src/bat/ads/internal/unittest_util.cc index a9f0f6d46ce7..5eabe4605fb6 100644 --- a/vendor/bat-native-ads/src/bat/ads/internal/unittest_util.cc +++ b/vendor/bat-native-ads/src/bat/ads/internal/unittest_util.cc @@ -432,7 +432,7 @@ void MockDefaultPrefs( mock->SetBooleanPref(prefs::kEnabled, true); mock->SetUint64Pref(prefs::kAdsPerHour, 2); - mock->SetUint64Pref(prefs::kAdsPerDay, 20); + mock->SetUint64Pref(prefs::kAdsPerDay, 40); mock->SetIntegerPref(prefs::kIdleThreshold, 15); diff --git a/vendor/brave-ios/Ads/BATBraveAds.mm b/vendor/brave-ios/Ads/BATBraveAds.mm index 9d54d7dc7e4d..2245421e14a3 100644 --- a/vendor/brave-ios/Ads/BATBraveAds.mm +++ b/vendor/brave-ios/Ads/BATBraveAds.mm @@ -33,7 +33,7 @@ + (__type)__objc_getter { return ads::__cpp_var; } \ + (void)__objc_setter:(__type)newValue { ads::__cpp_var = newValue; } -static const NSInteger kDefaultNumberOfAdsPerDay = 20; +static const NSInteger kDefaultNumberOfAdsPerDay = 40; static const NSInteger kDefaultNumberOfAdsPerHour = 2; static const int kCurrentUserModelManifestSchemaVersion = 1;