Add BeforeCaptureCallback - Screenshot
Problem Statement
https://docs.sentry.io/platforms/apple/guides/ios/enriching-events/screenshots/ does not have it.
SDK's Screenshot feature does not have the callback setBeforeScreenshotCaptureCallback
Users want to decide if they want to send the screenshot or not, based on data from the event in the callback (event,hint,debounce).
Solution Brainstorm
Add the callback function as a feature, like how Android SDK has it. https://docs.sentry.io/platforms/android/enriching-events/screenshots/
Are you willing to submit a PR?
No response
Related to https://github.com/getsentry/team-mobile/issues/135.
Currently, we can only pass a little context into this callback except for the captured event, which doesn't tell the user much about for which screen the SDK is capturing the screenshot. This feature will be easier to implement once we have report current screen in the app context, which is on our roadmap. Then the user knows for which screen we are capturing the screenshot, and they can better decide which ones to keep and which to throw away.
We should follow Android implementation:
https://docs.sentry.io/platforms/android/enriching-events/viewhierarchy/#customize-view-hierarchy-capturing https://docs.sentry.io/platforms/android/enriching-events/screenshots/#customize-screenshot-capturing
Wrt. https://github.com/getsentry/sentry-cocoa/issues/3137#issuecomment-1632415873 - we need to make sure that at the time of the callback, the screen/view info is already available in the event, otherwise this can't be used for filtering. Also, this is another data point that https://github.com/getsentry/sentry-cocoa/issues/2325 (hints support) is valuable.
We are in the POC stage, evaluating sentry's SaaS solution.
A critical requirement for us is the ability to filter iOS screenshots by specific screens. Currently, this functionality is lacking, making the screenshot feature impractical for our purposes due to several sensitive screens that shouldn't be captured.
Implementing this feature would significantly enhance the value of using Sentry for us.
Thanks for your input @ananya-mallik-ps, that's helpful. While I can't give a concrete timeline right now, we will bump priority on this