Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

### Fixes

- Capture scroll breadcrumbs for `LazyColumn`, `LazyRow`, lazy grids, and `Pager` on Jetpack Compose foundation 1.10+ ([#6548](https://github.com/getsentry/sentry-java/pull/6548))
- Prevent the main thread from potentially hanging during app start if Android is slow to register the SDK's network or telephony listeners. `Sentry.init`, Session Replay, and capturing events no longer wait for that registration ([#6537](https://github.com/getsentry/sentry-java/pull/6537))
- Add opt-in support for matching GraphQL ignored error types against classification specifications via `sentry.graphql.enable-specification-error-type-filtering` ([#6092](https://github.com/getsentry/sentry-java/pull/6092))
- Session Replay: Fix `SentryOkHttpInterceptor` hanging forever on responses whose body has no known length, such as Server-Sent Events or a gzipped response, when network details are enabled for the URL ([#6231](https://github.com/getsentry/sentry-java/pull/6231))
Expand Down
1 change: 1 addition & 0 deletions sentry-compose/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
-keepnames class androidx.compose.foundation.CombinedClickableElement
-keepnames class androidx.compose.foundation.ScrollingLayoutElement
-keepnames class androidx.compose.foundation.ScrollingContainerElement
-keepnames class androidx.compose.foundation.ScrollableAreaElement
-keepnames class androidx.compose.ui.platform.TestTagElement { *; }
-keepnames class io.sentry.compose.SentryModifier$SentryTagModifierNodeElement { *; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,7 @@ public class ComposeGestureTargetLocator(private val logger: ILogger) : GestureT
) {
targetTag = tag
} else if (
targetType == UiElement.Type.SCROLLABLE &&
("androidx.compose.foundation.ScrollingLayoutElement" == type ||
"androidx.compose.foundation.ScrollingContainerElement" == type)
targetType == UiElement.Type.SCROLLABLE && type in SCROLLABLE_ELEMENT_TYPES
) {
return UiElement(null, null, null, tag, ORIGIN)
}
Expand Down Expand Up @@ -130,5 +128,14 @@ public class ComposeGestureTargetLocator(private val logger: ILogger) : GestureT

public companion object {
private const val ORIGIN = "jetpack_compose"

private val SCROLLABLE_ELEMENT_TYPES =
setOf(
"androidx.compose.foundation.ScrollingLayoutElement",
"androidx.compose.foundation.ScrollingContainerElement",
// Compose foundation 1.10+: lazy layouts and pagers use ScrollableAreaElement
// in place of ScrollingContainerElement
"androidx.compose.foundation.ScrollableAreaElement",
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ internal open class CombinedClickableElement : Modifier.Element
internal open class ScrollingLayoutElement : Modifier.Element

internal open class ScrollingContainerElement : Modifier.Element

internal open class ScrollableAreaElement : Modifier.Element
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,31 @@ class ComposeGestureTargetLocatorTest {
assertEquals("scroll", result!!.tag)
}

@Test
fun `detects scrollable via ScrollableAreaElement modifier`() {
val scrollableChild =
mockLayoutNode(
isPlaced = true,
tag = "scroll",
width = 50,
height = 50,
nodeModifierClassName = "androidx.compose.foundation.ScrollableAreaElement",
)
val root =
mockLayoutNode(
isPlaced = true,
tag = null,
width = 100,
height = 100,
children = listOf(scrollableChild),
)
val owner = mockOwner(root)

val result = locator.locate(owner, 5f, 5f, UiElement.Type.SCROLLABLE)
assertNotNull(result)
assertEquals("scroll", result!!.tag)
}

@Test
fun `ignores clickable when looking for scrollable`() {
val clickableChild =
Expand Down
Loading