diff --git a/components/brave_ads/browser/ads_service.cc b/components/brave_ads/browser/ads_service.cc index 8b982c85f236..285a22e67c9b 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 3b08f75d1407..69777cae8b11 100644 --- a/components/brave_ads/browser/ads_service_impl.cc +++ b/components/brave_ads/browser/ads_service_impl.cc @@ -513,7 +513,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 { @@ -1347,7 +1347,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 @@ -1558,6 +1559,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 261c1b37cb7f..996e97221391 100644 --- a/components/brave_ads/browser/ads_service_impl.h +++ b/components/brave_ads/browser/ads_service_impl.h @@ -327,6 +327,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 e9ef0b5a9020..66c79989ac9f 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 @@ -50,7 +50,7 @@ bool AdsPerDayFrequencyCap::DoesRespectCap( base::Time::kHoursPerDay; const uint64_t cap = - ads_->get_ads_client()->GetUint64Pref(prefs::kAdsPerHour); + ads_->get_ads_client()->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 73b4f43a990b..59cbce744c4c 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 @@ -399,7 +399,7 @@ void MockClearPref( void MockDefaultPrefs( const std::unique_ptr& mock) { - mock->SetUint64Pref(prefs::kAdsPerDay, 20); + mock->SetUint64Pref(prefs::kAdsPerDay, 40); mock->SetUint64Pref(prefs::kAdsPerHour, 2); mock->SetBooleanPref(prefs::kEnabled, true); mock->SetBooleanPref(prefs::kShouldAllowConversionTracking, true); diff --git a/vendor/brave-ios/Ads/BATBraveAds.mm b/vendor/brave-ios/Ads/BATBraveAds.mm index 6a53acabe13c..4a7bf4d3da87 100644 --- a/vendor/brave-ios/Ads/BATBraveAds.mm +++ b/vendor/brave-ios/Ads/BATBraveAds.mm @@ -30,7 +30,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;