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

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

⬇️ Merging this pull request will decrease total coverage on loren/embedded/SDK-231-ios-add-click-handling-and-track by 0.18%.

🚦 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

1 new issue

Tool Category Rule Count
qlty Structure Function with high complexity (count = 6): Embedded 1

@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.
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.

2 participants