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

Add generalized Lottie Feature Flags API #2512

Merged
merged 13 commits into from
Jul 3, 2024
Merged

Conversation

jbeta51
Copy link
Contributor

@jbeta51 jbeta51 commented Jun 17, 2024

Currently there are individual methods for enabling and disabling Merge Paths in Lottie. This PR aims to generalize these functions as we consider adding more features guarded behind opt-in flags.

See jbeta51#2 for draft comments.

Copy link
Collaborator

@gpeal gpeal left a comment

Choose a reason for hiding this comment

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

Thanks for getting started with this!

Copy link

Snapshot Tests
API 23: Report Diff
API 31: Report Diff

Copy link

Snapshot Tests
API 23: Report Diff
API 31: Report Diff

Copy link

Snapshot Tests
API 23: Report Diff
API 31: Report Diff

return lottieDrawable.isFeatureFlagEnabled(LottieFeatureFlags.FeatureFlag.MergePathsApi19);
}

public void enableFeatureFlag(LottieFeatureFlags.FeatureFlag flag, boolean enable) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you add docs here since this is a new public API?

I would make it extra explicit that people validate that opted in features look acceptable across all supported API levels.


import java.util.HashSet;

public class LottieFeatureFlags {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's move LottieFeatureFlags to a package that's package-private so we don't expose this class in the public API and make FeatureFlag a top-level public enum LottieFeatureFlag

Copy link

Snapshot Tests
API 23: Report Diff
API 31: Report Diff

Copy link
Collaborator

@gpeal gpeal left a comment

Choose a reason for hiding this comment

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

Looks good! Would you like to add this API to lottie-compose as well or would you like me to?

Copy link

github-actions bot commented Jul 2, 2024

Snapshot Tests
API 23: Report Diff
API 31: Report Diff

@jbeta51
Copy link
Contributor Author

jbeta51 commented Jul 3, 2024

Looks good! Would you like to add this API to lottie-compose as well or would you like me to?

I could add it, but I also thought that was covered by adding it to LottiePainter.kt and LottieAnimation.kt, so I'd need to be pointed in the right direction. We can followup later or in another PR.

@gpeal gpeal merged commit c4cb225 into airbnb:master Jul 3, 2024
7 checks passed
@gpeal
Copy link
Collaborator

gpeal commented Jul 3, 2024

Looks good! Would you like to add this API to lottie-compose as well or would you like me to?

I could add it, but I also thought that was covered by adding it to LottiePainter.kt and LottieAnimation.kt, so I'd need to be pointed in the right direction. We can followup later or in another PR.

I'll add support for Compose in a bit
#2515

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.

2 participants