-
Notifications
You must be signed in to change notification settings - Fork 6
Description
I'm experimenting with this gem in an application where I batch multiple push notifications that are sent to different users.
For logging reasons I want to store each push notification and associate them to each user, in order to get visibility on how many push notifications someone receive, their status.
From the Expo documentation:
data will contain an array of push tickets in the same order in which the messages were sent
So the idea is to create a PushNotification record matching the user with the position in the returned data.
The problem is that at the moment this doesn't seem possible since there is a tickets.each that only returns ok tickets (filtering out errors) and tickets.each_error that only returns error tickets (filtering out oks).
Given that the position of each ticket is important in order to match the user those two methods cannot be used together for this purpose.
Would you consider adding a new method that'd allow to loop through all ok/error tickets together in the original order that got returned by Expo?
Something like:
def each_ticket
results.each do |tickets|
next if tickets.is_a?(Error)
tickets.each do |ticket|
yield ticket
end
end
endThat'd allow to loop through all of them; and in order to prevent that one batch/chunk error out would mess up the position, the whole chunking could be taken care of before sending the messages, which I think would be fine.