-
Notifications
You must be signed in to change notification settings - Fork 885
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rewire SaveRecurringTip through ledger #2962
Conversation
@@ -466,19 +466,20 @@ - (void)listRecurringTips:(void (NS_NOESCAPE ^)(NSArray<BATPublisherInfo *> *))c | |||
|
|||
- (void)addRecurringTipToPublisherWithId:(NSString *)publisherId amount:(double)amount |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should add a completion block here that is called in the SaveRecurringTip
callback. suggested declaration:
- (void)addRecurringTipToPublisherWithId:(NSString *)publisherId amount:(double)amount completion:(void (^)(BOOL success))completion
Needs to updated in header as well
info->value = amount; | ||
info->date = [[NSDate date] timeIntervalSince1970]; | ||
ledger->SaveRecurringTip(std::move(info), ^(ledger::Result result){ | ||
if (result != ledger::Result::LEDGER_OK) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
completion block should be called above this line after adding it (seen in previous comment):
dispatch_async(dispatch_get_main_queue(), ^{
completion(result == ledger::Result::LEDGER_OK)
});
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
edit: you don't need the dispatch_async
to main queue, the database insertion callbacks are done on main queue already
16c2127
to
69bd936
Compare
d63795c
to
41cf16d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ios++
tests pass, some CI issues only |
398da29
to
49c6098
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm cc: @NejcZdovc
|
||
void RewardsServiceImpl::OnRecurringTipSaved( | ||
ledger::SaveRecurringTipCallback callback, | ||
bool success) { | ||
for (auto& observer : observers_) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this observers should be in OnSaveRecurringTipUI
const int amount) override; | ||
void OnSaveRecurringTipUI( | ||
SaveRecurringTipCallback callback, | ||
int32_t result); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: const
void OnRecurringTipSaved(bool success); | ||
void OnRecurringTipSaved( | ||
ledger::SaveRecurringTipCallback callback, | ||
bool success); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: const
ce7ae91
to
d80499f
Compare
d80499f
to
c3b54cf
Compare
CI passes everything but Windows here: https://staging.ci.brave.com/job/brave-browser-build-pr/job/save-recurring-tip-refactor/9//flowGraphTable/ (windows failed due to a CI bug) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
iOS++
Windows CI pass for reference: https://staging.ci.brave.com/job/brave-browser-build-pr/job/save-recurring-tip-refactor/11//flowGraphTable/ |
Resolves brave/brave-browser#5152.
@kylehickinson These iOS changes build, but I didn't actually build them into a full build. If it's straightforward to make sure this doesn't break anything, that would be good to test.
Submitter Checklist:
npm run lint
)git rebase master
(if needed).git rebase -i
to squash commits (if needed).Test Plan:
brave://rewards
.brave://rewards
.Reviewer Checklist:
After-merge Checklist:
changes has landed on.