Repository navigation
Add showCitationNumbers theme flag to toggle inline citation badges - #209
Conversation
Adds behavior.citations.showCitationNumbers (default true) so themes can hide the inline citation number badges in concierge message text while keeping the Sources footer below the message visible. - ConciergeCitationsBehavior: new flag, defaults to true so existing themes are unaffected - ThemeParser: parse the key with optBoolean default true - ConciergeResponse: skip citation annotation when flag is false - ThemeParserTest: coverage for explicit false and missing-key default - Document the key in style-guide.md Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
rymorale
left a comment
There was a problem hiding this comment.
the changes look good to me overall with just a couple of minor things to address. feel free to merge after updating.
| // When behavior.citations.showCitationNumbers is false, skip annotation so no inline | ||
| // citation number badges render; the Sources footer is driven separately by ChatFooter. | ||
| val annotatedText = remember(text, sources, citationsBehavior.showCitationNumbers) { | ||
| val effectiveSources = if (citationsBehavior.showCitationNumbers) sources else emptyList() |
There was a problem hiding this comment.
The new tests only cover parsing, so reverting this line wouldn't fail anything. Could we add a small Compose UI test (e.g. alongside the existing ChatMessageItemTest) that sets showCitationNumbers = false with non-empty sources and asserts no citation badges render while the Sources footer is still shown?
| val linkIconStyle: ConciergeLinkIconStyle? = null | ||
| val linkIconStyle: ConciergeLinkIconStyle? = null, | ||
| /** Whether inline citation number badges are rendered in the message text. The "Sources" footer is unaffected. */ | ||
| val showCitationNumbers: Boolean = true |
There was a problem hiding this comment.
nit: ConciergeCitationsBehavior is a public data class, so adding a constructor param changes the constructor/copy signatures. This is source compatible for Kotlin callers but not binary compatible for anything compiled against the previous version. It follows the same pattern as linkIconStyle, so not blocking, just worth noting in the release notes.
Address review feedback for showCitationNumbers: - Add Compose UI tests verifying disabled citation numbers hide inline badges while the Sources footer remains visible and expandable - Cover explicit enabled and default behavior to confirm badges render - Document the constructor and generated copy signature changes in ConciergeCitationsBehavior and the need to recompile binary consumers - Link release notes from the documentation index Validation: - All 3 new Compose UI tests pass on the Android emulator - Temporarily bypassing the rendering guard causes the disabled-state test to fail; restoring it returns all tests to passing - Android 17 validation required a temporary newer AndroidX test-tooling override; no repository dependency changes included
| @@ -0,0 +1,13 @@ | |||
| # Release notes | |||
There was a problem hiding this comment.
we typically add the release notes in the tag created when making a release. did you mean to commit this file?
| | `behavior.citations.linkIconStyle.size` | number | `16` | Inline link icon size, in dp. | | ||
| | `behavior.citations.linkIconStyle.spacing` | number | `2` | Gap between link text and its icon, in dp. | | ||
| | `behavior.citations.linkIconStyle.color` | string | `--message-concierge-link-color`, else `--color-text` | Inline link icon tint color (hex). | | ||
| | `behavior.citations.showCitationNumbers` | boolean | `true` | When `false`, hides the inline citation number badges in AI message text. The "Sources" footer below the message still appears. | |
There was a problem hiding this comment.
The testapp themes (code/testapp/src/main/assets/themeDefault.json and themeDemo.json) don't include showCitationNumbers under behavior.citations. The iOS PR added it to theme-all-properties.json. could we add it here too for discoverability?
Add explicit showCitationNumbers defaults to both bundled test-app themes. Remove the standalone release notes and index link, retaining the SDK binary-compatibility warning in the style guide.
Summary
Adds a new theme behavior flag,
behavior.citations.showCitationNumbers(defaulttrue), that controls whether inline citation number badges render in concierge message text. The "Sources" footer below the message is unaffected.Android counterpart to the iOS PR: adobe/aepsdk-concierge-ios#201
Motivation
Brands want the sources list for transparency without the inline ①② badges interrupting message readability. Previously the badges always rendered when sources were present; the only existing citations flag (
showLinkIcon) controls the sources list link icon, not the inline badges.Changes
ConciergeThemeTokens.kt— newshowCitationNumbers: Boolean = trueonConciergeCitationsBehavior; default keeps existing themes unaffected (backward compatible).ThemeParser.kt— parses the key withoptBoolean(..., true)so a missing key preserves current behavior.ConciergeResponse.kt— when the flag isfalse, citation annotation is skipped (sources passed as empty toCitationAnnotator) so no inline badges render; the Sources footer is still driven separately byChatFooter.ThemeParserTest.kt— coverage for explicitfalseand the missing-key default.style-guide.md— documents the key in the behavior table, JSON examples, and implementation-status table.Testing
ThemeParserTest: 112/112 passing, including the 2 new citations tests."showCitationNumbers": falseinbehavior.citations, concierge messages render without inline badges while the Sources footer still appears.Theme usage