fix(plugin): wrap setCustomClientBuilder in BuildConfig.DEBUG guard#21
Merged
Conversation
…ctivation NETWORK_TOOLS_ENABLED was hardcoded to true in defaultConfig, meaning the OkHttp interceptor was added to the client in every build variant including release. Two-part fix: 1. android/build.gradle: move the flag out of defaultConfig and set it explicitly per buildType (true for debug, false for release). 2. example MainApplication.kt: wrap setCustomClientBuilder in a BuildConfig.DEBUG guard as a second line of defence, and to make the debug-only intent explicit. README and SETUP_GUIDE updated to show the BuildConfig.DEBUG guard pattern that consumers must apply in their own MainApplication. Closes #14 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The Expo config plugin was patching MainApplication unconditionally,
causing setCustomClientBuilder to run in every EAS build profile
including production.
Both KOTLIN_SNIPPET and JAVA_SNIPPET now wrap the interceptor setup in
if (BuildConfig.DEBUG) { ... }, matching the guard pattern required in
bare RN apps (see #14).
Tests expanded from 2 to 8: guard presence, guard ordering (addInterceptor
must appear after the if), idempotency, and null return when onCreate
pattern is absent — for both Kotlin and Java.
Closes #15
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.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.
Summary
KOTLIN_SNIPPETandJAVA_SNIPPETinplugin/src/index.jsnow wrap thesetCustomClientBuildercall inif (BuildConfig.DEBUG) { ... }NetworkToolsManager.addInterceptor(builder), which remains present inside the guardBefore vs after (Kotlin)
Before — interceptor registered unconditionally in every build:
After — interceptor only registered in debug builds:
Test plan
yarn jest plugin/src/index.test.js— all 8 tests passexpo prebuildon a fresh Expo app → verify generatedMainApplication.ktcontainsif (BuildConfig.DEBUG)eas build --profile production→ verify interceptor not activeRelated
Depends on #14 (library
build.gradlefix) which must be merged first soBuildConfig.DEBUGis reliable.Closes #15
🤖 Generated with Claude Code