Skip to content

Conversation

@lposen
Copy link
Contributor

@lposen lposen commented Nov 19, 2025

🔹 JIRA Ticket(s) if any

✏️ Description

Adds the ability to start and pause an impression

Testing

  1. cd into the example dir and run:
    yarn install
    watchman watch-del-all
    yarn start --reset-cache
  2. In a separate terminal, cd into example then either run yarn android
  3. Click on the "Embedded" tab.
  4. Click "Get messages"
  5. Open logcat
  6. On any message, click "Start Impression"
  7. In logcat you should see: 💚 startEmbeddedImpression
  8. On any message, click "Pause Impression"
  9. In logcat you should see: 💚 pauseEmbeddedImpression

@lposen lposen requested a review from Copilot November 19, 2025 07:12
@qltysh
Copy link

qltysh bot commented Nov 19, 2025

1 new issue

Tool Category Rule Count
qlty Structure High total complexity (count = 65) 1

This is from Qlty Cloud, the successor to Code Climate Quality. Learn more.

@github-actions
Copy link

github-actions bot commented Nov 19, 2025

Lines Statements Branches Functions
Coverage: 60%
60.27% (355/589) 33.18% (76/229) 59.72% (132/221)

@qltysh
Copy link

qltysh bot commented Nov 19, 2025

Diff Coverage: The code coverage on the diff in this pull request is 100.0%.

Total Coverage: This PR will increase coverage by 0.42%.

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

This is from Qlty Cloud, the successor to Code Climate Quality. Learn more.

@lposen lposen marked this pull request as ready for review November 19, 2025 07:16
Copilot finished reviewing on behalf of lposen November 19, 2025 07:17
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 pull request adds enhanced embedded messaging functionality to the React Native SDK, specifically adding the pauseEmbeddedImpression method and exposing embedded message types to enable developers to manage embedded message impressions more effectively. The changes introduce new TypeScript type definitions for embedded messages and their components, implement impression tracking methods across the TypeScript and Android layers, and update the example app to demonstrate the new functionality.

Key Changes

  • Added pauseEmbeddedImpression and startEmbeddedImpression methods to track when embedded messages are visible or hidden
  • Exposed IterableEmbeddedMessage and related types to the public API for type-safe embedded message handling
  • Added syncMessages and getMessages methods to the IterableEmbeddedManager for retrieving embedded messages

Reviewed Changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
src/index.tsx Exports IterableEmbeddedMessage type for external use
src/embedded/types/*.ts Defines TypeScript interfaces for embedded messages, metadata, elements, buttons, and text
src/embedded/index.ts Exports embedded types alongside classes
src/embedded/classes/IterableEmbeddedManager.ts Adds syncMessages, getMessages, startImpression, and pauseImpression methods with documentation
src/core/classes/IterableApi.ts Implements static methods that bridge to native layer for embedded messaging operations
src/api/NativeRNIterableAPI.ts Defines TypeScript bridge interface and native module method signatures
android/src/oldarch/java/com/RNIterableAPIModule.java Adds ReactMethod bindings for old architecture Android implementation
android/src/newarch/java/com/RNIterableAPIModule.java Adds ReactMethod bindings for new architecture Android implementation
android/src/main/java/com/iterable/reactnative/Serialization.java Adds serialization support for embedded messages
android/src/main/java/com/iterable/reactnative/RNIterableAPIModuleImpl.java Implements core Android logic for embedded message operations including sync, retrieval, and impression tracking
example/src/components/Embedded/Embedded.tsx Demonstrates new embedded messaging features with UI controls and message display
example/src/components/Embedded/Embedded.styles.ts Adds styling for embedded message UI components
example/src/constants/styles/typography.ts Adds link text style for interactive elements

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

Comment on lines 700 to 707
} else {
// Convert ReadableArray to individual placement IDs and get messages for each
for (int i = 0; i < placementIds.size(); i++) {
long placementId = placementIds.getInt(i);
List<IterableEmbeddedMessage> messages = IterableApi.getInstance().getEmbeddedManager().getMessages(placementId);
if (messages != null) {
allMessages.addAll(messages);
}
Copy link

Copilot AI Nov 19, 2025

Choose a reason for hiding this comment

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

The implementation for handling null/empty placementIds is unclear. Using 0 as a default placement ID may not be the correct behavior. Consider either:

  1. Getting messages from all registered placements by iterating through them
  2. Throwing an error if no placement IDs are provided
  3. Documenting that 0 is a valid default placeholder in the comment

The current comment mentions "This might need to be adjusted based on the actual SDK behavior" which suggests this is uncertain logic that should be resolved.

Copilot uses AI. Check for mistakes.
Comment on lines +57 to +58
// TODO: check if this should be changed to a number, as per the type
Number(message.metadata.placementId)
Copy link

Copilot AI Nov 19, 2025

Choose a reason for hiding this comment

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

The TODO comment and Number() conversion are unnecessary. The placementId field is already typed as number in IterableEmbeddedMessageMetadata, so it can be passed directly to startImpression() which expects a number.

Suggested change
// TODO: check if this should be changed to a number, as per the type
Number(message.metadata.placementId)
message.metadata.placementId

Copilot uses AI. Check for mistakes.
Comment on lines 18 to 24
action: { type: string; data?: string } | null;
}[]
| null;
body?: string | null;
mediaUrl?: string | null;
mediaUrlCaption?: string | null;
defaultAction?: { type: string; data?: string } | null;
Copy link

Copilot AI Nov 19, 2025

Choose a reason for hiding this comment

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

The action type in the EmbeddedMessage interface is missing the userInput field that exists in the IterableAction class. The action should be { type: string; data?: string; userInput?: string } to match the full IterableAction type definition.

Suggested change
action: { type: string; data?: string } | null;
}[]
| null;
body?: string | null;
mediaUrl?: string | null;
mediaUrlCaption?: string | null;
defaultAction?: { type: string; data?: string } | null;
action: { type: string; data?: string; userInput?: string } | null;
}[]
| null;
body?: string | null;
mediaUrl?: string | null;
mediaUrlCaption?: string | null;
defaultAction?: { type: string; data?: string; userInput?: string } | null;

Copilot uses AI. Check for mistakes.
@lposen lposen changed the base branch from loren/embedded/MOB-12265-start-end-session to loren/embedded/MOB-12264-sync-and-messages November 19, 2025 07:37
@lposen lposen changed the base branch from loren/embedded/MOB-12264-sync-and-messages to loren/embedded/MOB-12264-android-sync-and-get-messages November 19, 2025 07:38
… into loren/embedded/MOB-12267-android-add-start-impression-and-pause-impressio
… into loren/embedded/MOB-12267-android-add-start-impression-and-pause-impressio
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants