-
Notifications
You must be signed in to change notification settings - Fork 42
SDK-290 Add Expo Config Plugin and Fix Static Linkage Swift Header Import #813
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
|
Coverage Impact This PR will not change total coverage. 🚦 See full report on Qlty Cloud »🛟 Help
|
❌ 9 blocking issues (13 total)
|
| * This plugin handles the complex iOS build configuration required for | ||
| * Iterable SDK integration with Expo managed workflows: | ||
| * | ||
| * 1. Disables iOS autolinking for @iterable/react-native-sdk to prevent |
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.
tsdoc-characters-after-block-tag: The token "@Iterable" looks like a TSDoc tag but contains an invalid character "/"; if it is not a tag, use a backslash to escape the "@" [eslint:tsdoc/syntax]
| import { IterablePluginProps } from './index'; | ||
|
|
||
| /** | ||
| * Disables iOS autolinking for @iterable/react-native-sdk. |
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.
tsdoc-characters-after-block-tag: The token "@Iterable" looks like a TSDoc tag but contains an invalid character "/"; if it is not a tag, use a backslash to escape the "@" [eslint:tsdoc/syntax]
| }; | ||
|
|
||
| /** | ||
| * Modifies the Expo config to exclude @iterable/react-native-sdk from |
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.
tsdoc-characters-after-block-tag: The token "@Iterable" looks like a TSDoc tag but contains an invalid character "/"; if it is not a tag, use a backslash to escape the "@" [eslint:tsdoc/syntax]
| * | ||
| * Note: autolinking is not in the base ExpoConfig type but is supported at runtime. | ||
| */ | ||
| // eslint-disable-next-line @typescript-eslint/no-explicit-any |
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.
| // eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
| export function disableAutolinking<T>(config: T): T { | ||
| // Cast to any for dynamic property access (autolinking not in ExpoConfig types) | ||
| const cfg = config as any; |
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.
| export const withIterablePodfile: ConfigPlugin<IterablePluginProps> = (config, props) => { | ||
| return withDangerousMod(config, [ | ||
| 'ios', | ||
| async (config) => { |
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.
| fs.writeFileSync(podfilePath, contents); | ||
| return config; | ||
| }, | ||
| ]); |
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.
| }; | ||
|
|
||
| /** | ||
| * Ensures the Podfile has use_frameworks! :linkage => :static. |
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.
| return contents.replace(/use_frameworks!\s*(?!\s*:linkage)/, 'use_frameworks! :linkage => :static'); | ||
| } | ||
|
|
||
| return contents; |
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.
| throw new Error( | ||
| 'Could not find a suitable location to inject Iterable pods. ' + | ||
| 'Please ensure your Podfile has a valid target block.' | ||
| ); |
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.
| return contents; | ||
| } | ||
|
|
||
| const iterablePods = ` |
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.
This is actually adding dynamic linkage to the pods, so it's not actually testing it with static pod linkages.

🔹 JIRA Ticket(s) if any
✏️ Description
Problem
Integrating the Iterable React Native SDK in Expo managed workflows requires complex manual configuration:
This leads to recurring build failures:
'Iterable_React_Native_SDK-Swift.h' file not foundSolution
1. Expo Config Plugin
New plugin at
plugin/src/that automates iOS build configuration duringexpo prebuild:Autolinking Exclusion (
withIterableAutolinking.ts):@iterable/react-native-sdkfrom iOS autolinking to prevent duplicate entriesPodfile Transformation (
withIterablePodfile.ts):use_frameworks! :linkage => :staticis set (Expo requirement):linkage => :dynamicoverrideIterableNotificationstarget for push extensionsUsage:
{ "expo": { "plugins": [ ["@iterable/react-native-sdk", { "enableNotificationExtension": true }] ] } }2. Swift Header Import Fix
Updated
RNIterableAPI.mmto use conditional import for static framework builds:3. Podspec Updates
Added to
Iterable-React-Native-SDK.podspec:SWIFT_OBJC_INTERFACE_HEADER_NAMEsettingHEADER_SEARCH_PATHSfor generated Swift header locationFiles Changed
plugin/src/index.tsplugin/src/withIterableAutolinking.tsplugin/src/withIterablePodfile.tsplugin/__tests__/plugin.test.tsios/RNIterableAPI/RNIterableAPI.mmIterable-React-Native-SDK.podspecpackage.jsonTesting
yarn build- SDK and plugin compile successfullyyarn test:plugin- All plugin tests passyarn ios- No Swift header errorsnpx expo prebuild- Correct Podfile outputDependencies
iterable-swift-sdkversion 6.6.5+ with C linkage header fixes