Update five icons template docs for title support and basic fallback#1004
Update five icons template docs for title support and basic fallback#1004deeksha-rgb wants to merge 1 commit into
Conversation
|
Warning Rate limit exceeded
To continue reviewing without waiting, purchase usage credits in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
|
/vision-review-deep |
There was a problem hiding this comment.
Code Review
Summary
Docs-only PR updating the Five Icons template section in docs/CTPUSHTEMPLATES.md to document pt_title/pt_msg and to describe a basic-template fallback behavior. The new prose introduces two claims that do not match the actual SDK code in clevertap-pushtemplates — there is no basic-template fallback for FiveIcons (the notification is dropped), and pt_msg is never rendered.
📊 Visual Overview
flowchart TD
A[Push payload<br/>pt_id=pt_five_icons] --> B{Validator: ≥3 deeplinks<br/>AND ≥3 images?}
B -- No --> X[buildIfValid returns null<br/>NO notification rendered]
B -- Yes --> C[Build FiveIconStyle<br/>setContentTitle pt_title<br/>setCustomContentView icon row]
C --> D{Unloaded icons > 2<br/>at render time?}
D -- Yes --> Y[TemplateRenderer returns null<br/>NO notification rendered<br/>PTLog: 'not displaying Notification']
D -- No --> E[Notification shown<br/>title + icon row<br/>pt_msg never used]
style X fill:#fdd
style Y fill:#fdd
style E fill:#dfd
Verdict
REQUEST CHANGES
The two new behavioral claims in the prose (basic-template fallback) and the new pt_msg row in the keys table are not supported by the current code. See inline comments for evidence and suggested wording. The pt_title addition is partially accurate but worth qualifying.
To retrigger this review, comment /vision-review-deep on the PR.
Reviewed by Vision AI
| Five icons template is a push notification that can display a title and message above a row of up to 5 icons. It helps users go directly to the functionality of their choice with a button click. | ||
|
|
||
| If at least 3 icons are not retrieved, the library doesn't render any notification. The bifurcation of each CTA is captured in the event Notification Clicked with in the property `wzrk_c2a`. | ||
| `pt_title` and `pt_msg` are optional, but when provided they are rendered above the icon row. |
There was a problem hiding this comment.
🐛 Documentation inaccuracy — no basic-template fallback exists for Five Icons
This sentence claims two fallback paths to a basic notification, but neither matches the current code in clevertap-pushtemplates:
- Invalid payload (insufficient icons/deeplinks):
FiveIconsTemplateValidatorrequires ≥3 deeplinks and ≥3 images; on failurebuildIfValidreturnsnulland the notification is dropped — there is notoBasicTemplateData()path for FiveIcons (compare withTimerTemplateData,TemplateRenderer.kt:166,176which does fall back). Seevalidators/FiveIconsTemplateValidator.kt:5-9andTemplateRenderer.kt:216-217. - ≥3 icon images fail to load at render time:
TemplateRenderer.kt:147-149returnsnull(no notification at all), not a basic notification:This matches the explicit log line inif ((... .getUnloadedFiveIconsCount() > 2 || ... .getUnloadedFiveIconsCount() > 2) { null
FiveIconSmallContentView.kt:115/FiveIconBigContentView.kt:108:"More than 2 images were not retrieved in 5CTA Notification, not displaying Notification."
Suggested wording that matches actual behavior:
| `pt_title` and `pt_msg` are optional, but when provided they are rendered above the icon row. | |
| If the payload does not contain at least 3 valid icons and 3 deeplinks, or if 3 or more icon images fail to download at render time, the library does not render any notification. |
If the intent of this PR is to actually introduce a basic-template fallback for FiveIcons, then a code change in TemplateRenderer.kt is missing from this PR and the docs are ahead of the implementation.
| ---:|:---:|:--- | ||
| pt_id | Required | Value - `pt_five_icons` | ||
| pt_title | Optional | Title rendered above icons | ||
| pt_msg | Optional | Message rendered above icons |
There was a problem hiding this comment.
🐛 pt_msg is not rendered by the Five Icons template
I couldn't find any code path that consumes a Five Icons pt_msg. The notification builder in styles/Style.kt:47-48 only calls setContentTitle(Html.fromHtml(pt_title)) — there is no corresponding setContentText(...) for FiveIcons (a grep for setContentText in clevertap-pushtemplates only turns up InputBoxStyle.kt:36 and PushTemplateReceiver.java:314, neither of which is the FiveIcons path). The two custom layouts res/layout/five_cta_collapsed.xml and res/layout/five_cta_expanded.xml also contain no TextView (grep for TextView|title|msg returns 0 matches in both).
Net effect: documenting pt_msg as "Message rendered above icons" will mislead integrators — the field will be silently ignored at render time.
Either:
- drop this row from the table (and remove the "and message" wording from the section prose above), or
- add the missing code change (a
setContentText(...)inFiveIconStyle/Stylefor FiveIcons, and a TextView in the custom layouts) to this PR before merging the docs.
| ## Five Icons Template | ||
|
|
||
| Five icons template is a push notification with no text, just 5 icons which can help your users go directly to the functionality of their choice with a button's click. | ||
| Five icons template is a push notification that can display a title and message above a row of up to 5 icons. It helps users go directly to the functionality of their choice with a button click. |
There was a problem hiding this comment.
🧹 Qualify the title-rendering claim
pt_title is wired through Style.kt:48 (setContentTitle(Html.fromHtml(pt_title))), so it does appear in the standard notification header — but the FiveIcons template uses setCustomContentView / setCustomBigContentView (see Style.kt:28-33) and only opts into DecoratedCustomViewStyle on Android S+ (Style.kt:55-59). On pre-S devices the custom view replaces the standard notification chrome, so the title may not visibly appear "above the icon row" the way the prose implies — the icon row IS the whole notification on those devices.
Consider qualifying the wording, e.g. "…can display a title above a row of up to 5 icons (rendered via the standard notification header on Android 12+ using DecoratedCustomViewStyle)", or verify on pre-Android-12 emulators before keeping the current phrasing.
| If the user clicks anywhere outside the icon CTAs, the default notification click action launches the activity intent. | ||
|
|
||
| <img src="https://github.com/CleverTap/clevertap-android-sdk/blob/master/static/fiveicon.png" width="412" height="100"> | ||
|
|
There was a problem hiding this comment.
💡 Nit: extra blank line introduced between the <img> tag and ## Timer Template — the rest of the doc uses a single blank line between sections. Not blocking.
Update five icons template docs for title support and basic fallback