expo-community / expo-server-sdk-ruby

A Ruby library for sending push notifications with Expo's notification service
MIT License
95 stars 53 forks source link

Make invalid_push_tokens contain any wrong tokens, not just invalid ones #34

Closed tostr7191 closed 2 years ago

tostr7191 commented 4 years ago

Right now only tokens that match message.match(/ExponentPushToken\[(...*)\]/) get added to invalid_push_tokens. I have made a change that adds other unregistered non-wokring tokens to the array as well, splitting the matching into invalid and unregistered, as per server return nomenclature.

tostr7191 commented 4 years ago

I made this in quite a hurry and thought I'd add some more detail about it. Assume I have three tokens in my database:

ExponentPushToken[somethingvalid]
ExponentPushToken[somethinginvalid]
a_completely_wrong_string

If I try to send a PN to all three tokens, the valid token works ofc, the invalid token will get put into invalid_push_tokens, but "a_completely_wrong_string" will not. This pull request changes that. The use-case is that I want to delete all non-working tokens from the database even if they are not formatted correctly.

pablonahuelgomez commented 2 years ago

Thanks @to-str