-
Notifications
You must be signed in to change notification settings - Fork 367
Initial Feature Flags Support #859
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
base: master
Are you sure you want to change the base?
Conversation
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.
Pull Request Overview
This PR introduces initial support for feature flags in the Mixpanel Android SDK along with several API enhancements and configuration updates.
- Adds new parameters and method documentation in RemoteService and HttpService for handling feature flags and raw request bodies.
- Introduces feature flag parsing in JsonUtils, new configuration classes (FlagsConfig, FeatureFlagData), and integrates feature flag management in MixpanelAPI and MPConfig.
- Updates tests and demo code to work with the new flags functionality.
Reviewed Changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
src/main/java/com/mixpanel/android/util/RemoteService.java | Updated performRequest method with extended parameters and added detailed Javadoc. |
src/main/java/com/mixpanel/android/util/MPConstants.java | Added FLAG endpoint constant for feature flags. |
src/main/java/com/mixpanel/android/util/JsonUtils.java | Enhanced JSON parsing for feature flags responses. |
src/main/java/com/mixpanel/android/util/HttpService.java | Revised HTTP request handling to support both URL-encoded and raw request body with custom headers. |
src/main/java/com/mixpanel/android/mpmetrics/MixpanelOptions.java | Integrated feature flag options in MixpanelOptions builder. |
src/main/java/com/mixpanel/android/mpmetrics/MixpanelAPI.java | Integrated the feature flag manager and added feature flag API methods. |
src/main/java/com/mixpanel/android/mpmetrics/MPConfig.java | Added support for flags endpoint configuration. |
src/main/java/com/mixpanel/android/mpmetrics/FlagsConfig.java | New configuration class for feature flags. |
src/main/java/com/mixpanel/android/mpmetrics/FeatureFlagData.java | Added data class for representing feature flag data. |
Other test and demo files | Updated to work with changes in HTTP and feature flag API methods. |
Comments suppressed due to low confidence (1)
src/main/java/com/mixpanel/android/mpmetrics/FeatureFlagData.java:18
- In the fallback constructor, 'this.value' is mistakenly set to 'key' instead of null. Consider changing it to 'this.value = null;' to correctly reflect a missing value.
public FeatureFlagData(@NonNull String key) { this.key = key; this.value = key; // Defaulting value to null if not provided }
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.
Pull Request Overview
This PR introduces initial support for feature flags into the Mixpanel Android SDK along with a new options builder and configuration settings. Key changes include:
- Enhancements to HTTP request handling in RemoteService and HttpService (support for headers and raw body).
- Additions for feature flags handling via new APIs, configurations, and associated models (MixpanelOptions, MPConfig, FlagsConfig, FeatureFlagData, FlagCompletionCallback).
- Updates to tests and demo code to support the new feature flags interfaces and a minor Gradle wrapper upgrade.
Reviewed Changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
src/main/java/com/mixpanel/android/util/RemoteService.java | Updated performRequest API with additional parameters and documentation. |
src/main/java/com/mixpanel/android/util/MPConstants.java | Added endpoints and key constants for feature flags. |
src/main/java/com/mixpanel/android/util/JsonUtils.java | Added helper method for parsing feature flags JSON response. |
src/main/java/com/mixpanel/android/util/HttpService.java | Updated performRequest signature and improved error handling with additional logging. |
src/main/java/com/mixpanel/android/mpmetrics/MixpanelOptions.java | Introduced new options for toggling feature flags support and context. |
src/main/java/com/mixpanel/android/mpmetrics/MixpanelAPI.java | Integrated feature flags load and access methods into the API. |
src/main/java/com/mixpanel/android/mpmetrics/MPConfig.java | Added support for configuring flags endpoint. |
src/main/java/com/mixpanel/android/mpmetrics/FlagsConfig.java | Added a configuration class for feature flags. |
src/main/java/com/mixpanel/android/mpmetrics/FeatureFlagData.java | Added model class representing feature flag data. |
Other test and demo files | Updated mocks and demo interactions to use the new performRequest signature and feature flag APIs. |
gradle/wrapper/gradle-wrapper.properties | Updated Gradle wrapper version for compatibility. |
src/main/java/com/mixpanel/android/mpmetrics/FeatureFlagData.java
Outdated
Show resolved
Hide resolved
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.
Pull Request Overview
This pull request implements initial support for feature flags in the Mixpanel Android SDK and updates various network and configuration components accordingly. Key changes include:
- Extending network operations with additional parameters (e.g. headers and raw body support) and updated documentation.
- Adding new classes and interfaces for feature flag management (FeatureFlagData, Flags, FlagCompletionCallback) along with relevant API methods.
- Updating configuration (MPConfig) and sample/test code to integrate feature flag support and endpoint settings.
Reviewed Changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
src/main/java/com/mixpanel/android/util/RemoteService.java | Updated interface with expanded performRequest signature and thorough Javadoc documentation. |
src/main/java/com/mixpanel/android/util/HttpService.java | Refactored performRequest with additional parameters and enhanced error reporting and resource cleanup. |
src/main/java/com/mixpanel/android/mpmetrics/MixpanelAPI.java | Adjusted instantiation and API overloads to pass MixpanelOptions for feature flags. |
src/main/java/com/mixpanel/android/mpmetrics/MPConfig.java | Added settings for FlagsEndpoint and updated endpoint URLs accordingly. |
Other files (tests, demo, utility classes) | Updated to use the new API signature and integrate feature flags throughout the codebase. |
This PR adds initial support for using Mixpanel Feature Flags to the Android SDK. As part of this work we introduce the
MixpanelOptions
object to encapsulate all optional initialization parameters, i.e.instanceName
,optOutTrackingDefault
,superProperties
,featureFlagsEnabled
andfeatureFlagsContext
... in order to avoid further constructor andgetInstance
signature proliferation. All of the existing signatures will be supported for backwards compatibility by ultimately building aMixpanelOptions
object to be passed into the new canonical/designated constructor which expects aMixpanelOptions
instance.Example usage (in Kotlin, note that Kotlin automatically converts Java getters like
getFlags()
into properties likeflags
):