chore(example): showcase optional Customer.io inclusion via CIO_ENABLED flag#597
Draft
mahmoud-elmorabea wants to merge 3 commits into
Draft
chore(example): showcase optional Customer.io inclusion via CIO_ENABLED flag#597mahmoud-elmorabea wants to merge 3 commits into
mahmoud-elmorabea wants to merge 3 commits into
Conversation
…ld flag Demonstrates how a host that ships separate per-customer builds can include Customer.io for some builds and fully exclude it for others — no compiled CIO code, none of the SDK's JS bundled, and zero runtime footprint — all driven by one build-time flag, CIO_ENABLED. The sample app now imports CIO only through a `@cio` facade, never from 'customerio-reactnative' directly: - JS: metro.config.js resolveRequest swaps `@cio` between src/cio/index.real.ts and src/cio/index.noop.ts on CIO_ENABLED; tsconfig maps `@cio` -> real for types. The noop redefines enums and stubs the API surface without importing the package, so the SDK's getEnforcing TurboModules are never evaluated. - Native: react-native.config.js disables autolinking on both platforms when off; the Podfile skips the customerio-reactnative + rich-push pods; and AppDelegate.swift guards the CIO app-delegate wrapper and push init behind `#if canImport(CioMessagingPush…)` so they compile out when the pods are absent. All four levers read the same flag, so the JS and native layers can never disagree (native-off + JS-real would crash via getEnforcing at launch). Verified locally for both flag states: tsc clean; Metro bundle swaps real/noop (disabled bundle has no CIO getEnforcing and excludes the SDK code); `react-native config` links/excludes CIO on both platforms; and full Android assembleDebug builds succeed both ways (PackageList.java registers CustomerIOReactNativePackage only when enabled; disabled APK is ~3.5 MB smaller). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
Sample app builds 📱Below you will find the list of the latest versions of the sample apps. It's recommended to always download the latest builds of the sample apps to accurately test the pull request.
|
…abled path Showcase-only: forces CI sample-app builds to exclude Customer.io so the off path is exercised in CI. Not for merge — normal builds leave the flag unset (defaults to enabled). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…r the off path The NSE source imported CioMessagingPushFCM/APN unconditionally, so with CIO_ENABLED=0 (rich-push pod excluded) the extension failed to compile. Guard the CIO push code with #if canImport(...) — same approach as AppDelegate.swift — and fall back to delivering the notification unmodified when Customer.io is excluded, so the NSE is coherent in both flag states. Co-Authored-By: Claude Opus 4.8 (1M context) <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.
Sample-app showcase for making Customer.io an optional, build-time dependency.
A host that ships separate builds per customer can flip a single flag to include the full SDK in some builds and completely exclude it from others — leaving no compiled code, no bundled JS, and zero runtime footprint when off — without changing application code between builds.