Skip to content

Commit

Permalink
Fixes brave-browser/issues#2273
Browse files Browse the repository at this point in the history
Fixes brave-browser/issues#2332

Triggers balance report fetch onWalletProperties, this is so that reports update along with wallet info

Also ensures that the current report is fetched on settings mount
  • Loading branch information
ryanml committed Dec 18, 2018
1 parent b345d6b commit 12342c9
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 1 deletion.
2 changes: 2 additions & 0 deletions components/brave_rewards/browser/rewards_service_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,7 @@ void RewardsServiceImpl::OnGrantFinish(ledger::Result result,
grant.probi);
}

GetCurrentBalanceReport();
TriggerOnGrantFinish(result, grant);
}

Expand All @@ -624,6 +625,7 @@ void RewardsServiceImpl::OnReconcileComplete(ledger::Result result,
GetCurrentTimestamp());
}

GetCurrentBalanceReport();
for (auto& observer : observers_)
observer.OnReconcileComplete(this,
result,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ export const onBalanceReports = (reports: Record<string, Rewards.Report>) => act
reports
})

export const getCurrentReport = () => action(types.GET_CURRENT_REPORT, {})

export const excludePublisher = (publisherKey: string) => action(types.ON_EXCLUDE_PUBLISHER, {
publisherKey
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class SettingsPage extends React.Component<Props, {}> {
this.actions.getContributeList()
this.actions.checkImported()
this.actions.getAdsData()
this.actions.getCurrentReport()
}

componentWillUnmount () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,6 @@ export const enum types {
ON_IMPORTED_CHECK = '@@rewards/ON_IMPORTED_CHECK',
GET_ADS_DATA = '@@rewards/GET_ADS_DATA',
ON_ADS_DATA = '@@rewards/ON_ADS_DATA',
ON_ADS_SETTING_SAVE = '@@rewards/ON_ADS_SETTING_SAVE'
ON_ADS_SETTING_SAVE = '@@rewards/ON_ADS_SETTING_SAVE',
GET_CURRENT_REPORT = '@@rewards/GET_CURRENT_REPORT'
}
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,11 @@ const walletReducer: Reducer<Rewards.State | undefined> = (state: Rewards.State,
}
break
}
case types.GET_CURRENT_REPORT:
{
chrome.send('brave_rewards.getBalanceReports')
break
}
case types.ON_BALANCE_REPORTS:
{
state = { ...state }
Expand Down

0 comments on commit 12342c9

Please sign in to comment.