Skip to content

Conversation

@lposen
Copy link
Contributor

@lposen lposen commented Jan 12, 2026

🔹 JIRA Ticket(s) if any

✏️ Description

  • remove getPlacementsById call
  • clean up the example app

Testing

  • Run the setup
  • Login and then click on the "Embedded" tab
  • The "Get placements" button should no longer be there.
  • You should only be able to get messages if placements are added to the input

Setup

  • cd into root and run yarn install
  • cd into example and run yarn install
  • cd into ios and run bundle exec pod install
  • open two separate terminals.
  • In Terminal 1
    • run watchman watch-del-all
    • run yarn start --reset-cache
  • In Terminal 2
    • cd into ios
    • run open ReactNativeSdkExample.xcworkspace
    • Once Xcode opens the project, choose an emulator then click the play button to run it.

@github-actions
Copy link

github-actions bot commented Jan 12, 2026

Lines Statements Branches Functions
Coverage: 62%
62.54% (389/622) 38.64% (97/251) 61.16% (137/224)

@qltysh
Copy link

qltysh bot commented Jan 12, 2026

Qlty

Coverage Impact

Unable to calculate total coverage change because base branch coverage was not found.

🚦 See full report on Qlty Cloud »

🛟 Help
  • Diff Coverage: Coverage for added or modified lines of code (excludes deleted files). Learn more.

  • Total Coverage: Coverage for the whole repository, calculated as the sum of all File Coverage. Learn more.

  • File Coverage: Covered Lines divided by Covered Lines plus Missed Lines. (Excludes non-executable lines including blank lines and comments.)

    • Indirect Changes: Changes to File Coverage for files that were not modified in this PR. Learn more.

@qltysh
Copy link

qltysh bot commented Jan 12, 2026

All good ✅

@lposen lposen requested a review from Copilot January 12, 2026 20:03
@lposen lposen added the embedded Issues/PRs related to Embedded Messages label Jan 12, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR removes the getPlacementIds (Android-only) functionality from the embedded messaging API to align iOS and Android behavior, and updates the example app to use a text input for placement IDs instead.

Changes:

  • Removed getPlacementIds method from TypeScript SDK and all Android native implementations
  • Updated example app to allow users to manually enter comma-separated placement IDs via text input
  • Added warning UI in example app when embedded messaging is disabled
  • Modified MainActivity.kt to set Iterable context and handle savedInstanceState differently

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/embedded/classes/IterableEmbeddedManager.ts Removed getPlacementIds method from the embedded manager class
src/embedded/classes/IterableEmbeddedManager.test.ts Removed test coverage for the removed getPlacementIds method
src/core/classes/IterableApi.ts Removed static getEmbeddedPlacementIds method
src/api/NativeRNIterableAPI.ts Removed getEmbeddedPlacementIds from the TurboModule interface
src/mocks/MockRNIterableAPI.ts Removed mock implementation of getEmbeddedPlacementIds
example/src/hooks/useIterableApp.tsx Removed duplicate enableEmbeddedMessaging configuration line
example/src/components/Embedded/Embedded.tsx Replaced automatic placement ID fetching with manual text input and added warning banner
example/src/components/Embedded/Embedded.styles.ts Added styles for text input, disabled state, and warning banner
example/android/app/src/main/java/iterable/reactnativesdk/example/MainActivity.kt Added IterableApi.setContext call and modified onCreate to pass null to super
android/src/oldarch/java/com/RNIterableAPIModule.java Removed getEmbeddedPlacementIds React method from old architecture module
android/src/newarch/java/com/RNIterableAPIModule.java Removed getEmbeddedPlacementIds React method from new architecture module
android/src/main/java/com/iterable/reactnative/RNIterableAPIModuleImpl.java Removed implementation of getEmbeddedPlacementIds

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +19 to +24
const parsedPlacementIds = placementIdsInput
.split(',')
.map((id) => id.trim())
.filter((id) => id !== '')
.map((id) => parseInt(id, 10))
.filter((id) => !isNaN(id));
Copy link

Copilot AI Jan 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The parsedPlacementIds array is recalculated on every render because it's not memoized. This could cause unnecessary re-renders and performance issues. Consider wrapping the parsing logic in useMemo to ensure it only recalculates when placementIdsInput changes.

Copilot uses AI. Check for mistakes.
Comment on lines +32 to 33
// Call super.onCreate with null to prevent savedInstanceState restoration issues
super.onCreate(null)
Copy link

Copilot AI Jan 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Passing null to super.onCreate instead of savedInstanceState prevents the restoration of the activity's saved state. This could affect the app's ability to restore its state after configuration changes (like screen rotation) or when the app is killed and restored by the system. While this is example code, it sets a poor pattern for developers who might copy this implementation. If this is necessary for the Iterable SDK to work correctly, it should be documented in the SDK's integration guide with an explanation of why it's needed and what trade-offs it entails.

Copilot uses AI. Check for mistakes.
…' into loren/embedded/SDK-303-make-the-embedded-functionality-for-ios-and-andrio
Comment on lines -722 to -738
public void getEmbeddedPlacementIds(Promise promise) {
IterableLogger.d(TAG, "getEmbeddedPlacementIds");
try {
List<Long> placementIds = IterableApi.getInstance().getEmbeddedManager().getPlacementIds();
WritableArray writableArray = Arguments.createArray();
if (placementIds != null) {
for (Long placementId : placementIds) {
writableArray.pushDouble(placementId.doubleValue());
}
}
promise.resolve(writableArray);
} catch (Exception e) {
IterableLogger.e(TAG, "Error getting placement IDs: " + e.getLocalizedMessage());
promise.reject("", "Failed to get placement IDs: " + e.getLocalizedMessage());
}
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we not intending to expose placementID list for TS layer?

Is it just array thats readily available that doesnt need to hop through the bridge?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There isn't an equivalent in iOS, so we can't. I had to take it out of the RN fns because of this.

Copy link
Member

@joaodordio joaodordio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree with Akshay comment but otherwise, LGTM

Base automatically changed from loren/embedded/SDK-231-ios-add-click-handling-and-track to loren/embedded/master January 15, 2026 22:04
@lposen lposen merged commit e64a452 into loren/embedded/master Jan 15, 2026
7 of 8 checks passed
@lposen lposen deleted the loren/embedded/SDK-303-make-the-embedded-functionality-for-ios-and-andrio branch January 15, 2026 22:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

embedded Issues/PRs related to Embedded Messages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants