[SDK-484] Remove legacy code#868
Conversation
|
Coverage Impact ⬆️ Merging this pull request will increase total coverage on Modified Files with Diff Coverage (5)
🤖 Increase coverage with AI coding...🚦 See full report on Qlty Cloud » 🛟 Help
|
6 new issues
|
| campaignId: Number(campaignId), | ||
| templateId: Number(templateId), | ||
| messageId: String(messageId), | ||
| }; |
There was a problem hiding this comment.
Pull request overview
This PR removes Legacy Architecture support across the React Native SDK, standardizing on the New Architecture (TurboModules) and updating JS/native boundaries, tests, and documentation accordingly.
Changes:
- Remove legacy/native-module fallbacks and old-arch Android/iOS implementations; require TurboModules.
- Introduce bridge-casting helpers and expand attribution info normalization/serialization for native calls.
- Update Jest setup/mocks and adjust tests + docs/changelog to reflect the breaking change.
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/core/classes/IterableAttributionInfo.ts | Adds bridge serialization/coercion helpers for attribution info. |
| src/core/classes/IterableApi.ts | Routes calls through TurboModule-friendly shapes/casts; updates attribution and bridge payload handling. |
| src/core/classes/IterableApi.test.ts | Adds/updates tests for attribution bridge coercion + serialization expectations. |
| src/core/classes/Iterable.ts | Aligns public API attribution methods with the updated IterableApi layer. |
| src/api/NativeRNIterableAPI.ts | Removes test-environment bypass; always enforces TurboModule presence. |
| src/api/index.ts | Drops NativeModules fallback; exports a typed TurboModule instance. |
| src/api/bridge.ts | Adds shared “bridge record” cast helpers for TurboModule calls. |
| src/mocks/jest.setup.ts | Switches to mocking the SDK’s src/api module instead of NativeModules.RNIterableAPI. |
| README.md | Updates architecture support section to require New Architecture. |
| package.json | Updates library template type to module (non-legacy). |
| ios/RNIterableAPI/RNIterableAPI.mm | Removes legacy bridge module exports; keeps TurboModule implementation unconditionally. |
| ios/RNIterableAPI/RNIterableAPI.h | Removes legacy interface conditional; always conforms to NativeRNIterableAPISpec. |
| example/src/NativeJwtTokenModule.ts | Removes old-arch NativeModules fallback; uses TurboModuleRegistry only. |
| CHANGELOG.md | Adds 3.0.0 breaking-change note for legacy architecture removal. |
| android/src/oldarch/java/com/RNIterableAPIModule.java | Deletes old architecture module implementation. |
| android/src/main/java/com/iterable/reactnative/RNIterableAPIPackage.java | Marks module as TurboModule unconditionally. |
| android/src/main/java/com/iterable/reactnative/RNIterableAPIModule.java | Cleans imports; continues TurboModule-based module class. |
| android/build.gradle | Always applies React plugin; removes old/new arch source set switching and related BuildConfig flag. |
Comments suppressed due to low confidence (4)
src/core/classes/IterableApi.ts:218
trackPushOpenWithCampaignIdis being invoked via a type-cast that allowsmessageIdto benull | undefined, but both the TurboModule spec (src/api/NativeRNIterableAPI.ts) and the native implementations require a non-nullstringmessageId. Passingnull/undefinedhere is likely to cause a TurboModule argument validation error or a native crash. Align the JS signature with native (requiremessageId: string), or explicitly handle the nullable case before calling into the native module (and update the native spec/implementations if null must be supported).
return (RNIterableAPI.trackPushOpenWithCampaignId as (
campaignId: number,
templateId: number,
messageId: string | null | undefined,
appAlreadyRunning: boolean,
src/core/classes/IterableApi.ts:382
passAlongAuthTokenis typed/implemented as returning aPromise<IterableAuthResponse | string | undefined>, but the TurboModule spec and native implementations arevoid(they signal auth via events). As written, this will always resolveundefinedin production, which is a misleading public API and can hide integration bugs. Either update the native method to actually return a promise, or change this wrapper (andIterableAuthManager) to returnvoid/Promise<void>and remove the runtime "then" detection.
static passAlongAuthToken(
authToken: string | null | undefined
): Promise<IterableAuthResponse | string | undefined> {
IterableLogger.log('passAlongAuthToken: ', authToken);
const result = RNIterableAPI.passAlongAuthToken(authToken) as unknown;
src/core/classes/IterableApi.ts:504
getHtmlInAppContentForMessageis returning the native payload with a double-cast toPromise<IterableHtmlInAppContent>, but the TurboModule spec returns a plain object and other call sites (e.g. inbox data model) treat it as a raw dictionary to be parsed viaIterableHtmlInAppContent.fromDict. This cast makes the method’s return type inaccurate and can introduce type errors understrict. Prefer either: (1) parse here and return a realIterableHtmlInAppContentinstance, or (2) change the return type to the raw bridge type and let callers parse.
static getHtmlInAppContentForMessage(
messageId: string
): Promise<IterableHtmlInAppContent> {
IterableLogger.log('getHtmlInAppContentForMessage: ', messageId);
return RNIterableAPI.getHtmlInAppContentForMessage(messageId) as unknown as Promise<IterableHtmlInAppContent>;
src/core/classes/IterableApi.ts:602
getEmbeddedMessagescastsplacementIdsfromnumber[] | nulltonumber[]and forwards it to the TurboModule. Ifnullis passed at runtime, this defeats the non-nullable TurboModule signature and may fail argument validation. Since the native implementations treatnil/nullor an empty list as “all placements”, normalize here (e.g. convertnullto[]) instead of casting.
): Promise<IterableEmbeddedMessage[]> {
IterableLogger.log('getEmbeddedMessages: ', placementIds);
return RNIterableAPI.getEmbeddedMessages(
placementIds as number[]
) as Promise<IterableEmbeddedMessage[]>;
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| return (RNIterableAPI.updateEmail as ( | ||
| email: string, | ||
| authToken?: string | null | ||
| ) => void)(email, authToken); |

🔹 JIRA Ticket(s) if any
✏️ Description