-
Notifications
You must be signed in to change notification settings - Fork 29
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
Evan/feature/placement support #664
Conversation
…te-local-storage-and-handlers
…age-and-handlers [MOB-6733] update local storage and handlers
…acement-support [MOB-7179] updates reset function for placement support
…te-get-messages-for-placements
…alization-tests [MOB-7349] placements serialization tests
…es-for-placements [MOB-6731] updates get messages for placement support
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.
LGTM. Made some comments
iterableapi/src/main/java/com/iterable/iterableapi/IterableApi.java
Outdated
Show resolved
Hide resolved
iterableapi/src/main/java/com/iterable/iterableapi/IterableApi.java
Outdated
Show resolved
Hide resolved
iterableapi/src/main/java/com/iterable/iterableapi/IterableApi.java
Outdated
Show resolved
Hide resolved
iterableapi/src/main/java/com/iterable/iterableapi/IterableApiClient.java
Outdated
Show resolved
Hide resolved
iterableapi/src/main/java/com/iterable/iterableapi/IterableApiClient.java
Outdated
Show resolved
Hide resolved
iterableapi/src/main/java/com/iterable/iterableapi/IterableApiClient.java
Outdated
Show resolved
Hide resolved
val localMessageList = getMessages().toMutableList() | ||
val localMessageMap = mutableMapOf<String, IterableEmbeddedMessage>() | ||
localMessageList.forEach { | ||
getMessages(placementId)?.toMutableList()?.forEach { | ||
localMessageMap[it.metadata.messageId] = it | ||
} | ||
|
||
// Check for new messages and add them to the local list | ||
remoteMessageList.forEach { | ||
if (!localMessageMap.containsKey(it.metadata.messageId)) { | ||
localMessagesChanged = true | ||
localMessageList.add(it) | ||
IterableApi.getInstance().trackEmbeddedMessageReceived(it) |
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.
Needs revisit. Check if the trackEmbeddedMessage is called for previously received message.
val messagesToRemove = mutableListOf<IterableEmbeddedMessage>() | ||
localMessageList.forEach { | ||
if (!remoteMessageMap.containsKey(it.metadata.messageId)) { | ||
messagesToRemove.add(it) | ||
|
||
//TODO: Make a call to the updateHandler to notify that the message has been removed | ||
//TODO: Make a call to backend if needed | ||
localPlacementMessagesMap[placementId]?.forEach { | ||
if (!remoteMessageMap.containsKey(it.metadata.messageId)) { | ||
localMessagesChanged = true | ||
} | ||
} | ||
localMessageList.removeAll(messagesToRemove) | ||
|
||
this.localMessages = localMessageList | ||
localPlacementMessagesMap[placementId] = remoteMessageList |
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.
Revisit the functionality
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.
Added some comments
iterableapi/src/main/java/com/iterable/iterableapi/IterableEmbeddedManager.kt
Outdated
Show resolved
Hide resolved
iterableapi/src/main/java/com/iterable/iterableapi/IterableEmbeddedManager.kt
Outdated
Show resolved
Hide resolved
iterableapi/src/test/java/com/iterable/iterableapi/IterableEmbeddedManagerTest.java
Show resolved
Hide resolved
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.
LGTM
🔹 Jira Ticket(s) if any
✏️ Description