Add AJO Basic push notification template support#437
Open
ritusingh-29 wants to merge 7 commits into
Open
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Contributor
|
Add a jira ticket to also add new templates in aepsdk-ui-android |
| #Thu Jun 04 12:49:37 CDT 2021 | ||
| distributionBase=GRADLE_USER_HOME | ||
| distributionPath=wrapper/dists | ||
| distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip |
Contributor
There was a problem hiding this comment.
We should not have this changed
| final String templateType = | ||
| remoteMessage.getData().get(MessagingConstants.Push.PayloadKeys.TEMPLATE_TYPE); | ||
|
|
||
| if (!StringUtils.isNullOrEmpty(templateType)) { |
Contributor
There was a problem hiding this comment.
Can we move this logic entirely in MessagingPushBuilder
… MessagingPushBuilder
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Wires the Messaging SDK to the
notificationbuilderlibrary so AJO push notification template payloads are rendered via the new AJO template system, while leaving the existing push flow completely untouched.The integration point is
MessagingService.handleRemoteMessage():adb_template_typeis present in the FCM data map, rendering is delegated toNotificationBuilder.constructNotificationBuilder(...).build().MessagingPushPayload→MessagingPushBuilderpath runs exactly as before.Background
The existing Messaging push flow (
MessagingPushPayload+MessagingPushBuilder) was built for the established flat-key push payload shape. AJO templated payloads carry anadb_template_typekey plus anadb_template_propertiesJSON blob for template-specific configuration.Rather than fork
MessagingPushBuilder, template rendering is delegated entirely to thenotificationbuilderlibrary, which owns the template parsing and layout logic. See companion PR inaepsdk-ui-android.What changed
MessagingService.javahandleRemoteMessage()now branches onadb_template_type. If present, it delegates toNotificationBuilder.constructNotificationBuilder(data, MessagingPushTrackerActivity.class, NotificationInteractionReceiver.class).build(), wrapped in atry/catchonNotificationConstructionFailedException/IllegalArgumentExceptionthat logs a warning and drops the message on failure. If absent, the existingMessagingPushPayload+MessagingPushBuilder.build(...)path is used unchanged.MessagingConstants.javaTEMPLATE_TYPE = "adb_template_type"constant inPush.PayloadKeys, used as the routing signal.build.gradle.ktsnotificationbuilderlibrary. Version to be bumped onceaepsdk-ui-androidreleases AJO template support.MainActivity.kt(testapp)showAjoBasicPicker()— a dialog listing every JSON inassets/ajo_basic/— andfireAjoBasicPush(), which loads a JSON asset into aMap<String, String>and callsMessagingService.handleRemoteMessage()directly, simulating an FCM delivery without a live Firebase connection. Also added Assurance deep-link handling (Assurance.startSession) inonCreateandonNewIntent.activity_main.xml(testapp)btnTestAjoBasicbutton to the testapp UI.AndroidManifest.xml(testapp)messagingsample://scheme, required for Assurance session start via QR code / URL.ajo_basic_center_crop.json(testapp asset)ajo_basicpayload withscale_type: center_cropfor manual testing.ajo_basic_fit_center.json(testapp asset)ajo_basicpayload withscale_type: fit_centerfor manual testing.Payload schema (
ajo_basic)FCM data map: flat
Map<String, String>.{ "adb_template_type": "ajo_basic", "adb_title": "<title fallback>", "adb_body": "<body fallback>", "adb_image": "<image url fallback>", "adb_icon": "ic_launcher_background", "adb_sound": "bells", "adb_channel_id": "ajo_basic_channel", "adb_n_count": "1", "adb_n_priority": "PRIORITY_HIGH", "adb_n_visibility": "PUBLIC", "adb_a_type": "WEBURL", "adb_uri": "https://www.adobe.com", "adb_act": "[{\"label\":\"Learn More\",\"uri\":\"https://www.adobe.com\",\"type\":\"WEBURL\"},{\"label\":\"Open App\",\"uri\":\"\",\"type\":\"OPENAPP\"}]", "_xdm": "<tracking token>", "adb_template_properties": { "adb_version": "1", "adb_title": { "text": "<title>" }, "adb_body": { "text": "<body>" }, "adb_image": { "url": "<image url>", "scale_type": "center_crop | fit_center" }, "adb_large_icon": { "url": "<icon url>", "scale_type": "center_crop | fit_center" } } }Values in
adb_template_propertiestake precedence. Flat keys serve as fallback for backward compatibility.How Has This Been Tested?
Tested manually via the testapp by firing
ajo_basicpayloads with bothcenter_cropandfit_centerscale types across the following aspect ratios:1:13:25:44:32:116:9Devices / API levels tested
Types of changes
Checklist