[SDK-231] Add click handling tracking#799
Conversation
|
Coverage Impact Unable to calculate total coverage change because base branch coverage was not found. 🚦 See full report on Qlty Cloud »🛟 Help
|
There was a problem hiding this comment.
Pull request overview
This PR adds click tracking functionality for embedded messages in the iOS native layer. The implementation enables tracking user interactions with embedded messages, including button clicks with optional button identifiers and click URLs.
Changes:
- Added
trackEmbeddedClickmethod in Swift to handle embedded message click tracking with validation - Implemented TurboModule and legacy React Native bridge bindings in Objective-C++
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| ios/RNIterableAPI/ReactIterableAPI.swift | Added trackEmbeddedClick method that extracts message ID, looks up the cached message, validates parameters, and calls the native SDK tracking API |
| ios/RNIterableAPI/RNIterableAPI.mm | Added TurboModule bridge implementation to convert C++ types to NSDictionary and legacy architecture bridge export for React Native compatibility |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| guard let clickedUrl = clickedUrl else { | ||
| ITBError("clickedUrl is required for trackEmbeddedClick") | ||
| return | ||
| } |
There was a problem hiding this comment.
The clickedUrl validation should be moved earlier in the function, before extracting the messageId and looking up the message in the cache. This would avoid unnecessary work when clickedUrl is null. Consider moving this check right after the ITBInfo() call to fail fast.
|
|
||
| #if RCT_NEW_ARCH_ENABLED | ||
| #import "RNIterableAPISpec.h" | ||
| #import <string> |
There was a problem hiding this comment.
The <string> header is imported but doesn't appear to be used in the visible code. If this import is not required by the generated RNIterableAPISpec.h header, consider removing it to keep the imports clean.
| #import <string> |
Ayyanchira
left a comment
There was a problem hiding this comment.
Approving with some possible suggestions
|
|
||
| // Find the message in the embedded manager's cache | ||
| let messages = IterableAPI.embeddedManager.getMessages() | ||
| guard let embeddedMessage = messages.first(where: { $0.metadata.messageId == messageId }) else { |
There was a problem hiding this comment.
Can this check for embedded message be avoided by using the method's input parameter? But it can make sense if EmbeddedMessage is not guaranteed to receive everytime.
|
|
||
| @objc(trackEmbeddedClick:buttonId:clickedUrl:) | ||
| public func trackEmbeddedClick( | ||
| message: NSDictionary, buttonId: String?, clickedUrl: String? |
There was a problem hiding this comment.
Can the message be of type EmbeddedMessage instead of generic string?
…se-impression-a' into loren/embedded/SDK-231-ios-add-click-handling-and-track

🔹 JIRA Ticket(s) if any
✏️ Description
Added click handling and tracking
Testing
Setup
yarn installyarn installbundle exec pod installwatchman watch-del-allyarn start --reset-cacheopen ReactNativeSdkExample.xcworkspace