-
Notifications
You must be signed in to change notification settings - Fork 123
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
v18.0.0 InAppMessageListener
missing from API
#239
Comments
Hi @wezley98, would you be able to share a snippet (or description) of how you're using those APIs in SDK 17? |
@jyaganeh Here you go.
|
Thanks @wezley98! The private fun getInAppMessageText(message: InAppMessage): String {
val messageText = when (val content = message.displayContent) {
is InAppMessageDisplayContent.ModalContent -> content.modal.body?.text.orEmpty()
is InAppMessageDisplayContent.BannerContent -> content.banner.body?.text.orEmpty()
is InAppMessageDisplayContent.FullscreenContent -> content.fullscreen.body?.text.orEmpty()
is InAppMessageDisplayContent.HTMLContent -> content.html.url
else -> "" // Scenes & Surveys, and Custom display content
}
Log.d("AirshipListener InAppAutomation message getInAppMessageText message is : $messageText")
return messageText
}
private fun getInAppMessageTitle(message: InAppMessage): String {
val title = when (val content = message.displayContent) {
is InAppMessageDisplayContent.ModalContent -> content.modal.heading?.text.orEmpty()
is InAppMessageDisplayContent.BannerContent -> content.banner.heading?.text.orEmpty()
is InAppMessageDisplayContent.FullscreenContent -> content.fullscreen.heading?.text.orEmpty()
else -> "" // Scenes & Surveys, HTML, and Custom display content
}
Log.d("AirshipListener InAppAutomation message getInAppMessageTitle title is : $title")
return title
}
private fun getInAppMessageButtons(message: InAppMessage): List<String> {
val buttons: MutableList<String> = mutableListOf()
val contentButtons = when (val content = message.displayContent) {
is InAppMessageDisplayContent.ModalContent -> content.modal.buttons
is InAppMessageDisplayContent.BannerContent -> content.banner.buttons
is InAppMessageDisplayContent.FullscreenContent -> content.fullscreen.buttons
else -> null // Scenes & Surveys, HTML, and Custom display content
}
contentButtons?.forEach { buttonInfo ->
buttons.add(buttonInfo.label.text)
}
return buttons
} The replacement for
You can register the display delegate like this: InAppAutomation.shared().inAppMessaging.displayDelegate = AirshipListener(...) In the new display delegate, the scope.launch {
airship.analytics.events
.filter { it.type == EventType.IN_APP_RESOLUTION }
.collect { event ->
val body = event.body.optMap()
val messageId = body.opt("id").optMap().opt("message_id").string
val resolution = body.opt("resolution").optMap()
Log.i("InApp Message ($messageId) resolution: $resolution")
}
} The full event body looks like: {"context":{"button":{"identifier":"dismiss_button"},"reporting_context":{"iax_linking_id":"8eefb821-4bac-4db0-b170-1275d9881c85","experiment_id":"","content_types":["scene"]},"pager":{"count":1,"identifier":"59748c2d-236e-4ca6-9a7b-8bf79260071a","completed":true,"page_identifier":"1a365d16-cb46-42ab-9bee-64b0bf5aabaf","page_index":0},"display":{"is_first_display":false,"is_first_display_trigger_session":true,"trigger_session_id":"88b0bd79-2c00-43c4-83d6-24c740d86d9b"}},"id":{"message_id":"8eefb821-4bac-4db0-b170-1275d9881c85"},"source":"urban-airship","resolution":{"button_id":"dismiss_button","type":"button_click","display_time":2,"button_description":"dismiss_button"}} And the resolution object looks like: {"button_id":"dismiss_button","type":"button_click","display_time":2,"button_description":"dismiss_button"} I'm not sure what the |
According to the posted code resolution is used to get the actions on the buttons and one which was selected. Which can be useful to know I guess.
Proposed |
Also app crashes when takeoff is called and we did not disable analytics with builder AirshipConfigOptions.
|
thanks for the report, looking into it |
@DejanMedicSKY @wezley98 Are you working on the same implementation? Any chance we can sync on a call to figure out how we can provide the right info for you? |
I am mostly curious how you are using this data? Yes the flow changes when you get it but if you are just generating reporting from the data then its probably fine and you can replace the listener with the flow. If you can provide more details on these methods then we can hopefully unblock you:
|
* [GH-239] Fix analytics crash on init * Fix method signature
@rlepinski Basically we have a business request to intercept the callbacks and send this information to another analytics system. eg which button was pressed by the user. I'm checking with my colleague @DejanMedicSKY to see if we have everything we need now. Looks like v18.1.0 also fixes the crash we were seeing. |
@wezley98 @DejanMedicSKY, thanks for the email! would one or both of you be able to join a short call to discuss this further? We'd like to make sure that we fully understand your needs, so that we can either make the necessary changes in an upcoming SDK release, or help with an alternate solution that satisfies your use case. |
@jyaganeh We've dropped you an email on 21st June, yes happy to jump on a call to discuss further. |
Hey, Just looking at the v18.0.0 migration guide but couldn't see anything relating to
InAppMessageListener
no longer been available.Could you please provide instructions on how to migrate these imports in v18.0.0?
The text was updated successfully, but these errors were encountered: