-
Notifications
You must be signed in to change notification settings - Fork 377
[FIX] IAM with dynamic trigger showing forever #2137
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -451,13 +451,17 @@ internal class InAppMessagesManager( | |
| * | ||
| * Make all messages with redisplay available if: | ||
| * - Already displayed | ||
| * - At least one Trigger has changed | ||
| * - At least one existing Trigger has changed OR a new trigger is added when there is only dynamic trigger | ||
| */ | ||
| private fun makeRedisplayMessagesAvailableWithTriggers(newTriggersKeys: Collection<String>) { | ||
| private fun makeRedisplayMessagesAvailableWithTriggers( | ||
| newTriggersKeys: Collection<String>, | ||
| isNewTriggerAdded: Boolean, | ||
| ) { | ||
| for (message in messages) { | ||
| if (!message.isTriggerChanged && redisplayedInAppMessages.contains(message) && | ||
| _triggerController.isTriggerOnMessage(message, newTriggersKeys) | ||
| ) { | ||
| val isMessageDisplayed = redisplayedInAppMessages.contains(message) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok I just fixed this. |
||
| val isTriggerOnMessage = _triggerController.isTriggerOnMessage(message, newTriggersKeys) | ||
| val isOnlyDynamicTriggers = _triggerController.messageHasOnlyDynamicTriggers(message) | ||
| if (!message.isTriggerChanged && isMessageDisplayed && (isTriggerOnMessage || isNewTriggerAdded && isOnlyDynamicTriggers)) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is acceptable for now, however keep in mind for the future ideally we won't want to have an |
||
| Logging.debug("InAppMessagesManager.makeRedisplayMessagesAvailableWithTriggers: Trigger changed for message: $message") | ||
| message.isTriggerChanged = true | ||
| } | ||
|
|
@@ -643,7 +647,6 @@ internal class InAppMessagesManager( | |
| Logging.debug("InAppMessagesManager.onTriggerCompleted: called with triggerId: $triggerId") | ||
| val triggerIds: MutableSet<String> = HashSet() | ||
| triggerIds.add(triggerId) | ||
| makeRedisplayMessagesAvailableWithTriggers(triggerIds) | ||
| } | ||
|
|
||
| /** | ||
|
|
@@ -653,9 +656,11 @@ internal class InAppMessagesManager( | |
| * | ||
| * @see OSInAppMessageController.setDataForRedisplay | ||
| */ | ||
| override fun onTriggerConditionChanged() { | ||
| override fun onTriggerConditionChanged(triggerId: String) { | ||
| Logging.debug("InAppMessagesManager.onTriggerConditionChanged()") | ||
|
|
||
| makeRedisplayMessagesAvailableWithTriggers(listOf(triggerId), false) | ||
|
|
||
| suspendifyOnThread { | ||
| // This method is called when a time-based trigger timer fires, meaning the message can | ||
| // probably be shown now. So the current message conditions should be re-evaluated | ||
|
|
@@ -666,7 +671,7 @@ internal class InAppMessagesManager( | |
| override fun onTriggerChanged(newTriggerKey: String) { | ||
| Logging.debug("InAppMessagesManager.onTriggerChanged(newTriggerKey: $newTriggerKey)") | ||
|
|
||
| makeRedisplayMessagesAvailableWithTriggers(listOf(newTriggerKey)) | ||
| makeRedisplayMessagesAvailableWithTriggers(listOf(newTriggerKey), true) | ||
|
|
||
| suspendifyOnThread { | ||
| // This method is called when a time-based trigger timer fires, meaning the message can | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.