@eternal bison @onyx ridge @topaz citrus
On Windows + Android this is completely broken:
1) TokenGenerated event gets emitted as soon as the pop up with "Accept" and "Decline" options is shown, without the user clicking either option. I do get a token in this case, but that token is useless because of the following -- as soon as that pop up is shown, Android sets the permission status to "denied", and then if user either just exist the modal without choosing anything, or clicks denied, the status is correct - "denied" - which means we can't use the token.
2) When the TokenGenerated event is triggered if I immediately call await PushNotifications.checkPermission(); that never resolves, the code just gets "stuck". The workaround for this is handling TokenGenerated event with a delay. I've tried 1s delay and that worked. However...
3) The biggest issue -- after the user actually clicks Accept in the pop up, the token generated event is not triggered again.
I assume the initially generated token can be used after the user clicks on "Accept", however we never get that information. Currently the only way around this is polling for permission change, and once it changes from "denied" to anything else, that is when we can send token to our backend. However this is very impractical since the user could click on "deny", which will leave the push permission in the "denied" state, so we'd either just continue polling forever, or have a timeout on the polling function which again leaves room for edge cases where the user clicks "accept" after the timeout's already expired.