Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
marandaneto committed Feb 4, 2025
1 parent 9bce229 commit 83cbeff
Showing 1 changed file with 18 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -261,20 +261,24 @@ public class PostHogReplayIntegration(
) {
val mouseInteractions = mutableListOf<RRIncrementalMouseInteractionEvent>()
for (index in 0 until motionEvent.pointerCount) {
// if the id is 0, BE transformer will set it to the virtual bodyId
val id = motionEvent.getPointerId(index)
val absX = motionEvent.getRawXCompat(index).toInt().densityValue(displayMetrics.density)
val absY = motionEvent.getRawYCompat(index).toInt().densityValue(displayMetrics.density)

val mouseInteractionData =
RRIncrementalMouseInteractionData(
id = id,
type = type,
x = absX,
y = absY,
)
val mouseInteraction = RRIncrementalMouseInteractionEvent(mouseInteractionData, timestamp)
mouseInteractions.add(mouseInteraction)
try {
// if the id is 0, BE transformer will set it to the virtual bodyId
val id = motionEvent.getPointerId(index)
val absX = motionEvent.getRawXCompat(index).toInt().densityValue(displayMetrics.density)
val absY = motionEvent.getRawYCompat(index).toInt().densityValue(displayMetrics.density)

val mouseInteractionData =
RRIncrementalMouseInteractionData(
id = id,
type = type,
x = absX,
y = absY,
)
val mouseInteraction = RRIncrementalMouseInteractionEvent(mouseInteractionData, timestamp)
mouseInteractions.add(mouseInteraction)
} catch (e: Throwable) {
config.logger.log("Reading MotionEvent pointers failed: $e.")
}
}

if (mouseInteractions.isNotEmpty()) {
Expand Down

0 comments on commit 83cbeff

Please sign in to comment.