Skip to content

Commit

Permalink
Set the UI value for emptyWallet
Browse files Browse the repository at this point in the history
  • Loading branch information
bsclifton committed Dec 2, 2018
1 parent aa7e047 commit dd1680b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions browser/ui/webui/brave_rewards_ui.cc
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,8 @@ void RewardsDOMHandler::OnWalletProperties(
rewards_service->GetPublisherAllowNonVerified());
values.SetBoolean("contributionVideos",
rewards_service->GetPublisherAllowVideos());
web_ui()->CallJavascriptFunctionUnsafe(
"brave_rewards.initAutoContributeSettings", values);

auto ui_values = std::make_unique<base::DictionaryValue>();

base::DictionaryValue result;
result.SetInteger("status", error_code);
Expand All @@ -281,6 +281,7 @@ void RewardsDOMHandler::OnWalletProperties(
if (error_code == 0 && wallet_properties) {
walletInfo->SetDouble("balance", wallet_properties->balance);
walletInfo->SetString("probi", wallet_properties->probi);
ui_values->SetBoolean("emptyWallet", (wallet_properties->balance > 0));

auto rates = std::make_unique<base::DictionaryValue>();
for (auto const& rate : wallet_properties->rates) {
Expand Down Expand Up @@ -310,6 +311,10 @@ void RewardsDOMHandler::OnWalletProperties(
walletInfo->SetList("grants", std::move(grants));
}

values.SetDictionary("ui", std::move(ui_values));
web_ui()->CallJavascriptFunctionUnsafe(
"brave_rewards.initAutoContributeSettings", values);

result.SetDictionary("wallet", std::move(walletInfo));
result.SetDouble("monthlyAmount", wallet_properties->monthly_amount);

Expand Down

0 comments on commit dd1680b

Please sign in to comment.