diff --git a/components/brave_rewards/browser/static_values.h b/components/brave_rewards/browser/static_values.h index 2fa55373366d..ad10ec8758d5 100644 --- a/components/brave_rewards/browser/static_values.h +++ b/components/brave_rewards/browser/static_values.h @@ -34,7 +34,7 @@ const std::vector kOnlyAnonWalletCountries = { const std::map kUInt64Options = { {ledger::kOptionPublisherListRefreshInterval, - 7* base::Time::kHoursPerDay * base::Time::kSecondsPerHour} + 7* base::Time::kHoursPerDay * base::Time::kSecondsPerHour}}; #else const std::map kBoolOptions = {}; @@ -48,9 +48,8 @@ const std::vector kOnlyAnonWalletCountries = { const std::map kUInt64Options = { {ledger::kOptionPublisherListRefreshInterval, - 3 * base::Time::kHoursPerDay * base::Time::kSecondsPerHour} + 3 * base::Time::kHoursPerDay * base::Time::kSecondsPerHour}}; #endif -}; } // namespace brave_rewards diff --git a/vendor/bat-native-ledger/src/bat/ledger/internal/ledger_impl.cc b/vendor/bat-native-ledger/src/bat/ledger/internal/ledger_impl.cc index e58770272cdf..7992c050199c 100644 --- a/vendor/bat-native-ledger/src/bat/ledger/internal/ledger_impl.cc +++ b/vendor/bat-native-ledger/src/bat/ledger/internal/ledger_impl.cc @@ -99,7 +99,7 @@ void LedgerImpl::OnWalletInitializedInternal( if (result == ledger::Result::LEDGER_OK || result == ledger::Result::WALLET_CREATED) { initialized_ = true; - bat_publisher_->SetPublisherServerListTimer(); + bat_publisher_->SetPublisherServerListTimer(GetRewardsMainEnabled()); bat_contribution_->SetReconcileTimer(); bat_promotion_->Refresh(false); bat_contribution_->Initialize(); @@ -602,6 +602,7 @@ void LedgerImpl::GetExcludedList(ledger::PublisherInfoListCallback callback) { void LedgerImpl::SetRewardsMainEnabled(bool enabled) { bat_state_->SetRewardsMainEnabled(enabled); + bat_publisher_->SetPublisherServerListTimer(enabled); } void LedgerImpl::SetPublisherMinVisitTime(uint64_t duration) { // In seconds diff --git a/vendor/bat-native-ledger/src/bat/ledger/internal/publisher/publisher.cc b/vendor/bat-native-ledger/src/bat/ledger/internal/publisher/publisher.cc index c6c7c036e2af..11d1d1f0402c 100644 --- a/vendor/bat-native-ledger/src/bat/ledger/internal/publisher/publisher.cc +++ b/vendor/bat-native-ledger/src/bat/ledger/internal/publisher/publisher.cc @@ -91,7 +91,12 @@ void Publisher::OnRefreshPublisherServerPublisher( callback(status); } -void Publisher::SetPublisherServerListTimer() { +void Publisher::SetPublisherServerListTimer(const bool rewards_enabled) { + if (!rewards_enabled) { + server_list_->ClearTimer(); + return; + } + server_list_->SetTimer(false); } diff --git a/vendor/bat-native-ledger/src/bat/ledger/internal/publisher/publisher.h b/vendor/bat-native-ledger/src/bat/ledger/internal/publisher/publisher.h index fc51bae16e89..8102b5091295 100644 --- a/vendor/bat-native-ledger/src/bat/ledger/internal/publisher/publisher.h +++ b/vendor/bat-native-ledger/src/bat/ledger/internal/publisher/publisher.h @@ -45,7 +45,7 @@ class Publisher { const std::string& publisher_key, ledger::OnRefreshPublisherCallback callback); - void SetPublisherServerListTimer(); + void SetPublisherServerListTimer(const bool rewards_enabled); bool loadState(const std::string& data); diff --git a/vendor/bat-native-ledger/src/bat/ledger/internal/publisher/publisher_server_list.cc b/vendor/bat-native-ledger/src/bat/ledger/internal/publisher/publisher_server_list.cc index 69f3e347a3d9..05f948c58eb1 100644 --- a/vendor/bat-native-ledger/src/bat/ledger/internal/publisher/publisher_server_list.cc +++ b/vendor/bat-native-ledger/src/bat/ledger/internal/publisher/publisher_server_list.cc @@ -386,4 +386,8 @@ void PublisherServerList::SaveBanners( ledger_->InsertPublisherBannerList(save_list, save_callback); } +void PublisherServerList::ClearTimer() { + server_list_timer_id_ = 0; +} + } // namespace braveledger_publisher diff --git a/vendor/bat-native-ledger/src/bat/ledger/internal/publisher/publisher_server_list.h b/vendor/bat-native-ledger/src/bat/ledger/internal/publisher/publisher_server_list.h index b585c26ebd88..201946997e55 100644 --- a/vendor/bat-native-ledger/src/bat/ledger/internal/publisher/publisher_server_list.h +++ b/vendor/bat-native-ledger/src/bat/ledger/internal/publisher/publisher_server_list.h @@ -40,6 +40,8 @@ class PublisherServerList { void SetTimer(bool retry_after_error); + void ClearTimer(); + private: void OnDownload( int response_status_code,