Skip to content
This repository has been archived by the owner on Dec 12, 2018. It is now read-only.

Commit

Permalink
Renames GetPublisherInfoList into GetActivityInfoList
Browse files Browse the repository at this point in the history
  • Loading branch information
NejcZdovc committed Dec 5, 2018
1 parent 99e07ed commit da589d2
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 13 deletions.
2 changes: 1 addition & 1 deletion include/bat/ledger/ledger.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ class LEDGER_EXPORT Ledger {
virtual void GetMediaPublisherInfo(const std::string& media_key,
PublisherInfoCallback callback) = 0;
virtual std::vector<ContributionInfo> GetRecurringDonationPublisherInfo() = 0;
virtual void GetPublisherInfoList(uint32_t start, uint32_t limit,
virtual void GetActivityInfoList(uint32_t start, uint32_t limit,
const ledger::ActivityInfoFilter& filter,
PublisherInfoListCallback callback) = 0;
virtual void GetCurrentPublisherInfoList(uint32_t start, uint32_t limit,
Expand Down
2 changes: 1 addition & 1 deletion include/bat/ledger/ledger_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class LEDGER_EXPORT LedgerClient {
PublisherInfoCallback callback) = 0;
virtual void SaveMediaPublisherInfo(const std::string& media_key,
const std::string& publisher_id) = 0;
virtual void LoadPublisherInfoList(uint32_t start, uint32_t limit,
virtual void LoadActivityInfoList(uint32_t start, uint32_t limit,
ActivityInfoFilter filter,
PublisherInfoListCallback callback) = 0;
virtual void LoadCurrentPublisherInfoList(uint32_t start, uint32_t limit,
Expand Down
2 changes: 1 addition & 1 deletion src/bat_get_media.cc
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ void BatGetMedia::onFetchFavIcon(const std::string& publisher_key,
void BatGetMedia::onFetchFavIconDBResponse(ledger::Result result,
std::unique_ptr<ledger::PublisherInfo> info,
const std::string& favicon_url) {
if (result == ledger::Result::LEDGER_OK && !favicon_url.empty()) {
if (info && result == ledger::Result::LEDGER_OK && !favicon_url.empty()) {
info->favicon_url = favicon_url;
ledger_->SetPublisherInfo(std::move(info),
std::bind(&onVisitSavedDummy, _1, _2));
Expand Down
11 changes: 4 additions & 7 deletions src/bat_publishers.cc
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,7 @@ void BatPublishers::onSetPanelExcludeInternal(ledger::PUBLISHER_EXCLUDE exclude,
OnExcludedSitesChanged(publisherKey);
}

// TODO refactor
void BatPublishers::restorePublishers() {
uint64_t currentReconcileStamp = ledger_->GetReconcileStamp();
auto filter = CreateActivityFilter("",
Expand All @@ -380,7 +381,7 @@ void BatPublishers::restorePublishers() {
ledger::EXCLUDE_FILTER::FILTER_EXCLUDED,
false,
currentReconcileStamp);
ledger_->GetPublisherInfoList(0, 0, filter, std::bind(&BatPublishers::onRestorePublishersInternal,
ledger_->GetActivityInfoList(0, 0, filter, std::bind(&BatPublishers::onRestorePublishersInternal,
this, _1, _2));
}

Expand Down Expand Up @@ -549,14 +550,10 @@ void BatPublishers::synopsisNormalizer(const ledger::PublisherInfo& info) {
ledger_->GetReconcileStamp());
// TODO SZ: We pull the whole list currently, I don't think it consumes lots of RAM, but could.
// We need to limit it and iterate.
ledger_->GetPublisherInfoList(0, 0, filter, std::bind(&BatPublishers::synopsisNormalizerInternal, this,
ledger_->GetActivityInfoList(0, 0, filter, std::bind(&BatPublishers::synopsisNormalizerInternal, this,
nullptr, true, _1, _2));
}





bool BatPublishers::isVerified(const std::string& publisher_id) {
if (server_list_.empty()) {
return false;
Expand Down Expand Up @@ -884,7 +881,7 @@ void BatPublishers::onPublisherBanner(ledger::PublisherBannerCallback callback,

auto new_banner = std::make_unique<ledger::PublisherBanner>(banner);

if (result != ledger::Result::LEDGER_OK) {
if (!publisher_info || result != ledger::Result::LEDGER_OK) {
callback(std::move(new_banner));
return;
}
Expand Down
4 changes: 2 additions & 2 deletions src/ledger_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -384,10 +384,10 @@ void LedgerImpl::GetMediaPublisherInfo(const std::string& media_key,
ledger_client_->LoadMediaPublisherInfo(media_key, callback);
}

void LedgerImpl::GetPublisherInfoList(uint32_t start, uint32_t limit,
void LedgerImpl::GetActivityInfoList(uint32_t start, uint32_t limit,
const ledger::ActivityInfoFilter& filter,
ledger::PublisherInfoListCallback callback) {
ledger_client_->LoadPublisherInfoList(start, limit, filter, callback);
ledger_client_->LoadActivityInfoList(start, limit, filter, callback);
}

void LedgerImpl::GetCurrentPublisherInfoList(uint32_t start, uint32_t limit,
Expand Down
2 changes: 1 addition & 1 deletion src/ledger_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class LedgerImpl : public ledger::Ledger,
void SetMediaPublisherInfo(const std::string& media_key,
const std::string& publisher_id) override;
std::vector<ledger::ContributionInfo> GetRecurringDonationPublisherInfo() override;
void GetPublisherInfoList(uint32_t start, uint32_t limit,
void GetActivityInfoList(uint32_t start, uint32_t limit,
const ledger::ActivityInfoFilter& filter,
ledger::PublisherInfoListCallback callback) override;
void GetCurrentPublisherInfoList(uint32_t start, uint32_t limit,
Expand Down

0 comments on commit da589d2

Please sign in to comment.