From 735504656b87db6c05ed1f3efa56f7d25ab71c72 Mon Sep 17 00:00:00 2001 From: Terry Mancey Date: Wed, 4 Aug 2021 12:24:19 -0500 Subject: [PATCH] Fixes new tab page and promoted content ads should reward users for up to 4 ads per hour and 20 ads per day --- .../ads/new_tab_page_ads/new_tab_page_ad.cc | 6 ++++++ .../promoted_content_ads/promoted_content_ad.cc | 7 +++++++ .../src/bat/ads/internal/ads_impl.cc | 14 -------------- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/vendor/bat-native-ads/src/bat/ads/internal/ads/new_tab_page_ads/new_tab_page_ad.cc b/vendor/bat-native-ads/src/bat/ads/internal/ads/new_tab_page_ads/new_tab_page_ad.cc index 645f0cf4088b..5b2745d05d4f 100644 --- a/vendor/bat-native-ads/src/bat/ads/internal/ads/new_tab_page_ads/new_tab_page_ad.cc +++ b/vendor/bat-native-ads/src/bat/ads/internal/ads/new_tab_page_ads/new_tab_page_ad.cc @@ -91,6 +91,12 @@ void NewTabPageAd::FireEvent(const NewTabPageAdInfo& ad, return; } + if (event_type == NewTabPageAdEventType::kViewed) { + // TODO(tmancey): We need to fire an ad served event until new tab page + // ads are served by the ads library + FireEvent(uuid, creative_instance_id, NewTabPageAdEventType::kServed); + } + const auto ad_event = new_tab_page_ads::AdEventFactory::Build(event_type); ad_event->FireEvent(ad); diff --git a/vendor/bat-native-ads/src/bat/ads/internal/ads/promoted_content_ads/promoted_content_ad.cc b/vendor/bat-native-ads/src/bat/ads/internal/ads/promoted_content_ads/promoted_content_ad.cc index 45107ab88940..2dfb88e0fcae 100644 --- a/vendor/bat-native-ads/src/bat/ads/internal/ads/promoted_content_ads/promoted_content_ad.cc +++ b/vendor/bat-native-ads/src/bat/ads/internal/ads/promoted_content_ads/promoted_content_ad.cc @@ -94,6 +94,13 @@ void PromotedContentAd::FireEvent(const PromotedContentAdInfo& ad, return; } + if (event_type == PromotedContentAdEventType::kViewed) { + // TODO(tmancey): We need to fire an ad served event until promoted + // content ads are served by the ads library + FireEvent(uuid, creative_instance_id, + PromotedContentAdEventType::kServed); + } + const auto ad_event = promoted_content_ads::AdEventFactory::Build(event_type); ad_event->FireEvent(ad); diff --git a/vendor/bat-native-ads/src/bat/ads/internal/ads_impl.cc b/vendor/bat-native-ads/src/bat/ads/internal/ads_impl.cc index ce7a4cf8096d..6b2aa0e07113 100644 --- a/vendor/bat-native-ads/src/bat/ads/internal/ads_impl.cc +++ b/vendor/bat-native-ads/src/bat/ads/internal/ads_impl.cc @@ -313,13 +313,6 @@ void AdsImpl::OnAdNotificationEvent(const std::string& uuid, void AdsImpl::OnNewTabPageAdEvent(const std::string& uuid, const std::string& creative_instance_id, const NewTabPageAdEventType event_type) { - if (event_type == NewTabPageAdEventType::kViewed) { - // TODO(tmancey): We need to fire an ad served event until new tab page ads - // are served by the ads library - new_tab_page_ad_->FireEvent(uuid, creative_instance_id, - NewTabPageAdEventType::kServed); - } - new_tab_page_ad_->FireEvent(uuid, creative_instance_id, event_type); } @@ -327,13 +320,6 @@ void AdsImpl::OnPromotedContentAdEvent( const std::string& uuid, const std::string& creative_instance_id, const PromotedContentAdEventType event_type) { - if (event_type == PromotedContentAdEventType::kViewed) { - // TODO(tmancey): We need to fire an ad served event until promoted content - // ads are served by the ads library - promoted_content_ad_->FireEvent(uuid, creative_instance_id, - PromotedContentAdEventType::kServed); - } - promoted_content_ad_->FireEvent(uuid, creative_instance_id, event_type); }