-
Notifications
You must be signed in to change notification settings - Fork 42
[SDK-223] - Embedded Listener RN Android Bridge #801
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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