Repository navigation
ref(android): [Nav3 support for ViewPager2 – Part 1] Refactor .navigation3.lifecycle ahead of staging Nav3 transactions - #6399
Conversation
…ansaction handle NavLeaseCoordinator now observes each candidate's lifecycle itself, via register(), and publishes and unpublishes its nav state through LeasedNavState. NavScopes folds the old NavScope into an inner class and publishes its StagedNavData and nav transaction through a single publisher. Each NavScopes instance now keeps its nav transaction in a StagedNavTransaction handle, which INavScope.startNavTransaction and finishNavTransaction drive, rather than BackStackObserver binding and unbinding transactions itself and the coordinator retaining them. StagedNavTransaction alone decides whether the scope's transaction slot is free. No behavior change: nav transactions still start only with the nav lease and a free slot, and an owner that regains the lease still gets its unfinished transaction back. The integration tests are unchanged. This prepares for deferring transactions requested without the lease. Refs JAVA-785 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
📲 Install BuildsAndroid
|
runningcode
left a comment
There was a problem hiding this comment.
Thanks for putting this together along with the docs and diagrams!
This was a long one so I'll just note that I didn't review the tests.
My only thought is that it seems like a lot of code for just adding ViewPager2 support :O
Thanks for taking a look! Yeah, it's a lot of code. Fwiw, this PR will pay off w/r/t the next PR in this stack. This one's a refactor that gives us better abstractions and prevents the next PR's actual changes from being more or less indecipherable. ("Indecipherable" is where my clankers' various attempts started until I led the best prototype through the refactorings here.) |
0d30809
into
0xadam-brown/collection/nav3-deferred-transactions
PR Stack (Nav3 Deferred Transactions)
📜 Description
Refactors
.navigation3.lifecycleahead of staging nav transactions in the next PR.Lets us separate three responsibilities:
Behavior is unchanged save for one corner case: when a SentryNavEffect regains the lease, its unfinished transaction is now also re-bound if the scope holds a finished transaction. Before, it was only re-bound into an empty scope. The update matches the rule for starting a transaction, and in practice shouldn't occur, since a finished
SentryTracerremoves itself from the scope.See the PR description in #6398 for more details.
💡 Motivation and Context
Splits out structural refactoring from the meaningful behavioral changes which follow.
addresses: JAVA-785
💚 How did you test it?
📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps
The next PR stages nav transactions requested without the nav lease.
#skip-changelog