parse-community / parse-server-push-adapter

A push notification adapter for Parse Server
https://parseplatform.org
MIT License
85 stars 100 forks source link

Add token response interface #244

Open mtrezza opened 1 month ago

mtrezza commented 1 month ago

New Feature / Enhancement Checklist

Current Limitation

Parse Server has the capability to remove invalid device push tokens from the _Installation class. The logic that parses the errors is in Parse Server and is applied to the push token response that is sent from the push adapter to Parse Server. That logic probably should be in the push adapter, since these errors are push API specific.

Feature / Enhancement Description

An interface that returns an array of "tokens to remove", "tokens with successful push", etc, to decouple the push adapter more from Parse Server.

parse-github-assistant[bot] commented 1 month ago

Thanks for opening this issue!

mortenmo commented 1 month ago

Like this idea, especially since Apple in particular can start to block you if you keep sending to bad devices.

if I could suggest a maybe(?) simpler solution is to just add a new property to the result object so that if result.transmitted === false StatusHandler just looks for result.deviceShouldBeRemoved === true. If that is set, remove the token similar to current error parsing logic.