[SDK-223] - Embedded Listener RN Android Bridge#801
[SDK-223] - Embedded Listener RN Android Bridge#801Ayyanchira wants to merge 2 commits intoloren/embedded/masterfrom
Conversation
|
Coverage Impact ⬇️ Merging this pull request will decrease total coverage on Modified Files with Diff Coverage (2)
🤖 Increase coverage with AI coding...🚦 See full report on Qlty Cloud » 🛟 Help
|
| * subscription.remove(); | ||
| * ``` | ||
| */ | ||
| addMessagesUpdatedListener(callback: () => void) { |
There was a problem hiding this comment.
I think we should instead have onEmbeddedMessageUpdate and handle the unsubscribe function internally, as this is how we have done other listeners in the app.
We can then add this to the removeAllEventListeners function in Iterable.ts,
| @@ -189,6 +191,7 @@ public void initialize2WithApiKey(String apiKey, ReadableMap configReadableMap, | |||
| IterableApi.getInstance().setDeviceAttribute("reactNativeSDKVersion", version); | |||
|
|
|||
| IterableApi.getInstance().getInAppManager().addListener(this); | |||
| IterableApi.getInstance().getEmbeddedManager().addUpdateListener(this); | |||
There was a problem hiding this comment.
These puts themselves as listeners to updateListener at bridge. This will bridge to receive callback when list of EmbeddedMessages change.
| @Override | ||
| public void onMessagesUpdated() { | ||
| IterableLogger.d(TAG, "onMessagesUpdated"); | ||
| sendEvent(EventName.receivedIterableEmbeddedMessagesChanged.name(), null); |
There was a problem hiding this comment.
This is the callback that should trigger the call on TS level indicating its time to check local messages as sync has been performed.
| @Override | ||
| public void onEmbeddedMessagingDisabled() { | ||
| IterableLogger.d(TAG, "onEmbeddedMessagingDisabled"); | ||
| sendEvent(EventName.receivedIterableEmbeddedMessagingDisabled.name(), null); |
There was a problem hiding this comment.
During the sync, if native code recognize feature disablement, this callback will be invoked. sendEvent will then call method on EventName.receivedIterableEmbeddedMessagingDisabled. TS layer also needs to be there where TS layer have list of listener it calls to indicate this disabled feature notice.
|
Closing. And creating a new PR for that |

🔹 JIRA Ticket(s) if any
✏️ Description