fix: remove static on server block check#889
Merged
rahul-mixpanel merged 4 commits intofeature/server-url-in-optionsfrom Jan 28, 2026
Merged
fix: remove static on server block check#889rahul-mixpanel merged 4 commits intofeature/server-url-in-optionsfrom
rahul-mixpanel merged 4 commits intofeature/server-url-in-optionsfrom
Conversation
Contributor
tylerjroach
commented
Jan 27, 2026
- Remove static on server block check
- Test improvements
rahul-mixpanel
requested changes
Jan 27, 2026
Contributor
rahul-mixpanel
left a comment
There was a problem hiding this comment.
requested one change. other than that, LGTM.
| * Sets the mIsServerBlocked field on an HttpService instance using reflection. | ||
| * This allows tests to set a known initial state before testing async behavior. | ||
| */ | ||
| private void setServerBlocked(HttpService service) throws Exception { |
Contributor
There was a problem hiding this comment.
the default for the field "mIsServerBlocked" is false in the current code.
rahul-mixpanel
pushed a commit
that referenced
this pull request
Jan 28, 2026
* Remove static mIsServerBlocked and Remove Thread.sleep from tests * Add nullability annotations to new options * simplify * add annotation
rahul-mixpanel
added a commit
that referenced
this pull request
Jan 28, 2026
* feat: Allow serverURL configuration at initialization This change introduces the ability to set the `serverURL` and `proxyServerInteractor` via `MixpanelOptions` during SDK initialization. Applying the `serverURL` from `MixpanelOptions` at initialization time ensures that the ad-blocker check correctly uses the specified host (e.g., `api-eu.mixpanel.com`) instead of the default. The previous `setServerURL()` methods on `MixpanelAPI` have been deprecated in favor of this new approach. * chore: Centralize default server host constant - Move the default server host URL to `MPConstants`. - Update `AnalyticsMessages` and `HttpService` to use the new constant. * Log error on URL host extraction failure * Remove placeholder test for proxy interactor * fix: Add missing assertion for default flags endpoint in test * feat: Improve log message for URL host extraction failure * feat: Un-deprecate setServerURL methods This change removes the deprecation from the `setServerURL` methods, allowing for the server URL to be configured at runtime again. * refactor: Remove redundant HttpService constructor * feat: Consolidate proxy server configuration API Refactored the `MixpanelOptions.Builder` API for setting a custom server URL and proxy interactor. The separate `proxyServerInteractor()` method has been removed and replaced with a new overloaded `serverURL(String, ProxyServerInteractor)` method. This change makes the API more intuitive by coupling the proxy interactor directly with the server URL it's intended for. Additionally, Javadocs for server URL configuration have been enhanced with clearer explanations and code examples for routing data to regional servers or a custom proxy. * feat: Enhance ad-blocker check to consider backup host The ad-blocker detection logic in `checkIsMixpanelBlocked` has been updated to also check the configured backup host. The SDK will now only be considered blocked if both the primary and backup hosts are inaccessible. If the primary host is blocked but the backup is available, the SDK will continue to function. * feat: Add tests for ad blocker detection Add unit tests for the `checkIsMixpanelBlocked` method to verify the logic for detecting when Mixpanel hosts are blocked and correctly handling primary/backup host configurations. * refactor: Generalize ad blocker check for any server host Renamed `checkIsMixpanelBlocked` to `checkIsServerBlocked` and related variables to reflect that the functionality checks for any blocked server host, not just Mixpanel-specific ones. This makes the ad blocker detection logic more generic. * fix: Update Javadoc example and add logging for server check failure * fix: remove static on server block check (#889) * Remove static mIsServerBlocked and Remove Thread.sleep from tests * Add nullability annotations to new options * simplify * add annotation --------- Co-authored-by: Tyler Roach <tylerjroach@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.