Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Session replay masking preview for SwiftUI #4737

Merged
merged 12 commits into from
Jan 30, 2025

Conversation

brustolin
Copy link
Contributor

@brustolin brustolin commented Jan 21, 2025

📜 Description

Allows the user to preview how its app session replay will be masked during development.

image

💡 Motivation and Context

closes #4633

💚 How did you test it?

Sample

📝 Checklist

You have to check all boxes before merging:

  • I added tests to verify the changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • Review from the native team if needed.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.

🔮 Next steps

Copy link

github-actions bot commented Jan 21, 2025

Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against db55f9d

Copy link

github-actions bot commented Jan 21, 2025

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 1224.29 ms 1243.88 ms 19.59 ms
Size 22.31 KiB 778.52 KiB 756.21 KiB

Baseline results on branch: feat/uikit-masking-preview

Startup times

Revision Plain With Sentry Diff
20a7c5f 1221.20 ms 1237.02 ms 15.82 ms
5e89626 1220.49 ms 1238.45 ms 17.96 ms
925fcf3 1223.77 ms 1242.21 ms 18.44 ms
8ffcc7c 1229.25 ms 1247.12 ms 17.87 ms

App size

Revision Plain With Sentry Diff
20a7c5f 22.31 KiB 778.61 KiB 756.30 KiB
5e89626 22.31 KiB 778.40 KiB 756.09 KiB
925fcf3 22.31 KiB 778.56 KiB 756.25 KiB
8ffcc7c 22.31 KiB 778.40 KiB 756.09 KiB

Previous results on branch: feat/sr-masking-preview

Startup times

Revision Plain With Sentry Diff
1c17d33 1231.41 ms 1249.06 ms 17.65 ms
6afd6ed 1230.51 ms 1251.27 ms 20.76 ms
762bffc 1224.00 ms 1247.29 ms 23.29 ms
2006d0e 1210.84 ms 1233.22 ms 22.39 ms

App size

Revision Plain With Sentry Diff
1c17d33 22.31 KiB 775.80 KiB 753.48 KiB
6afd6ed 22.31 KiB 775.64 KiB 753.32 KiB
762bffc 22.31 KiB 775.80 KiB 753.48 KiB
2006d0e 22.31 KiB 778.51 KiB 756.19 KiB

Copy link

codecov bot commented Jan 21, 2025

Codecov Report

Attention: Patch coverage is 78.26087% with 5 lines in your changes missing coverage. Please review.

Project coverage is 91.091%. Comparing base (e3dbde2) to head (db55f9d).
Report is 17 commits behind head on feat/uikit-masking-preview.

Files with missing lines Patch % Lines
Sources/Sentry/PrivateSentrySDKOnly.mm 0.000% 3 Missing ⚠️
Sources/Sentry/SentrySessionReplayIntegration.m 71.428% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@                       Coverage Diff                        @@
##           feat/uikit-masking-preview     #4737       +/-   ##
================================================================
- Coverage                      91.190%   91.091%   -0.100%     
================================================================
  Files                             624       624               
  Lines                           72605     72605               
  Branches                        26450     25827      -623     
================================================================
- Hits                            66209     66137       -72     
- Misses                           6298      6374       +76     
+ Partials                           98        94        -4     
Files with missing lines Coverage Δ
Sources/Sentry/SentrySDK.m 87.613% <100.000%> (ø)
Tests/SentryTests/SentrySDKTests.swift 96.778% <100.000%> (+0.032%) ⬆️
Sources/Sentry/SentrySessionReplayIntegration.m 88.652% <71.428%> (ø)
Sources/Sentry/PrivateSentrySDKOnly.mm 23.902% <0.000%> (-0.355%) ⬇️

... and 22 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e3dbde2...db55f9d. Read the comment docs.

@brustolin brustolin marked this pull request as ready for review January 22, 2025 12:04
Copy link
Member

@philipphofmann philipphofmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see potential, that we can use the solution for debugging any iOS app. If I'm not mistaken we don't need to limit this for SwiftUI Previews. Or am I missing something, @brustolin?

@brustolin
Copy link
Contributor Author

I see potential, that we can use the solution for debugging any iOS app

Yes, technically we could also use it while running in debug.
Step-by-step

Copy link
Member

@philipphofmann philipphofmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefix the ViewPhotographer class with something like InternalUseOnly_ and keep the SentryReplayMaskPreviewUIView internal. With that approach, we could still move SentryReplayMaskPreviewUIView to the core package and add use it for UIKit later on. Furthermore, we could make the ViewPhotographer internal again, if we decided to.

@brustolin brustolin changed the base branch from main to feat/uikit-masking-preview January 29, 2025 15:03
/**
* Return an instance of SentryRedactOptions with given option
*/
+ (UIView *)sessionReplayMaskingOverlay:(id<SentryRedactOptions>)options;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since SentryMaskingPreviewView is an internal Swift class from Sentry, we cant use from SentrySwiftUI. In order to solve this, we just use PrivateSentrySDKOnly to return it as a UIView.

Copy link
Member

@philipphofmann philipphofmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for making this also awailable for UIKit with #4761. LGTM.

@brustolin brustolin merged commit 42befd0 into feat/uikit-masking-preview Jan 30, 2025
65 of 69 checks passed
@brustolin brustolin deleted the feat/sr-masking-preview branch January 30, 2025 15:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature Request] View masking preview for SwiftUI views
4 participants