matrix-org / sygnal

Sygnal: reference Push Gateway for Matrix
Apache License 2.0
167 stars 148 forks source link

Mark iOS push notifications with `push_type` = `alert` to allow for on device silencing #305

Closed stefanceriu closed 2 years ago

stefanceriu commented 2 years ago

We were recently granted the com.apple.developer.usernotifications.filtering entitlement which allows push notifications to be completely discarded once received on the device. This is useful for hiding notifications from encrypted events we don't care about like poll answers (as opposed to showing an empty notification).

One caveat is that it only works for alert apns-push-type notifications which is an optional field we're not currently setting.

This PR does just that through the use of aioapns's PushType header.

clokep commented 2 years ago

What happens if an app isn't approved for this and we set this push type?

stefanceriu commented 2 years ago

Nothing changes as far as I can tell, alert is the correct one for notifications that trigger a user interaction—for example, an alert, badge, or sound.

https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/sending_notification_requests_to_apns/

clokep commented 2 years ago

Thanks! Mostly wanted to make sure it wouldn't reject the push completely.

stefanceriu commented 2 years ago

This PR is incomplete and would break voip UX. Raised separate ticket here https://github.com/matrix-org/sygnal/issues/308