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

RUMM-2806 Drop the covered wireframes only if top ones have a background #1198

Conversation

mariusc83
Copy link
Member

What does this PR do?

Before we were filtering out all the overlayed wireframes no matter if the top ones were having a solid background or not. This creates a problem because if the removed wireframe is actual the one that gives the main background in a View we will be loosing the contrast in the replay and will make some elements invisible (e.g. texts).

In order to fix this we are now only considering as valid overlays the wireframes that also have a solid backround.

Motivation

What inspired you to submit this pull request?

Additional Notes

Anything else we should know when reviewing?

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests (unit, integration, e2e)
  • Make sure you discussed the feature or bugfix with the maintaining team in an Issue
  • Make sure each commit and the PR mention the Issue number (cf the CONTRIBUTING doc)

@mariusc83 mariusc83 force-pushed the mconstantin/rumm-2806/filter-out-wireframes-only-when-top-has-a-background branch from a97e155 to cc0004b Compare December 15, 2022 16:25
@mariusc83 mariusc83 marked this pull request as ready for review December 15, 2022 16:29
@mariusc83 mariusc83 requested a review from a team as a code owner December 15, 2022 16:29
@mariusc83 mariusc83 self-assigned this Dec 15, 2022
@@ -72,6 +72,13 @@ internal class WireframeUtils {
}
}

private fun MobileSegment.Wireframe.hasBackground(): Boolean {
Copy link
Member

Choose a reason for hiding this comment

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

what if the background is transparent?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch, I am going to filter those out also.

Copy link
Member

Choose a reason for hiding this comment

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

👍 or semi-transparent. On iOS we recently added isTranslucent for similar use case, which also takes view's alpha (opacity) into account. It doesn't yet check the background color's alpha, but remains extensible in that direction (e.g. a background of #FF000099 should be considered translucent).

Copy link
Member Author

Choose a reason for hiding this comment

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

yup I modified it in order to just consider alpha FF in the color and 1f in the ShapeStyle opacity. Any other wireframe with any alpha value will be not considered as overlay.

@codecov-commenter
Copy link

Codecov Report

Merging #1198 (cc0004b) into feature/sdkv2 (05aa709) will decrease coverage by 0.02%.
The diff coverage is 100.00%.

@@                Coverage Diff                @@
##           feature/sdkv2    #1198      +/-   ##
=================================================
- Coverage          83.38%   83.36%   -0.02%     
=================================================
  Files                356      356              
  Lines              11987    11985       -2     
  Branches            2061     2061              
=================================================
- Hits                9995     9991       -4     
- Misses              1357     1358       +1     
- Partials             635      636       +1     
Impacted Files Coverage Δ
.../android/sessionreplay/processor/WireframeUtils.kt 100.00% <100.00%> (ø)
...in/com/datadog/android/log/internal/LogsFeature.kt 84.71% <0.00%> (-5.88%) ⬇️
...rsistence/file/batch/PlainBatchFileReaderWriter.kt 86.27% <0.00%> (-2.94%) ⬇️
...ain/java/com/datadog/opentracing/PendingTrace.java 57.76% <0.00%> (-0.86%) ⬇️
.../android/rum/internal/monitor/DatadogRumMonitor.kt 92.82% <0.00%> (-0.55%) ⬇️
...src/main/kotlin/com/datadog/android/DatadogSite.kt 86.67% <0.00%> (ø)
...ndroid/telemetry/internal/TelemetryEventHandler.kt 72.27% <0.00%> (+0.84%) ⬆️
...n/com/datadog/android/v2/core/SdkInternalLogger.kt 80.77% <0.00%> (+3.85%) ⬆️
...id/rum/internal/ndk/DatadogNdkCrashEventHandler.kt 91.49% <0.00%> (+4.26%) ⬆️
.../kotlin/com/datadog/android/ktx/tracing/SpanExt.kt 100.00% <0.00%> (+13.33%) ⬆️

@mariusc83 mariusc83 force-pushed the mconstantin/rumm-2806/filter-out-wireframes-only-when-top-has-a-background branch 3 times, most recently from 0dc18c5 to ae7a05f Compare December 16, 2022 09:21
@mariusc83 mariusc83 force-pushed the mconstantin/rumm-2806/filter-out-wireframes-only-when-top-has-a-background branch 2 times, most recently from a7148b4 to 63123ae Compare December 16, 2022 10:41
@@ -51,7 +51,7 @@ internal class WireframeUtils {
return false
}
topWireframes.forEach {
if (it.bounds().isCovering(wireframeBounds)) {
if (it.bounds().isCovering(wireframeBounds) && it.isNotTranslucent()) {
Copy link
Member

Choose a reason for hiding this comment

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

Nitpicking here, maybe using isOpaque would avoid having to handle the negation when thinking at the logic

@mariusc83 mariusc83 force-pushed the mconstantin/rumm-2806/filter-out-wireframes-only-when-top-has-a-background branch from 63123ae to b3f7083 Compare December 16, 2022 13:54
@mariusc83 mariusc83 merged commit b3aaf0d into feature/sdkv2 Dec 16, 2022
@mariusc83 mariusc83 deleted the mconstantin/rumm-2806/filter-out-wireframes-only-when-top-has-a-background branch December 16, 2022 14:48
@xgouchet xgouchet added this to the 1.17.0 milestone Dec 13, 2023
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.

5 participants