-
-
Notifications
You must be signed in to change notification settings - Fork 467
Support apps compiled against Jetpack Compose 1.10 #5189
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
base: main
Are you sure you want to change the base?
Changes from all commits
72a523b
c863646
7400d9c
e51aca5
0e2a446
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| @file:Suppress( | ||
| "INVISIBLE_MEMBER", | ||
| "INVISIBLE_REFERENCE", | ||
| "EXPOSED_PARAMETER_TYPE", | ||
| "EXPOSED_RETURN_TYPE", | ||
| "EXPOSED_FUNCTION_RETURN_TYPE", | ||
| ) | ||
|
|
||
| package io.sentry.compose | ||
|
|
||
| import androidx.compose.ui.node.LayoutNode | ||
| import org.jetbrains.annotations.ApiStatus | ||
|
|
||
| /** | ||
| * Provides access to internal LayoutNode members that are subject to Kotlin name-mangling. | ||
| * | ||
| * LayoutNode.children and LayoutNode.outerCoordinator are Kotlin `internal`, so their getters are | ||
| * mangled with the module name: getChildren$ui_release() in Compose < 1.10 vs getChildren$ui() in | ||
| * Compose >= 1.10. This class detects the version on first use and delegates to the correct | ||
| * accessor. | ||
| */ | ||
| @ApiStatus.Internal | ||
| public object SentryLayoutNodeHelper { | ||
| @Volatile private var compose110Helper: Compose110Helper? = null | ||
| @Volatile private var useCompose110: Boolean? = null | ||
|
|
||
| private fun getHelper(): Compose110Helper { | ||
| compose110Helper?.let { | ||
| return it | ||
| } | ||
| val helper = Compose110Helper() | ||
| compose110Helper = helper | ||
| return helper | ||
| } | ||
|
|
||
| public fun getChildren(node: LayoutNode): List<LayoutNode> { | ||
| return if (useCompose110 == false) { | ||
| node.children | ||
| } else { | ||
| try { | ||
| getHelper().getChildren(node).also { useCompose110 = true } | ||
| } catch (_: NoSuchMethodError) { | ||
| useCompose110 = false | ||
| node.children | ||
| } | ||
| } | ||
| } | ||
|
|
||
| public fun isTransparent(node: LayoutNode): Boolean { | ||
| return if (useCompose110 == false) { | ||
| node.outerCoordinator.isTransparent() | ||
| } else { | ||
| try { | ||
| getHelper().getOuterCoordinator(node).isTransparent().also { useCompose110 = true } | ||
| } catch (_: NoSuchMethodError) { | ||
| useCompose110 = false | ||
| node.outerCoordinator.isTransparent() | ||
| } | ||
| } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -52,11 +52,12 @@ public class ComposeGestureTargetLocator(private val logger: ILogger) : GestureT | |
|
|
||
| // the last known tag when iterating the node tree | ||
| var lastKnownTag: String? = null | ||
| var isClickable = false | ||
| var isScrollable = false | ||
|
Comment on lines
+55
to
+56
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: The Suggested FixMove the declaration and initialization of Prompt for AI AgentDid we get this right? 👍 / 👎 to inform future reviews. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Click/scroll flags never reset between sibling nodesMedium Severity Moving Additional Locations (1) |
||
|
|
||
| while (!queue.isEmpty()) { | ||
| val node = queue.poll() ?: continue | ||
| if (node.isPlaced && layoutNodeBoundsContain(rootLayoutNode, node, x, y)) { | ||
| var isClickable = false | ||
| var isScrollable = false | ||
|
|
||
| val modifiers = node.getModifierInfo() | ||
| for (index in modifiers.indices) { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| @file:Suppress( | ||
| "INVISIBLE_MEMBER", | ||
| "INVISIBLE_REFERENCE", | ||
| "EXPOSED_PARAMETER_TYPE", | ||
| "EXPOSED_RETURN_TYPE", | ||
| "EXPOSED_FUNCTION_RETURN_TYPE", | ||
| ) | ||
|
|
||
| package io.sentry.compose | ||
|
|
||
| import androidx.compose.ui.node.LayoutNode | ||
| import androidx.compose.ui.node.NodeCoordinator | ||
|
|
||
| /** | ||
| * Compiled against Compose >= 1.10 where internal LayoutNode accessors are mangled with the module | ||
| * name "ui" (e.g. getChildren$ui(), getOuterCoordinator$ui()) instead of "ui_release" used in | ||
| * earlier versions. | ||
| */ | ||
| public class Compose110Helper { | ||
| public fun getChildren(node: LayoutNode): List<LayoutNode> = node.children | ||
|
|
||
| public fun getOuterCoordinator(node: LayoutNode): NodeCoordinator = node.outerCoordinator | ||
| } |


There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
## 8.35.0.Consider moving the entry to the
## Unreleasedsection, please.