Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9e7859d7 authored by Spandan Das's avatar Spandan Das
Browse files

Rename delegate to delegateNode

`SwipeToSceneRootNode` extends `DelegatingNode`, which contains an
internal variable named `delegate`. Rename this variable in the child
class.

This CL is motivated by fixes for missing kotlin xrefs in f/b/packages/SystemUI.
Android uses kotlinc < 2, while the google3 indexer ues kotlinc > 2.
Versions > 2 are more strict about changing the access privilege of
variables in child classes. At ToT, we get the following compilation
error during kotlinc in google3 indexer.
```
cannot weaken access privilege 'internal' for 'delegate' in 'DelegatingNode'
```

Test: m PlatformComposeSceneTransitionLayout # builds fine
Test: XREF_CORPUS=googleplex-android.googlesource.com/platform/superproject/main//main m out/soong/.intermediates/frameworks/base/packages/SystemUI/compose/scene/PlatformComposeSceneTransitionLayout/android_common/kotlin/PlatformComposeSceneTransitionLayout.kzip
Test: Ran the kotlin indexer locally on this kzip file using go/kythe-git-local-run#indexing-to-local-xrefs-server

Bug: 372675133
Flag: EXEMPT refactor

Change-Id: I081cb36cfe6cb8098ead6a3d48c43b05dfb210e9
parent 3363b51d
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -81,16 +81,16 @@ private class SwipeToSceneRootNode(
    draggableHandler: DraggableHandlerImpl,
    swipeDetector: SwipeDetector,
) : DelegatingNode() {
    private var delegate = delegate(SwipeToSceneNode(draggableHandler, swipeDetector))
    private var delegateNode = delegate(SwipeToSceneNode(draggableHandler, swipeDetector))

    fun update(draggableHandler: DraggableHandlerImpl, swipeDetector: SwipeDetector) {
        if (draggableHandler == delegate.draggableHandler) {
        if (draggableHandler == delegateNode.draggableHandler) {
            // Simple update, just update the swipe detector directly and keep the node.
            delegate.swipeDetector = swipeDetector
            delegateNode.swipeDetector = swipeDetector
        } else {
            // The draggableHandler changed, force recreate the underlying SwipeToSceneNode.
            undelegate(delegate)
            delegate = delegate(SwipeToSceneNode(draggableHandler, swipeDetector))
            undelegate(delegateNode)
            delegateNode = delegate(SwipeToSceneNode(draggableHandler, swipeDetector))
        }
    }
}