Skip to content
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

Added new stack animation API with shared transitions support #753

Merged
merged 1 commit into from
Aug 7, 2024

Conversation

arkivanov
Copy link
Owner

@arkivanov arkivanov commented Aug 6, 2024

Fixes #690.

Summary by CodeRabbit

  • New Features

    • Introduced a framework for managing and animating child stacks in a Jetpack Compose UI, with various animation types including fade, scale, and slide.
    • Added support for predictive back navigation gestures to enhance UI interactions.
  • Bug Fixes

    • Improved handling of animation transitions and stack management for a smoother user experience.
  • Documentation

    • Updated configuration files to support multiplatform development and integration with existing libraries.
  • Tests

    • Added comprehensive unit tests for newly implemented features, ensuring robustness in animation and stack management functionalities.

@arkivanov arkivanov marked this pull request as draft August 6, 2024 23:02
Copy link

coderabbitai bot commented Aug 6, 2024

Walkthrough

The recent updates introduce a comprehensive framework for managing stack animations in Jetpack Compose applications using the Decompose library. Key enhancements include new classes and interfaces for animation control, utilities for managing child stacks, and improved composable functions. These changes provide developers with essential tools to implement smooth transitions between UI components, facilitating a more dynamic user experience.

Changes

Files Change Summary
extensions-compose-experimental/.gitignore Added .gitignore to exclude the /build directory from version control.
extensions-compose-experimental/api/android/... Introduced classes and functions for ChildStack, animation management, and back navigation.
extensions-compose-experimental/api/extensions-compose-experimental.klib.api Added Kotlin interfaces and classes for stack animations within Compose.
extensions-compose-experimental/build.gradle.kts Configured a multiplatform project setup for the library.
extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/... Added multiple files for managing child stacks, animations, and utility functions.
extensions-compose-experimental/src/jvmTest/... Introduced unit tests for ChildStack and animation functionalities to ensure correctness.
sample/shared/compose/build.gradle.kts Added dependency for the new experimental shared transitions.
sample/shared/compose/src/commonMain/kotlin/... Updated composable functions to incorporate AnimatedVisibilityScope for better animation control.
settings.gradle.kts Included new module extensions-compose-experimental in project settings.

Assessment against linked issues

Objective Addressed Explanation
Consider adding integration for shared element transitions (Issue #690)
Facilitate access to AnimatedVisibilityScope in child components
Provide a structure for stack animations and transitions
Ensure smooth navigation experiences with back gestures

Poem

Hop along the code path, so bright,
With animations dancing in the light.
From child stacks to fades, so grand,
A smoother journey, all carefully planned.
In Compose we trust, with joy we leap,
As transitions and flows make our hearts skip! 🐰✨


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?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Outside diff range, codebase verification and nitpick comments (3)
extensions-compose/build.gradle.kts (1)

Verify the impact of removing kotlinxCoroutinesCore.

The kotlinx.coroutines package is still being used in multiple files across the codebase. The removal of the kotlinxCoroutinesCore dependency from common.main.dependencies may lead to build issues or runtime errors. Please ensure that this dependency is either replaced or no longer required.

  • extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/DefaultStackAnimation.kt
  • sample/shared/compose/src/jvmTest/kotlin/com/arkivanov/sample/shared/counters/counter/CounterContentTest.kt
  • sample/app-desktop/src/jvmMain/kotlin/com/arkivanov/sample/app/Main.kt
  • extensions-compose/src/jvmMain/kotlin/com/arkivanov/decompose/extensions/compose/lifecycle/LifecycleController.kt
  • decompose/src/nonWebTest/kotlin/com/arkivanov/decompose/AbstractThreadingTest.kt
  • extensions-compose/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/stack/animation/predictiveback/AndroidPredictiveBackAnimatable.kt
  • extensions-compose/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/stack/animation/predictiveback/PredictiveBackAnimation.kt
  • extensions-compose/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/stack/animation/predictiveback/MaterialPredictiveBackAnimatable.kt
Analysis chain

Line range hint 31-31:
Verify the impact of removing kotlinxCoroutinesCore.

The removal of the kotlinxCoroutinesCore dependency suggests a shift in the project's dependency management. Ensure that the functionality related to coroutine support is not negatively impacted.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of `kotlinxCoroutinesCore` in the codebase.

# Test: Search for the usage of `kotlinx.coroutines` package. Expect: No remaining usages if the dependency is truly no longer required.
rg --type kotlin -A 5 $'kotlinx.coroutines'

Length of output: 11051

extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/DefaultStackAnimator.kt (1)

1-2: Add a file-level KDoc comment.

Consider adding a KDoc comment at the top of the file to describe the purpose and usage of this class.

sample/shared/compose/src/commonMain/kotlin/com/arkivanov/sample/shared/sharedtransitions/gallery/GalleryContent.kt (1)

3-4: Remove unused import.

The import androidx.compose.animation.AnimatedVisibility is not used in this function.

- import androidx.compose.animation.AnimatedVisibility
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 1e9dba3 and 5dd51a9.

Files selected for processing (30)
  • extensions-compose-experimental/.gitignore (1 hunks)
  • extensions-compose-experimental/api/android/extensions-compose-experimental.api (1 hunks)
  • extensions-compose-experimental/api/extensions-compose-experimental.klib.api (1 hunks)
  • extensions-compose-experimental/api/jvm/extensions-compose-experimental.api (1 hunks)
  • extensions-compose-experimental/build.gradle.kts (1 hunks)
  • extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/ChildStack.kt (1 hunks)
  • extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/SimpleAnimatedVisibilityScope.kt (1 hunks)
  • 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 (1 hunks)
  • extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/DefaultStackAnimator.kt (1 hunks)
  • extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/EmptyStackAnimation.kt (1 hunks)
  • extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/Fade.kt (1 hunks)
  • extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/PredictiveBackParams.kt (1 hunks)
  • extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/Scale.kt (1 hunks)
  • extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/Slide.kt (1 hunks)
  • extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/StackAnimation.kt (1 hunks)
  • extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/StackAnimationProvider.kt (1 hunks)
  • extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/StackAnimator.kt (1 hunks)
  • extensions-compose-experimental/src/jvmTest/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/ChildStackTest.kt (1 hunks)
  • extensions-compose-experimental/src/jvmTest/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/GetFadeAlphaTest.kt (1 hunks)
  • extensions-compose-experimental/src/jvmTest/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/StackAnimationDirectionsTest.kt (1 hunks)
  • extensions-compose/build.gradle.kts (1 hunks)
  • extensions-compose/src/jvmTest/kotlin/com/arkivanov/decompose/extensions/compose/stack/animation/StackAnimationDirectionsTest.kt (3 hunks)
  • sample/shared/compose/build.gradle.kts (2 hunks)
  • sample/shared/compose/src/commonMain/kotlin/com/arkivanov/sample/shared/sharedtransitions/SharedTransitionsContent.kt (1 hunks)
  • sample/shared/compose/src/commonMain/kotlin/com/arkivanov/sample/shared/sharedtransitions/gallery/GalleryContent.kt (4 hunks)
  • sample/shared/compose/src/commonMain/kotlin/com/arkivanov/sample/shared/sharedtransitions/photo/PhotoContent.kt (4 hunks)
  • sample/shared/shared/src/commonMain/kotlin/com/arkivanov/sample/shared/sharedtransitions/DefaultSharedTransitionsComponent.kt (1 hunks)
  • sample/shared/shared/src/commonMain/kotlin/com/arkivanov/sample/shared/sharedtransitions/SharedTransitionsComponent.kt (1 hunks)
  • settings.gradle.kts (1 hunks)
Files skipped from review due to trivial changes (1)
  • extensions-compose-experimental/.gitignore
Additional comments not posted (118)
extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/Utils.kt (1)

8-8: LGTM!

The code changes are approved.

extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/StackAnimationProvider.kt (2)

7-9: LGTM!

The code changes are approved.


11-17: LGTM!

The code changes are approved.

sample/shared/shared/src/commonMain/kotlin/com/arkivanov/sample/shared/sharedtransitions/SharedTransitionsComponent.kt (2)

9-13: LGTM!

The code changes are approved.


Line range hint 14-19:
No changes detected.

No review comments are necessary for unchanged code.

extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/SimpleAnimatedVisibilityScope.kt (2)

18-20: LGTM!

The implementation of SimpleAnimatedVisibilityScope is correct.


9-16: LGTM! But verify the function usage in the codebase.

The code changes are approved.

However, ensure that all function calls to WithAnimatedVisibilityScope are used correctly.

Verification successful

Function usage verified!

The function WithAnimatedVisibilityScope is used correctly in the following files:

  • EmptyStackAnimation.kt
  • DefaultStackAnimation.kt

Both instances correctly pass the transition parameter and use the composable block as intended.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `WithAnimatedVisibilityScope`.

# Test: Search for the function usage. Expect: Correct usage of the function.
rg --type kotlin -A 5 $'WithAnimatedVisibilityScope'

Length of output: 5956


Script:

#!/bin/bash
# Extract relevant code snippets from EmptyStackAnimation.kt and DefaultStackAnimation.kt to verify the correct usage of WithAnimatedVisibilityScope.

# Extract code from EmptyStackAnimation.kt
echo "Code from EmptyStackAnimation.kt:"
rg --type kotlin -A 10 -B 10 'WithAnimatedVisibilityScope' extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/EmptyStackAnimation.kt

# Extract code from DefaultStackAnimation.kt
echo "Code from DefaultStackAnimation.kt:"
rg --type kotlin -A 10 -B 10 'WithAnimatedVisibilityScope' extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/DefaultStackAnimation.kt

Length of output: 3901

extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/Scale.kt (1)

13-27: LGTM! But verify the function usage in the codebase.

The code changes are approved.

However, ensure that all function calls to scale are used correctly.

extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/Fade.kt (2)

24-25: LGTM!

The implementation of getFadeAlpha is correct.


15-22: LGTM! But verify the function usage in the codebase.

The code changes are approved.

However, ensure that all function calls to fade are used correctly.

Verification successful

Function fade is used correctly in the codebase.

The usages of the fade function across the codebase are consistent with its intended purpose of providing a fading animation. The function is used appropriately in both test cases and main code.

  • Verified in files:
    • extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/StackAnimation.kt
    • extensions-compose-experimental/src/jvmTest/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/ChildStackTest.kt
    • sample/shared/compose/src/commonMain/kotlin/com/arkivanov/sample/shared/dynamicfeatures/DynamicFeaturesContent.kt
    • sample/shared/compose/src/commonMain/kotlin/com/arkivanov/sample/shared/tabs/TabsContent.kt
    • sample/shared/compose/src/commonMain/kotlin/com/arkivanov/sample/shared/sharedtransitions/SharedTransitionsContent.kt
    • sample/shared/compose/src/commonMain/kotlin/com/arkivanov/sample/shared/root/RootContent.kt
    • sample/shared/compose/src/commonMain/kotlin/com/arkivanov/sample/shared/dynamicfeatures/dynamicfeature/DynamicFeatureContent.kt
    • sample/shared/compose/src/commonMain/kotlin/com/arkivanov/sample/shared/counters/CountersContent.kt
    • extensions-compose/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/stack/animation/StackAnimation.kt
    • extensions-compose/src/jvmTest/kotlin/com/arkivanov/decompose/extensions/compose/stack/ChildrenTest.kt
    • extensions-compose/src/nonAndroidMain/kotlin/com/arkivanov/decompose/extensions/compose/stack/animation/predictiveback/PredictiveBackGestureOverlay.kt
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `fade`.

# Test: Search for the function usage. Expect: Correct usage of the function.
rg --type kotlin -A 5 $'fade'

Length of output: 28500


Script:

#!/bin/bash
# Description: Gather detailed context around the usages of the `fade` function to verify its correct usage.

# Search for the function usage and include more context lines to understand the usage better.
rg --type kotlin -A 10 -B 2 $'fade()'

Length of output: 53677

settings.gradle.kts (1)

31-31: LGTM! The new module inclusion is correct.

The addition of the new module extensions-compose-experimental is consistent with the existing module inclusions.

extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/PredictiveBackParams.kt (1)

1-30: LGTM! The class PredictiveBackParams is well-defined.

The class contains clear documentation and correctly defined parameters for the predictive back gesture.

extensions-compose-experimental/build.gradle.kts (6)

1-7: Imports look good.

The import statements are concise and relevant to the build configuration.


9-15: Plugin setup is appropriate.

The necessary plugins for Kotlin multiplatform, Android, and Compose are included.


17-24: Multiplatform setup is comprehensive.

The multiplatform setup includes targets for Android, JVM, macOS, iOS, JavaScript, and WebAssembly.


26-27: Publication and binary compatibility setup is appropriate.

The setup for publication and binary compatibility validation is included.


29-31: Android namespace is correctly defined.

The Android namespace is set appropriately for the new module.


33-55: Source sets and dependencies are well-defined.

The source sets and dependencies for common and JVM targets are correctly set up. The use of optIn for internal APIs is also noted.

extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/Slide.kt (5)

1-1: Package declaration is appropriate.

The package declaration follows the standard naming conventions.


3-9: Imports and annotation are appropriate.

The necessary imports for animation, gestures, and layout are included. The use of @ExperimentalDecomposeApi annotation is noted.


10-23: Slide animation function is well-defined.

The slide function provides a configurable sliding animation for stack transitions. The use of FiniteAnimationSpec and Orientation parameters allows flexibility.


25-32: Horizontal offset calculation is correct.

The offsetXFactor function correctly calculates the horizontal offset for the sliding animation.


34-41: Vertical offset calculation is correct.

The offsetYFactor function correctly calculates the vertical offset for the sliding animation.

extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/EmptyStackAnimation.kt (5)

1-1: Package declaration is appropriate.

The package declaration follows the standard naming conventions.


3-15: Imports and annotation are appropriate.

The necessary imports for animation, layout, and runtime are included. The use of @ExperimentalDecomposeApi annotation is noted.


16-18: Empty stack animation function is well-defined.

The emptyStackAnimation function provides a way to create an empty stack animation.


20-24: Comment provides useful context.

The comment explains why the class cannot be anonymous, referencing relevant GitHub issues.


26-43: EmptyStackAnimation class is correctly implemented.

The EmptyStackAnimation class implements the StackAnimation interface and provides a composable function for the animation. The use of MutableTransitionState and rememberTransition is appropriate for managing the animation state.

extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/DefaultStackAnimator.kt (3)

3-7: Imports are appropriate.

The imports are relevant and necessary for the functionality provided in this file.


15-19: Class and constructor definition looks good.

The DefaultStackAnimator class is defined with an appropriate constructor and default parameter values.


21-40: Ensure proper handling of EnterExitState cases.

The animate function handles EnterExitState cases correctly. Ensure that all possible states are covered and handled as expected.

sample/shared/compose/src/commonMain/kotlin/com/arkivanov/sample/shared/sharedtransitions/photo/PhotoContent.kt (5)

3-3: Ensure AnimatedVisibility import is necessary.

The import for AnimatedVisibility is necessary for the new visibility mechanism.


4-4: Ensure AnimatedVisibilityScope import is necessary.

The import for AnimatedVisibilityScope is necessary for the new visibility mechanism.


25-25: Parameter change is appropriate.

The parameter change from isVisible: Boolean to animatedVisibilityScope: AnimatedVisibilityScope is appropriate for the new visibility mechanism.


35-37: Ensure sharedElement function handles animatedVisibilityScope correctly.

The sharedElement function now uses animatedVisibilityScope. Ensure that this change is handled correctly within the function.


52-58: Usage of AnimatedVisibility is correct.

The usage of AnimatedVisibility in the PhotoContentPreview function is correct and aligns with the new parameter structure.

sample/shared/shared/src/commonMain/kotlin/com/arkivanov/sample/shared/sharedtransitions/DefaultSharedTransitionsComponent.kt (1)

53-55: New onBack method implementation looks good.

The onBack method correctly calls nav.pop() to handle back navigation.

sample/shared/compose/src/commonMain/kotlin/com/arkivanov/sample/shared/sharedtransitions/SharedTransitionsContent.kt (5)

10-16: LGTM! New imports are necessary and correctly used.

The new imports for experimental APIs from the decompose library are appropriate and correctly utilized in the code.


22-22: LGTM! Opt-in for experimental APIs is appropriate.

The opt-in for ExperimentalSharedTransitionApi and ExperimentalDecomposeApi is necessary for using the experimental features.


29-38: LGTM! Enhanced state management and animation handling.

The transition from Children to ChildStack and the introduction of PredictiveBackParams improve state management and animation handling.


44-44: LGTM! Correct usage of animatedVisibilityScope.

The use of animatedVisibilityScope enhances the animation capabilities for GalleryContent.


51-51: LGTM! Correct usage of animatedVisibilityScope.

The use of animatedVisibilityScope enhances the animation capabilities for PhotoContent.

extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/StackAnimator.kt (3)

1-24: LGTM! Well-defined StackAnimator interface.

The StackAnimator interface is well-defined and provides a clear contract for animating child widgets.


27-45: LGTM! Useful stackAnimator function.

The stackAnimator function provides a convenient way to create StackAnimator implementations with frame-by-frame rendering.


48-72: LGTM! Useful plus operator for combining animators.

The plus operator allows combining multiple StackAnimator instances, enhancing flexibility.

extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/StackAnimation.kt (3)

1-23: LGTM! Well-defined StackAnimation interface.

The StackAnimation interface is well-defined and provides a clear contract for animating between child widgets.


26-42: LGTM! Useful stackAnimation function with selector.

The stackAnimation function with a selector provides flexibility in choosing different StackAnimator instances for different children and directions.


45-61: LGTM! Useful stackAnimation function with default animator.

The stackAnimation function with a default animator simplifies the creation of StackAnimation instances with common animation behaviors.

sample/shared/compose/src/commonMain/kotlin/com/arkivanov/sample/shared/sharedtransitions/gallery/GalleryContent.kt (3)

29-31: LGTM!

The new parameter animatedVisibilityScope is correctly used for shared element transitions.


62-68: LGTM!

The GalleryContentPreview function correctly uses AnimatedVisibility to wrap GalleryContent with the new animatedVisibilityScope parameter.


45-47: Ensure rememberSharedContentState is defined and used correctly.

Verify that rememberSharedContentState correctly handles the animatedVisibilityScope parameter.

sample/shared/compose/build.gradle.kts (1)

61-61: LGTM!

The new dependency implementation(project(":extensions-compose-experimental")) is correctly added for experimental shared transitions.

extensions-compose-experimental/src/jvmTest/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/GetFadeAlphaTest.kt (2)

8-59: LGTM!

The test cases comprehensively cover various scenarios for the getFadeAlpha function.


61-74: LGTM!

The getFadeAlpha_allCases test function correctly tests all cases for the getFadeAlpha function.

extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/ChildStack.kt (6)

68-82: Ensure state subscription logic is correct.

The function subscribes to the stack state using subscribeAsState. Verify that the state subscription is correctly set up and managed.

Verification successful

State subscription logic is correctly set up.

The function ChildStack subscribes to the state using subscribeAsState and uses this state to call another ChildStack function. This pattern is consistent with other usages in the codebase, confirming that the state subscription logic is correctly set up and managed.

  • extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/ChildStack.kt (line 68)
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that the state subscription is correctly set up and managed.

# Test: Search for the usage of `subscribeAsState`. Expect: It should be correctly set up and managed.
rg --type kotlin -A 5 $'subscribeAsState'

Length of output: 22001


84-86: Ensure key generation logic is correct.

The function generates a set of keys for the child stack. Verify that the keys are correctly generated and unique.

Verification successful

Ensure key generation logic is correct.

The keyHashString function is designed to generate unique keys, as evidenced by its implementation and the associated test cases.

  • Implementation: decompose/src/commonMain/kotlin/com/arkivanov/decompose/Utils.kt
  • Test cases: decompose/src/commonTest/kotlin/com/arkivanov/decompose/KeyHashStringTest.kt
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that the keys are correctly generated and unique.

# Test: Search for the usage of `keyHashString` to ensure it generates unique keys.
rg --type kotlin -A 5 $'keyHashString'

Length of output: 11433


87-102: Ensure state retention logic is correct.

The function retains the states of the current keys. Verify that the state retention logic is correctly handled and optimized.

Verification successful

State retention logic is correctly handled and optimized.

The retainStates function is used consistently in the codebase, ensuring that states not in the current keys are removed. The logic appears to be correctly handled and optimized.

  • extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/ChildStack.kt
  • extensions-compose/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/stack/Children.kt
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that the state retention logic is correctly handled and optimized.

# Test: Search for the usage of `retainStates`. Expect: It should be correctly handled and optimized.
rg --type kotlin -A 5 $'retainStates'

Length of output: 3839


34-52: Ensure LocalStackAnimationProvider is correctly provided.

The function uses LocalStackAnimationProvider to obtain the default animation if none is provided. Verify that LocalStackAnimationProvider is correctly set up in the parent composable.


40-42: Ensure state retention logic is correct.

The function uses rememberSaveableStateHolder to retain states. Verify that the keys used for state retention are unique and consistent.


71-73: Ensure animation parameters are correctly handled.

The function passes the animation parameter to the previous ChildStack function. Verify that the animation parameters are correctly handled and passed.

Verification successful

The ChildStack function definitions were found in ChildStack.kt:

  • extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/ChildStack.kt

The animation parameter is correctly handled and passed within the ChildStack function. The implementation ensures that the animation parameter is used appropriately, either directly or passed to other functions.

Locations:

  • extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/ChildStack.kt
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that the animation parameters are correctly handled and passed.

# Test: Search for the usage of `animation` parameter. Expect: It should be correctly handled and passed.
rg --type kotlin -A 5 $'animation'

Length of output: 165917


Script:

#!/bin/bash
# Description: Verify the implementation of the ChildStack function and how the animation parameter is handled.

# Search for the implementation of the ChildStack function in the repository
ast-grep --lang kotlin --pattern $'@Composable\nfun <C : Any, T : Any> ChildStack(stack: $_, animation: $_, content: $_) { $$$ }'

Length of output: 129


Script:

#!/bin/bash
# Description: Verify the implementation of the ChildStack function and how the animation parameter is handled.

# Search for the definition of the ChildStack function in the repository
rg --type kotlin -A 10 'fun <C : Any, T : Any> ChildStack('

Length of output: 180


Script:

#!/bin/bash
# Description: Verify the implementation of the ChildStack function and how the animation parameter is handled.

# Search for the definition of the ChildStack function in the repository with corrected regex pattern
rg --type kotlin -A 10 'fun <C : Any, T : Any> ChildStack\('

Length of output: 3672

extensions-compose/src/jvmTest/kotlin/com/arkivanov/decompose/extensions/compose/stack/animation/StackAnimationDirectionsTest.kt (4)

Line range hint 31-60:
Ensure correct integration and validation of the new data structure.

The test function now uses a HashMap named results for tracking directions. Verify that the new data structure is correctly integrated and validated.

Verification successful

Ensure correct integration and validation of the new data structure.

The test function now uses a HashMap named results for tracking directions. The integration and validation of this data structure appear to be consistent. The results data structure is correctly initialized, used, cleared, and validated against the expected values.

  • The results data structure is initialized and used to store directions.
  • It is cleared before updating the stack.
  • The final assertion checks the results against the expected values.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the integration and validation of the new data structure.

# Test: Search for the usage of `results` to ensure it is correctly integrated and validated.
rg --type kotlin -A 5 $'results'

Length of output: 17134


Line range hint 76-98:
Ensure correct integration and validation of the new expected data structure.

The getParameters function returns a list of Params with the new expected data structure. Verify that the new data structure is correctly integrated and validated.

Verification successful

Ensure correct integration and validation of the new expected data structure.

The expected field within the Params class is correctly integrated and validated through assertions in the test files.

  • extensions-compose-experimental/src/jvmTest/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/StackAnimationDirectionsTest.kt
  • extensions-compose/src/jvmTest/kotlin/com/arkivanov/decompose/extensions/compose/stack/animation/StackAnimationDirectionsTest.kt
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the integration and validation of the new expected data structure.

# Test: Search for the usage of `expected` to ensure it is correctly integrated and validated.
rg --type kotlin -A 5 $'expected'

Length of output: 46299


100-104: Ensure correct integration and validation of the new data structure in Params.

The Params class now uses a Map for the expected data structure. Verify that the new data structure is correctly integrated and validated.

Verification successful

Ensure correct integration and validation of the new data structure in Params.

The Params class has been correctly updated to use a Map for the expected data structure. The new structure is integrated and validated in the test cases where instances of Params are created with the expected values.

  • extensions-compose-experimental/src/jvmTest/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/StackAnimationDirectionsTest.kt
  • extensions-compose/src/jvmTest/kotlin/com/arkivanov/decompose/extensions/compose/stack/animation/StackAnimationDirectionsTest.kt
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the integration and validation of the new data structure in `Params`.

# Test: Search for the usage of `Params` to ensure it is correctly integrated and validated.
rg --type kotlin -A 5 $'Params'

Length of output: 40120


Line range hint 61-65:
Ensure correctness of the stack function.

The stack function sets up the child stack configurations. Verify that it correctly sets up the configurations.

Verification successful

Ensure correctness of the stack function.

The stack function correctly sets up the child stack configurations by assigning the last element as the active child and the rest as the back stack. This setup is used in multiple places within the test file to initialize the stack for testing animation directions.

  • The function assigns the last element of the configs list as the active child.
  • The remaining elements are assigned to the back stack.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the correctness of the `stack` function.

# Test: Search for the usage of `stack` to ensure it correctly sets up the configurations.
rg --type kotlin -A 5 $'stack'

Length of output: 434062

extensions-compose-experimental/src/jvmTest/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/StackAnimationDirectionsTest.kt (4)

31-59: Ensure correct integration and validation of the new data structure and animation.

The test function uses a HashMap named results for tracking directions and DefaultStackAnimation for animations. Verify that the new data structure and animation are correctly integrated and validated.

Verification successful

Integration and validation of the new data structure and animation are correctly handled.

The test function in StackAnimationDirectionsTest.kt correctly integrates and validates the results data structure and DefaultStackAnimation. The usage is consistent with other test cases.

  • results is used to track directions.
  • DefaultStackAnimation is instantiated with appropriate parameters.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the integration and validation of the new data structure and animation.

# Test: Search for the usage of `results` and `DefaultStackAnimation` to ensure they are correctly integrated and validated.
rg --type kotlin -A 5 $'results'
rg --type kotlin -A 5 $'DefaultStackAnimation'

Length of output: 21630


76-98: Ensure correct integration and validation of the new expected data structure.

The getParameters function returns a list of Params with the new expected data structure. Verify that the new data structure is correctly integrated and validated.

Verification successful

The new expected data structure is correctly integrated and validated.

The expected field in the Params class is used in assertions within the test file to ensure the results match the expected output, confirming proper integration and validation.

  • File: extensions-compose-experimental/src/jvmTest/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/StackAnimationDirectionsTest.kt
  • Line: 76-98
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the integration and validation of the new expected data structure.

# Test: Search for the usage of `expected` to ensure it is correctly integrated and validated.
rg --type kotlin -A 5 $'expected'

Length of output: 46299


100-104: Ensure correct integration and validation of the new data structure in Params.

The Params class uses a Map for the expected data structure. Verify that the new data structure is correctly integrated and validated.

Verification successful

Integration and validation of the new data structure in Params is correct.

The Params class, which uses a Map for the expected data structure, is correctly integrated and validated within the StackAnimationDirectionsTest.kt file. The usage within the getParameters function and as a private property confirms its proper implementation.

  • extensions-compose-experimental/src/jvmTest/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/StackAnimationDirectionsTest.kt
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the integration and validation of the new data structure in `Params`.

# Test: Search for the usage of `Params` to ensure it is correctly integrated and validated.
rg --type kotlin -A 5 $'Params'

Length of output: 40120


61-65: Ensure correctness of the stack function.

The stack function sets up the child stack configurations. Verify that it correctly sets up the configurations.

Verification successful

Ensure correctness of the stack function.

The stack function sets up the child stack configurations. The verification of its correctness is supported by its usage in the StackAnimationDirectionsTest.kt file and the extensive use of ChildStack in the codebase.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the correctness of the `stack` function.

# Test: Search for the usage of `stack` to ensure it correctly sets up the configurations.
rg --type kotlin -A 5 $'stack'

Length of output: 434062

extensions-compose-experimental/api/android/extensions-compose-experimental.api (11)

2-3: Ensure proper usage of Composer parameters.

The functions ChildStack take Composer parameters. Ensure that these parameters are correctly used and managed to avoid any runtime issues.


7-8: Ensure proper usage of synthetic functions.

The functions fade and fade$default are synthetic functions. Ensure that these functions are correctly used and managed to avoid any runtime issues.


13-17: Ensure proper initialization and usage of back handler functions.

The constructor and getter functions for back handler and animatable selector must be correctly initialized and used to avoid any runtime issues.


21-22: Ensure proper usage of synthetic functions.

The functions scale and scale$default are synthetic functions. Ensure that these functions are correctly used and managed to avoid any runtime issues.


26-27: Ensure proper usage of synthetic functions.

The functions slide and slide$default are synthetic functions. Ensure that these functions are correctly used and managed to avoid any runtime issues.


31-31: Ensure proper implementation of the abstract function.

The abstract function invoke must be correctly implemented in the derived classes to avoid any runtime issues.


35-38: Ensure proper usage of synthetic functions.

The functions stackAnimation and stackAnimation$default are synthetic functions. Ensure that these functions are correctly used and managed to avoid any runtime issues.


42-42: Ensure proper implementation of the abstract function.

The abstract function provide must be correctly implemented in the derived classes to avoid any runtime issues.


46-46: Ensure proper usage of the function.

The function getLocalStackAnimationProvider must be correctly used to avoid any runtime issues.


50-50: Ensure proper implementation of the abstract function.

The abstract function animate must be correctly implemented in the derived classes to avoid any runtime issues.


54-56: Ensure proper usage of synthetic functions.

The functions plus, stackAnimator, and stackAnimator$default are synthetic functions. Ensure that these functions are correctly used and managed to avoid any runtime issues.

extensions-compose-experimental/api/jvm/extensions-compose-experimental.api (11)

2-3: Ensure proper usage of Composer parameters.

The functions ChildStack take Composer parameters. Ensure that these parameters are correctly used and managed to avoid any runtime issues.


7-8: Ensure proper usage of synthetic functions.

The functions fade and fade$default are synthetic functions. Ensure that these functions are correctly used and managed to avoid any runtime issues.


13-17: Ensure proper initialization and usage of back handler functions.

The constructor and getter functions for back handler and animatable selector must be correctly initialized and used to avoid any runtime issues.


21-22: Ensure proper usage of synthetic functions.

The functions scale and scale$default are synthetic functions. Ensure that these functions are correctly used and managed to avoid any runtime issues.


26-27: Ensure proper usage of synthetic functions.

The functions slide and slide$default are synthetic functions. Ensure that these functions are correctly used and managed to avoid any runtime issues.


31-31: Ensure proper implementation of the abstract function.

The abstract function invoke must be correctly implemented in the derived classes to avoid any runtime issues.


35-38: Ensure proper usage of synthetic functions.

The functions stackAnimation and stackAnimation$default are synthetic functions. Ensure that these functions are correctly used and managed to avoid any runtime issues.


42-42: Ensure proper implementation of the abstract function.

The abstract function provide must be correctly implemented in the derived classes to avoid any runtime issues.


46-46: Ensure proper usage of the function.

The function getLocalStackAnimationProvider must be correctly used to avoid any runtime issues.


50-50: Ensure proper implementation of the abstract function.

The abstract function animate must be correctly implemented in the derived classes to avoid any runtime issues.


54-56: Ensure proper usage of synthetic functions.

The functions plus, stackAnimator, and stackAnimator$default are synthetic functions. Ensure that these functions are correctly used and managed to avoid any runtime issues.

extensions-compose-experimental/src/jvmTest/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/ChildStackTest.kt (6)

41-47: Ensure proper test coverage for edge cases.

The test function verifies the basic scenario. Ensure that edge cases, such as null or invalid states, are also covered.


50-57: Ensure proper test coverage for edge cases.

The test function verifies the basic scenario. Ensure that edge cases, such as null or invalid states, are also covered.


60-67: Ensure proper test coverage for edge cases.

The test function verifies the basic scenario. Ensure that edge cases, such as null or invalid states, are also covered.


70-78: Ensure proper test coverage for edge cases.

The test function verifies the basic scenario. Ensure that edge cases, such as null or invalid states, are also covered.


81-90: Ensure proper test coverage for edge cases.

The test function verifies the basic scenario. Ensure that edge cases, such as null or invalid states, are also covered.


93-102: Ensure proper test coverage for edge cases.

The test function verifies the basic scenario

extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/DefaultStackAnimation.kt (12)

37-41: Constructor and Class-Level Properties Look Good

The constructor initializes necessary properties for DefaultStackAnimation, including disableInputDuringAnimation, predictiveBackParams, and selector. These properties are essential for managing stack animations and predictive back gestures.


96-115: Child Composable Function Looks Good

The Child composable function handles the animation of individual child components. It uses rememberTransition and WithAnimatedVisibilityScope to manage the visibility and animation states. The use of LaunchedEffect to trigger onFinished is appropriate.


161-184: PredictiveBackController Composable Function Looks Good

The PredictiveBackController composable function manages the predictive back gestures using a DisposableEffect to register and unregister the back callback. The use of rememberCoroutineScope and PredictiveBackCallback is appropriate.


186-199: AnimationItem Factory Function Looks Good

The AnimationItem factory function creates animation items with the appropriate animator. The use of the selector function to determine the animator is appropriate.


284-296: Overlay Composable Function Looks Good

The Overlay composable function creates a box that consumes pointer events to disable input during animations. The use of pointerInput and awaitPointerEventScope is appropriate.


298-304: AnimationItem Data Class Looks Good

The AnimationItem data class holds the properties for each animation item, including the child, direction, transition state, and animator. The use of default values is appropriate.


306-309: keyedItemsOf Utility Function Looks Good

The keyedItemsOf utility function creates a map of animation items keyed by the child's key. The use of associateBy is appropriate.


315-322: SimpleStackAnimator Class Looks Good

The SimpleStackAnimator class implements the StackAnimator interface and provides a simple way to apply a modifier for animations. The use of a lambda to provide the modifier is appropriate.


324-327: transitionTo Extension Function Looks Good

The transitionTo extension function creates a MutableTransitionState and sets the target state. The use of apply is appropriate.


330-335: isIdle Extension Function Looks Good

The isIdle extension function checks if a TransitionState is idle. The logic is clear and appropriate.


43-94: Ensure Proper Handling of State and Transitions

The invoke method is the main composable function that handles the stack animations. It properly manages the state and transitions of the child stack. However, ensure that all edge cases are handled, especially with the predictiveBackParams.

Verification successful

Proper Handling of predictiveBackParams Verified

The predictiveBackParams is appropriately managed within the DefaultStackAnimation.kt and StackAnimation.kt files. The code ensures proper initialization, usage, and disposal, covering potential edge cases effectively.

  • DefaultStackAnimation.kt: Initialization, usage in composable functions, and disposal via DisposableEffect.
  • StackAnimation.kt: Initialization and passing of parameters.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of predictiveBackParams and ensure edge cases are handled.

# Test: Search for the usage of predictiveBackParams. Expect: Proper handling in all cases.
rg --type kotlin 'predictiveBackParams'

Length of output: 4139


Script:

#!/bin/bash
# Extract relevant code sections around predictiveBackParams in DefaultStackAnimation.kt and StackAnimation.kt

# Extract lines around predictiveBackParams in DefaultStackAnimation.kt
rg --context 5 --type kotlin 'predictiveBackParams' extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/DefaultStackAnimation.kt

# Extract lines around predictiveBackParams in StackAnimation.kt
rg --context 5 --type kotlin 'predictiveBackParams' extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/StackAnimation.kt

Length of output: 5286


200-281: PredictiveBackCallback Inner Class Looks Good

The PredictiveBackCallback inner class handles the predictive back gestures. It properly manages the transition states and animations during back events. Ensure that all edge cases are handled, especially with the animatable property.

Verification successful

PredictiveBackCallback Inner Class Looks Good

The PredictiveBackCallback inner class handles the predictive back gestures effectively. The animatable property is properly managed with null-checks and appropriate cleanup in all relevant methods.

  • onBackStarted: Sets animatable and uses it with null-checks.
  • onBackProgressed: Uses animatable with null-checks.
  • onBackCancelled: Cancels animatable and resets it.
  • onBack: Finishes animatable and resets it.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the handling of animatable property in PredictiveBackCallback.

# Test: Search for the usage of animatable. Expect: Proper handling in all cases.
rg --type kotlin 'animatable'

Length of output: 4485


Script:

#!/bin/bash
# Description: Gather context around the usage of animatable in DefaultStackAnimation.kt.

# Extract lines around the usage of animatable to verify proper handling.
rg --type kotlin --context 5 'animatable' extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/DefaultStackAnimation.kt

Length of output: 3256

extensions-compose-experimental/api/extensions-compose-experimental.klib.api (10)

9-11: StackAnimation Interface Looks Good

The StackAnimation interface defines the invoke method for stack animations. The method signature is clear and appropriate.


13-15: StackAnimator Interface Looks Good

The StackAnimator interface defines the animate method for animating visibility scopes. The method signature is clear and appropriate.


17-19: StackAnimationProvider Interface Looks Good

The StackAnimationProvider interface defines the provide method for providing stack animations. The method signature is clear and appropriate.


21-30: PredictiveBackParams Class Looks Good

The PredictiveBackParams class holds the parameters for predictive back gestures, including the back handler, onBack function, and animatable selector. The constructor and properties are clear and appropriate.


32-33: LocalStackAnimationProvider Property Looks Good

The LocalStackAnimationProvider property provides a composition local for the StackAnimationProvider. The getter method is clear and appropriate.


34-36: Stable Property Constants Look Good

The stable property constants for DefaultStackAnimation, DefaultStackAnimator, and PredictiveBackParams are defined appropriately.


38-49: StackAnimator Extension Functions Look Good

The extension functions for StackAnimator provide additional functionality, including combining animators and creating specific animations like fade, scale, and slide. The method signatures are clear and appropriate.


41-42: ChildStack Extension Functions Look Good

The extension functions for ChildStack provide additional functionality for creating child stacks with animations. The method signatures are clear and appropriate.


43-45: Stable Property Getter Functions Look Good

The stable property getter functions for DefaultStackAnimation, DefaultStackAnimator, and PredictiveBackParams are defined appropriately.


46-49: Animation Creation Functions Look Good

The functions for creating specific animations like fade, scale, slide, and stackAnimator are defined appropriately. The method signatures are clear and appropriate.

@arkivanov arkivanov marked this pull request as ready for review August 7, 2024 09:30
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 5dd51a9 and ffb4859.

Files selected for processing (30)
  • extensions-compose-experimental/.gitignore (1 hunks)
  • extensions-compose-experimental/api/android/extensions-compose-experimental.api (1 hunks)
  • extensions-compose-experimental/api/extensions-compose-experimental.klib.api (1 hunks)
  • extensions-compose-experimental/api/jvm/extensions-compose-experimental.api (1 hunks)
  • extensions-compose-experimental/build.gradle.kts (1 hunks)
  • extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/ChildStack.kt (1 hunks)
  • extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/SimpleAnimatedVisibilityScope.kt (1 hunks)
  • 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 (1 hunks)
  • extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/DefaultStackAnimator.kt (1 hunks)
  • extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/EmptyStackAnimation.kt (1 hunks)
  • extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/Fade.kt (1 hunks)
  • extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/PredictiveBackParams.kt (1 hunks)
  • extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/Scale.kt (1 hunks)
  • extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/Slide.kt (1 hunks)
  • extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/StackAnimation.kt (1 hunks)
  • extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/StackAnimationProvider.kt (1 hunks)
  • extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/StackAnimator.kt (1 hunks)
  • extensions-compose-experimental/src/jvmTest/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/ChildStackTest.kt (1 hunks)
  • extensions-compose-experimental/src/jvmTest/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/GetFadeAlphaTest.kt (1 hunks)
  • extensions-compose-experimental/src/jvmTest/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/StackAnimationDirectionsTest.kt (1 hunks)
  • extensions-compose/build.gradle.kts (1 hunks)
  • extensions-compose/src/jvmTest/kotlin/com/arkivanov/decompose/extensions/compose/stack/animation/StackAnimationDirectionsTest.kt (3 hunks)
  • sample/shared/compose/build.gradle.kts (2 hunks)
  • sample/shared/compose/src/commonMain/kotlin/com/arkivanov/sample/shared/sharedtransitions/SharedTransitionsContent.kt (1 hunks)
  • sample/shared/compose/src/commonMain/kotlin/com/arkivanov/sample/shared/sharedtransitions/gallery/GalleryContent.kt (4 hunks)
  • sample/shared/compose/src/commonMain/kotlin/com/arkivanov/sample/shared/sharedtransitions/photo/PhotoContent.kt (4 hunks)
  • sample/shared/shared/src/commonMain/kotlin/com/arkivanov/sample/shared/sharedtransitions/DefaultSharedTransitionsComponent.kt (1 hunks)
  • sample/shared/shared/src/commonMain/kotlin/com/arkivanov/sample/shared/sharedtransitions/SharedTransitionsComponent.kt (1 hunks)
  • settings.gradle.kts (1 hunks)
Files skipped from review due to trivial changes (3)
  • extensions-compose-experimental/.gitignore
  • extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/Utils.kt
  • settings.gradle.kts
Files skipped from review as they are similar to previous changes (25)
  • extensions-compose-experimental/api/android/extensions-compose-experimental.api
  • extensions-compose-experimental/api/extensions-compose-experimental.klib.api
  • extensions-compose-experimental/api/jvm/extensions-compose-experimental.api
  • extensions-compose-experimental/build.gradle.kts
  • extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/SimpleAnimatedVisibilityScope.kt
  • extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/DefaultStackAnimation.kt
  • extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/DefaultStackAnimator.kt
  • extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/EmptyStackAnimation.kt
  • extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/Fade.kt
  • extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/PredictiveBackParams.kt
  • extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/Scale.kt
  • extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/Slide.kt
  • extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/StackAnimation.kt
  • extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/StackAnimationProvider.kt
  • extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/StackAnimator.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/GetFadeAlphaTest.kt
  • extensions-compose-experimental/src/jvmTest/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/StackAnimationDirectionsTest.kt
  • extensions-compose/build.gradle.kts
  • sample/shared/compose/build.gradle.kts
  • sample/shared/compose/src/commonMain/kotlin/com/arkivanov/sample/shared/sharedtransitions/SharedTransitionsContent.kt
  • sample/shared/compose/src/commonMain/kotlin/com/arkivanov/sample/shared/sharedtransitions/gallery/GalleryContent.kt
  • sample/shared/compose/src/commonMain/kotlin/com/arkivanov/sample/shared/sharedtransitions/photo/PhotoContent.kt
  • sample/shared/shared/src/commonMain/kotlin/com/arkivanov/sample/shared/sharedtransitions/DefaultSharedTransitionsComponent.kt
  • sample/shared/shared/src/commonMain/kotlin/com/arkivanov/sample/shared/sharedtransitions/SharedTransitionsComponent.kt
Additional comments not posted (9)
extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/ChildStack.kt (5)

34-52: Ensure correct usage of AnimatedVisibilityScope.

The function correctly uses AnimatedVisibilityScope to enable additional animations. Ensure that the scope is used appropriately in the content composable function.


68-82: LGTM!

The function correctly subscribes to the state and delegates to the first overload of ChildStack.


84-85: LGTM!

The function correctly retrieves the keys of the child components.


88-101: LGTM!

The function correctly retains the states of the child components and removes states that are no longer in the current keys.


104-106: LGTM!

The class correctly holds a set of keys and is used appropriately in the retainStates function.

extensions-compose/src/jvmTest/kotlin/com/arkivanov/decompose/extensions/compose/stack/animation/StackAnimationDirectionsTest.kt (4)

Line range hint 31-60:
LGTM!

The function correctly initializes the results map, sets up the animation, and asserts the expected results.


Line range hint 62-66:
LGTM!

The function correctly creates a ChildStack with the active child and back stack.


Line range hint 68-71:
LGTM!

The function correctly creates a Child.Created with the given configuration and instance.


80-105: LGTM!

The companion object correctly provides test parameters and the Params class correctly holds the test parameters.

@arkivanov arkivanov merged commit ad03ddf into master Aug 7, 2024
2 checks passed
@arkivanov arkivanov deleted the new-anim-api branch August 7, 2024 11:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consider adding some sort of integration to allow easier use of shared element transitions between screens.
1 participant