-
-
Notifications
You must be signed in to change notification settings - Fork 85
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
Fixed the predictive back gesture interrupted with the new animation API #760
Conversation
WalkthroughThe recent updates enhance the Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant UI
participant AnimationHandler
participant ChildStack
User->>UI: Initiate predictive back gesture
UI->>AnimationHandler: Start animation
AnimationHandler->>ChildStack: Update stack state
ChildStack-->>AnimationHandler: Get current state
AnimationHandler->>UI: Reflect animation state
User->>UI: Complete or cancel gesture
AnimationHandler->>ChildStack: Finalize stack state
UI-->>User: Update UI accordingly
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
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.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (4)
- extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/Utils.kt (1 hunks)
- extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/DefaultStackAnimation.kt (5 hunks)
- extensions-compose-experimental/src/jvmTest/kotlin/com/arkivanov/decompose/extensions/compose/experimental/TestUtils.kt (1 hunks)
- extensions-compose-experimental/src/jvmTest/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/PredictiveBackGestureTest.kt (1 hunks)
Additional comments not posted (18)
extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/Utils.kt (2)
14-18
: Efficient coroutine management withawaitAll
.The
awaitAll
function is well-implemented, leveragingcoroutineScope
andjoinAll
for concurrent execution of coroutines. This is an efficient and idiomatic approach for coroutine management.
11-11
: Convenientsize
property forChildStack
.The addition of the
size
property is a useful enhancement, providing direct access to the number of items in theChildStack
.extensions-compose-experimental/src/jvmTest/kotlin/com/arkivanov/decompose/extensions/compose/experimental/TestUtils.kt (5)
11-14
: Correct use ofrunOnIdleAndWaitForIdle
.The
runOnIdleAndWaitForIdle
function is well-implemented, ensuring UI consistency before making assertions in tests.
16-21
: Accurate assertion withassertTestTagToRootExists
.The
assertTestTagToRootExists
function is correctly implemented, providing a clear and informative error message when the test tag is not found.
23-28
: Accurate assertion withassertTestTagToRootDoesNotExist
.The
assertTestTagToRootDoesNotExist
function is correctly implemented, providing a clear and informative error message when an unexpected test tag is found.
30-33
: Efficient collection withcollectTestTagsToRoot
.The
collectTestTagsToRoot
function is efficiently implemented, usingmapNotNull
to collect test tags from the root node.
34-43
: Correct traversal withcollectSemanticsFromRoot
.The
collectSemanticsFromRoot
function correctly traverses the node hierarchy, collecting semantics configurations. This is a robust approach for gathering UI semantics.extensions-compose-experimental/src/jvmTest/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/PredictiveBackGestureTest.kt (6)
33-47
: Correct test for inactive gesture state.The test
WHEN_gesture_not_started_THEN_active_child_shown_without_progress
is well-implemented, accurately verifying the UI state when a gesture is not started.
49-65
: Correct test for starting predictive back gesture.The test
WHEN_startPredictiveBack_THEN_gesture_started
is well-implemented, accurately verifying the UI updates when a predictive back gesture is started.
67-86
: Correct test for progressing predictive back gesture.The test
GIVEN_gesture_started_WHEN_progressPredictiveBack_THEN_gesture_progressed
is well-implemented, accurately verifying the UI updates when a predictive back gesture progresses.
88-111
: Correct test for finishing predictive back gesture.The test
GIVEN_gesture_started_WHEN_back_THEN_gesture_finished_and_stack_popped
is well-implemented, accurately verifying the stack state and UI updates when a predictive back gesture is finished.
113-136
: Correct test for canceling predictive back gesture.The test
GIVEN_gesture_started_WHEN_cancelPredictiveBack_THEN_gesture_cancelled_and_stack_not_changed
is well-implemented, accurately verifying the stack state and UI updates when a predictive back gesture is canceled.
138-196
: Well-structured test helpers and classes.The helper functions and classes are well-structured, promoting code reuse and clarity in tests.
extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/DefaultStackAnimation.kt (5)
263-304
: Good encapsulation of animation logic.The
AnimationHandler
class effectively encapsulates the logic for managing animation states and transitions, improving the separation of concerns and enhancing code readability.
209-235
: Improved state management withAnimationHandler
.The use of
AnimationHandler
inonBackStarted
enhances the management of animation states, providing a more structured and maintainable approach.
241-241
: Simplified animation progression withAnimationHandler
.The use of
AnimationHandler
inonBackProgressed
simplifies the logic for handling animation progression during back navigation events.
247-248
: Clear cancellation logic withAnimationHandler
.The use of
AnimationHandler
inonBackCancelled
provides a clear and maintainable approach to canceling animations and resetting states.
255-256
: Streamlined completion logic withAnimationHandler
.The use of
AnimationHandler
inonBack
streamlines the logic for completing animations and updating the stack during back navigation events.
12e3696
to
88d9f00
Compare
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.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (4)
- extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/Utils.kt (1 hunks)
- extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/DefaultStackAnimation.kt (5 hunks)
- extensions-compose-experimental/src/jvmTest/kotlin/com/arkivanov/decompose/extensions/compose/experimental/TestUtils.kt (1 hunks)
- extensions-compose-experimental/src/jvmTest/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/PredictiveBackGestureTest.kt (1 hunks)
Files skipped from review as they are similar to previous changes (4)
- extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/Utils.kt
- extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/DefaultStackAnimation.kt
- extensions-compose-experimental/src/jvmTest/kotlin/com/arkivanov/decompose/extensions/compose/experimental/TestUtils.kt
- extensions-compose-experimental/src/jvmTest/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/PredictiveBackGestureTest.kt
88d9f00
to
16d994d
Compare
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.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (4)
- extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/Utils.kt (1 hunks)
- extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/DefaultStackAnimation.kt (7 hunks)
- extensions-compose-experimental/src/jvmTest/kotlin/com/arkivanov/decompose/extensions/compose/experimental/TestUtils.kt (1 hunks)
- extensions-compose-experimental/src/jvmTest/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/PredictiveBackGestureTest.kt (1 hunks)
Files skipped from review as they are similar to previous changes (4)
- extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/Utils.kt
- extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/DefaultStackAnimation.kt
- extensions-compose-experimental/src/jvmTest/kotlin/com/arkivanov/decompose/extensions/compose/experimental/TestUtils.kt
- extensions-compose-experimental/src/jvmTest/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/PredictiveBackGestureTest.kt
16d994d
to
3aa4d80
Compare
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.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (4)
- extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/Utils.kt (1 hunks)
- extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/DefaultStackAnimation.kt (7 hunks)
- extensions-compose-experimental/src/jvmTest/kotlin/com/arkivanov/decompose/extensions/compose/experimental/TestUtils.kt (1 hunks)
- extensions-compose-experimental/src/jvmTest/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/PredictiveBackGestureTest.kt (1 hunks)
Files skipped from review as they are similar to previous changes (2)
- extensions-compose-experimental/src/jvmTest/kotlin/com/arkivanov/decompose/extensions/compose/experimental/TestUtils.kt
- extensions-compose-experimental/src/jvmTest/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/PredictiveBackGestureTest.kt
Additional comments not posted (3)
extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/Utils.kt (2)
12-12
: LGTM: Addition ofsize
property.The
size
property inChildStack
improves code readability by providing direct access to the number of items.
14-18
: LGTM: Addition ofawaitAll
function.The
awaitAll
function effectively manages concurrent coroutine execution, enhancing asynchronous capabilities.extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/DefaultStackAnimation.kt (1)
270-311
: LGTM: Introduction ofAnimationHandler
class.The
AnimationHandler
class encapsulates animation logic, improving code organization and readability.
3aa4d80
to
c788975
Compare
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.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (5)
- extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/Utils.kt (1 hunks)
- extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/DefaultStackAnimation.kt (7 hunks)
- extensions-compose-experimental/src/jvmTest/kotlin/com/arkivanov/decompose/extensions/compose/experimental/TestUtils.kt (1 hunks)
- extensions-compose-experimental/src/jvmTest/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/ChildStackTest.kt (2 hunks)
- extensions-compose-experimental/src/jvmTest/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/PredictiveBackGestureTest.kt (1 hunks)
Files skipped from review as they are similar to previous changes (4)
- extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/Utils.kt
- extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/DefaultStackAnimation.kt
- extensions-compose-experimental/src/jvmTest/kotlin/com/arkivanov/decompose/extensions/compose/experimental/TestUtils.kt
- extensions-compose-experimental/src/jvmTest/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/PredictiveBackGestureTest.kt
Additional comments not posted (2)
extensions-compose-experimental/src/jvmTest/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/ChildStackTest.kt (2)
18-27
: Imports look good.The new imports for
PredictiveBackParams
andmaterialPredictiveBackAnimatable
are necessary for implementing predictive back parameters.
238-270
: Enhancements togetParameters
look good.The addition of predictive back parameters enhances the flexibility of stack animations. Ensure that these new parameters are adequately tested.
Consider verifying that the predictive back parameters function as expected in real scenarios.
Verification successful
Predictive back parameters are adequately tested.
The search results confirm that the predictive back parameters are used in test cases, ensuring their functionality is verified.
extensions-compose-experimental/src/jvmTest/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/ChildStackTest.kt
extensions-compose-experimental/src/jvmTest/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/PredictiveBackGestureTest.kt
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that the predictive back parameters are used in tests. # Test: Search for test cases using predictive back parameters. Expect: Usage of predictive back parameters in test cases. rg --type kotlin 'predictiveBackParams'Length of output: 7071
c788975
to
945cfa2
Compare
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.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (5)
- extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/Utils.kt (1 hunks)
- extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/DefaultStackAnimation.kt (7 hunks)
- extensions-compose-experimental/src/jvmTest/kotlin/com/arkivanov/decompose/extensions/compose/experimental/TestUtils.kt (1 hunks)
- extensions-compose-experimental/src/jvmTest/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/ChildStackTest.kt (2 hunks)
- extensions-compose-experimental/src/jvmTest/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/PredictiveBackGestureTest.kt (1 hunks)
Files skipped from review as they are similar to previous changes (5)
- extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/Utils.kt
- extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/DefaultStackAnimation.kt
- extensions-compose-experimental/src/jvmTest/kotlin/com/arkivanov/decompose/extensions/compose/experimental/TestUtils.kt
- extensions-compose-experimental/src/jvmTest/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/ChildStackTest.kt
- extensions-compose-experimental/src/jvmTest/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/PredictiveBackGestureTest.kt
Summary by CodeRabbit
New Features
Bug Fixes
Tests