Skip to content

Commit

Permalink
Merge pull request #2864 from brave/recurring-remove
Browse files Browse the repository at this point in the history
Removes AddRecurringPayment as it's not used
  • Loading branch information
NejcZdovc authored Jul 5, 2019
2 parents 5a1a4e7 + f0cb393 commit f19c059
Show file tree
Hide file tree
Showing 8 changed files with 4 additions and 49 deletions.
3 changes: 0 additions & 3 deletions vendor/bat-native-ledger/include/bat/ledger/ledger.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,6 @@ class LEDGER_EXPORT Ledger {
// returns false if wallet initialization is already in progress
virtual bool CreateWallet() = 0;

virtual void AddRecurringPayment(const std::string& publisher_id,
const double& value) = 0;

virtual void DoDirectTip(const std::string& publisher_id,
int amount,
const std::string& currency) = 0;
Expand Down
27 changes: 0 additions & 27 deletions vendor/bat-native-ledger/src/bat/ledger/internal/bat_helper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,6 @@ PUBLISHER_STATE_ST::PUBLISHER_STATE_ST(const PUBLISHER_STATE_ST& state) {
pubs_load_timestamp_ = state.pubs_load_timestamp_;
allow_videos_ = state.allow_videos_;
monthly_balances_ = state.monthly_balances_;
recurring_donation_ = state.recurring_donation_;
migrate_score_2 = state.migrate_score_2;
processed_pending_publishers = state.processed_pending_publishers;
}
Expand Down Expand Up @@ -668,21 +667,6 @@ bool PUBLISHER_STATE_ST::loadFromJson(const std::string& json) {
}
}

for (const auto & i : d["recurring_donation"].GetArray()) {
rapidjson::StringBuffer sb;
rapidjson::Writer<rapidjson::StringBuffer> writer(sb);
i.Accept(writer);

rapidjson::Document d1;
d1.Parse(sb.GetString());

rapidjson::Value::ConstMemberIterator itr = d1.MemberBegin();
if (itr != d1.MemberEnd()) {
recurring_donation_.insert(
std::make_pair(itr->name.GetString(), itr->value.GetDouble()));
}
}

if (d.HasMember("migrate_score_2") && d["migrate_score_2"].IsBool()) {
migrate_score_2 = d["migrate_score_2"].GetBool();
} else {
Expand Down Expand Up @@ -728,17 +712,6 @@ void saveToJson(JsonWriter* writer, const PUBLISHER_STATE_ST& data) {
}
writer->EndArray();

writer->String("recurring_donation");
writer->StartArray();
for (auto & p : data.recurring_donation_) {
writer->StartObject();
writer->String(p.first.c_str());
writer->Double(p.second);
writer->EndObject();
}

writer->EndArray();

writer->String("migrate_score_2");
writer->Bool(data.migrate_score_2);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,6 @@ struct PUBLISHER_STATE_ST {
uint64_t pubs_load_timestamp_ = 0ull;
bool allow_videos_ = true;
std::map<std::string, REPORT_BALANCE_ST> monthly_balances_;
std::map<std::string, double> recurring_donation_;
bool migrate_score_2 = false;
std::vector<std::string> processed_pending_publishers;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,6 @@ bool ignoreMinTime(const std::string& publisher_id) {
return !getProviderName(publisher_id).empty();
}

void BatPublishers::AddRecurringPayment(const std::string& publisher_id,
const double& value) {
state_->recurring_donation_[publisher_id] = value;
saveState();
}

void BatPublishers::saveVisit(const std::string& publisher_id,
const ledger::VisitData& visit_data,
const uint64_t& duration,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@ class BatPublishers : public ledger::LedgerCallbackHandler {
uint64_t window_id,
const ledger::PublisherInfoCallback callback);

void AddRecurringPayment(const std::string& publisher_id,
const double& value);

void setPublisherMinVisitTime(const uint64_t& duration); // In seconds

void setPublisherMinVisits(const unsigned int visits);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,6 @@ bool LedgerImpl::CreateWallet() {
return true;
}

void LedgerImpl::AddRecurringPayment(const std::string& publisher_id,
const double& value) {
bat_publishers_->AddRecurringPayment(publisher_id, value);
}

braveledger_bat_helper::CURRENT_RECONCILE LedgerImpl::GetReconcileById(
const std::string& viewingId) {
return bat_state_->GetReconcileById(viewingId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -490,9 +490,6 @@ class LedgerImpl : public ledger::Ledger,
void FetchBalance(ledger::FetchBalanceCallback callback) override;

private:
void AddRecurringPayment(const std::string& publisher_id,
const double& value) override;

void OnLoad(ledger::VisitDataPtr visit_data,
const uint64_t& current_time) override;

Expand Down
5 changes: 4 additions & 1 deletion vendor/brave-ios/Ledger/BATBraveLedger.mm
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,10 @@ - (void)listRecurringTips:(void (^)(NSArray<BATPublisherInfo *> *))completion

- (void)addRecurringTipToPublisherWithId:(NSString *)publisherId amount:(double)amount
{
ledger->AddRecurringPayment(std::string(publisherId.UTF8String), amount);
[BATLedgerDatabase insertOrUpdateRecurringTipWithPublisherID:publisherId
amount:amount
dateAdded:[[NSDate date] timeIntervalSince1970]
completion:nil];
}

- (void)removeRecurringTipForPublisherWithId:(NSString *)publisherId
Expand Down

0 comments on commit f19c059

Please sign in to comment.