-
Notifications
You must be signed in to change notification settings - Fork 110
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
Adopt new way of getting notification data in PushNotificationBackgroundSynchronizer #13917
Adopt new way of getting notification data in PushNotificationBackgroundSynchronizer #13917
Conversation
📲 You can test the changes from this Pull Request in WooCommerce iOS by scanning the QR code below to install the corresponding build.
|
if let note = pushNotification.note, | ||
let noteOrderID = note.meta.identifier(forKey: .order) { | ||
orderID = Int64(noteOrderID) | ||
} else { |
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 the only change, checking if we already have the orderID in the notification note
property.
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.
Good job @bozidarsevo, code looks good and tests well!
However, before approving, I think we can add a unit test on the PushNotificationBackgroundSynchronizerTests
file.
What do you think, what kind of test case would be ok? |
I was thinking on something like:
Does that make sense? |
Version |
Closes: #13852
Description
Since we might already have
note
in the push notification (parsed fromnote_full_data
part of the payload) we can check if we already haveorderID
in it without the need of syncronizing all the notifications and avoid extra network calls.If we have the
orderID
we can go directly to syncronizing that exact order.In this PR we use that ability and we use
orderID
from thenote
if we have that property set/loaded.Testing information
Since this PR changes are not visible from the UI, testing can be done by adding some breakpoints in the
PushNotificationBackgroundSynchronizer
:orderID = Int64(noteOrderID)
sync()
function inPushNotificationBackgroundSynchronizer
is called and debugger stops on that breakpoint at line 40Main breakpoint:
RELEASE-NOTES.txt
if necessary.Reviewer (or Author, in the case of optional code reviews):
Please make sure these conditions are met before approving the PR, or request changes if the PR needs improvement: