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

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

jbeta51
Copy link

@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.

}

/**
* Enable this to get merge path support for devices running KitKat (19) and above.
* Deprecated: Use enableFeatureFlag(LottieFeatureFlags.FeatureFlag.MergePathsApi19, enable)
Copy link
Collaborator

Choose a reason for hiding this comment

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

You can use @deprecated and @link for proper javadoc syntax.


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

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.

None yet

2 participants