Push Notifications instrumentation
Description
The SDK could subscribe to push notifications and add breadcrumbs without PII. Related to https://github.com/getsentry/sentry-java/issues/2728.
Push notifications in iOS are handled through the UNUserNotificationCenter framework and its delegate methods. In order for the app detect a push notification the App delegate needs to implement UNUserNotificationCenter, the only way to detect this, is by swizzling it, there is no NSNotificationCenter notification related with push notification.
We need to investigate getDeliveredNotifications:
Using getDeliveredNotifications: does not looks like a good solution, because the most common path regarding notifications is to call removeAllDeliveredNotifications after the app open so the notifications don't hang forever in the notification center. The notification is also remove from notification center when the user tap on it.
The solution to this will be using Swizzling. We need to have tests to make sure we're not preventing the app to get the notification. We need to have this as experimental feature for a while.
also worth investigating is SDK behaviour in UNNotificationServiceExtension and whether we can add some logic there to instrument handling of PNs