Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -442,10 +442,33 @@ class ScreenStackFragment :
}
}

private fun isComposeView(view: View): Boolean {
val name = view.javaClass.name
return name.startsWith("androidx.compose.ui.platform.")
Copy link
Author

Choose a reason for hiding this comment

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

Found out it doesn't work in release mode - R8 strips class names.

Normally I'd just check if view is instance of a compose class, however here adding compose as a dependency doesn't seem an option.

Looking forward to some advice on how to tackle this

Copy link
Author

Choose a reason for hiding this comment

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

Best solution would be adding proguard rules to keep compose classes - lmk if you're cool with it

Copy link
Member

Choose a reason for hiding this comment

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

Good that you catched this.

Isn't proguard configured on the app level? This is not really a proper solution from the library perspective & I'd like to avoid additional installation steps here.

I'll try to come up with something sensible when doing review & testing this.

I've withheld myself with review, before I fully understand the code & see the issue firsthand first. I'll be on PTO until end of the week. On Monday I'll try to do a proper testing & review here.

Copy link
Author

@msynowski msynowski Oct 9, 2025

Choose a reason for hiding this comment

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

Isn't proguard configured on the app level?

Yup. There's this thing called consumerProguardFiles, but it only works when the dependency is distributed as AAR and that's unfortunately not the case

Copy link
Author

Choose a reason for hiding this comment

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

On Monday I'll try to do a proper testing & review here.

Thanks!

}

private fun findComposeContainer(view: View?): View? {
var current = view

while (current != null) {
if (!isComposeView(current)) return current
current = (current.parent as? View)
}

return null
}

private fun findLastFocusedChild(): View? {
var view: View? = screen
while (view != null) {
if (view.isFocused) return view
if (view.isFocused) {
if (isComposeView(view)) {
return findComposeContainer(view)
}

return view
}

view = if (view is ViewGroup) view.focusedChild else null
}

Expand Down
Loading