Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upSend pending rewards notifications after registering listener #1436
Conversation
| @@ -34,6 +34,9 @@ RewardsNotificationServiceImpl::RewardsNotificationServiceImpl(Profile* profile) | |||
| std::make_unique<ExtensionRewardsNotificationServiceObserver>( | |||
| profile); | |||
| AddObserver(extension_rewards_notification_service_observer_.get()); | |||
| for (auto& notification : rewards_notifications_) { | |||
| TriggerOnNotificationAdded(notification.second); | |||
This comment has been minimized.
This comment has been minimized.
bridiver
Jan 24, 2019
Collaborator
I don't think we want to re-trigger for all observers, that might cause duplicates, but either way this isn't the right place to do this. We should be doing it in the AddObserver method. This should apply to all observers, not just the extension_rewards_notification_service_observer
This comment has been minimized.
This comment has been minimized.
emerick
Jan 24, 2019
Author
Contributor
OK, I see now. The AddObserver method doesn't currently have access to the pending notifications, so I'll have to plumb those through. I'm thinking to just add a getter on the notification service, unless you have a better idea there.
ea1e072
to
6ecaf27
| @@ -110,6 +110,13 @@ void RewardsNotificationServiceImpl::GetAllNotifications() { | |||
| OnGetAllNotifications(rewards_notifications_list); | |||
| } | |||
|
|
|||
| void RewardsNotificationServiceImpl::GetAllNotifications( | |||
This comment has been minimized.
This comment has been minimized.
bridiver
Jan 24, 2019
Collaborator
you should use * instead of & when initializing a parameter like this for clarity, but it doesn't seem necessary either way. Why wouldn't we just return a const RewardsNotificationList for rewards_notifications_? Also the method itself should be const
This comment has been minimized.
This comment has been minimized.
bridiver
Jan 24, 2019
Collaborator
actually why do we need this method at all? We really don't need the _impl.cc class here anyway, but just put rewards_notifications_ in rewards_notification_service.h
6ecaf27
to
7e0bbba
7e0bbba
to
2fa44ba
emerick commentedJan 24, 2019
•
edited
Fixes brave/brave-browser#3078
Submitter Checklist:
npm test brave_unit_tests && npm test brave_browser_tests) ongit rebase master(if needed).git rebase -ito squash commits (if needed).Test Plan:
Reviewer Checklist: