SDKS-5169 Add Image component for DaVinci#214
Conversation
|
Warning Review limit reached
More reviews will be available in 34 minutes and 34 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate. For paid Pro and Pro+ PR reviews, CodeRabbit uses rolling per-developer review limits. Reviews become available again as older review attempts age out of the rolling limit window. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughAdds a new ChangesImageCollector SDK and Sample App Rendering
Sequence Diagram(s)sequenceDiagram
participant DaVinciContinueNode
participant Image
participant ImageCard
participant CoilImageLoader
participant AsyncImage
DaVinciContinueNode->>Image: Image(ImageCollector)
Image->>ImageCard: ImageCard(imageUrl, description, hyperlinkUrl)
ImageCard->>CoilImageLoader: build with SvgDecoder
ImageCard->>AsyncImage: render(imageUrl, imageLoader)
AsyncImage-->>ImageCard: painter state (Loading/Success/Failure)
ImageCard-->>Image: bordered card with placeholder or image, description, hyperlink
Estimated code review effort🎯 2 (Simple) | ⏱️ ~15 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #214 +/- ##
=============================================
+ Coverage 44.12% 44.20% +0.07%
- Complexity 1393 1405 +12
=============================================
Files 316 317 +1
Lines 9760 9773 +13
Branches 1495 1497 +2
=============================================
+ Hits 4307 4320 +13
Misses 4891 4891
Partials 562 562
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
samples/pingsampleapp/src/main/java/com/pingidentity/samples/pingsampleapp/davinci/collector/Image.kt (1)
96-99: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick winRemember
ImageLoaderto avoid rebuilding on recomposition.
ImageLoaderis rebuilt during recompositions; this is avoidable allocation/config work in a hot UI path.♻️ Proposed refactor
- val imageLoader = ImageLoader.Builder(ContextProvider.context) - .components { add(SvgDecoder.Factory()) } - .build() + val imageLoader = remember { + ImageLoader.Builder(ContextProvider.context) + .components { add(SvgDecoder.Factory()) } + .build() + }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@samples/pingsampleapp/src/main/java/com/pingidentity/samples/pingsampleapp/davinci/collector/Image.kt` around lines 96 - 99, The ImageLoader instance is being recreated on every recomposition, causing unnecessary allocations and configuration work in a hot UI path. Wrap the ImageLoader.Builder initialization and build() call within a remember block so that the imageLoader is created only once and reused across recompositions. Ensure that ContextProvider.context or any other dependencies are included as key parameters to the remember call if they can change.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@davinci/src/main/kotlin/com/pingidentity/davinci/collector/ImageCollector.kt`:
- Around line 48-51: The code accesses `jsonPrimitive` directly on JSON values
in the init block for the key, description, imageUrl, and hyperlinkUrl fields,
which throws an IllegalArgumentException when those fields contain non-primitive
JSON values like objects or arrays. Replace the direct `jsonPrimitive` access
with safe casting that gracefully handles non-primitive values without throwing
exceptions. Use a safer approach such as a try-catch block or safe casting
method to prevent crashes when malformed payloads contain JSON objects or arrays
instead of primitive values.
In
`@samples/pingsampleapp/src/main/java/com/pingidentity/samples/pingsampleapp/davinci/collector/Image.kt`:
- Around line 86-90: The clickable modifier block currently validates
hyperlinkUrl only for null, but blank values and invalid URL schemes can still
pass through to startActivity, creating a security issue. Replace the null check
for hyperlinkUrl with isNullOrBlank() to exclude blank strings, and add
additional validation to ensure the URL only contains http or https schemes
before attaching the click behavior. This ensures consistency with the display
logic and prevents unintended deep links from launching via invalid or untrusted
URL schemes.
---
Nitpick comments:
In
`@samples/pingsampleapp/src/main/java/com/pingidentity/samples/pingsampleapp/davinci/collector/Image.kt`:
- Around line 96-99: The ImageLoader instance is being recreated on every
recomposition, causing unnecessary allocations and configuration work in a hot
UI path. Wrap the ImageLoader.Builder initialization and build() call within a
remember block so that the imageLoader is created only once and reused across
recompositions. Ensure that ContextProvider.context or any other dependencies
are included as key parameters to the remember call if they can change.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: eccabb30-a046-4ffb-b51f-cfcd48c70ef3
📒 Files selected for processing (5)
davinci/src/main/kotlin/com/pingidentity/davinci/CollectorRegistry.ktdavinci/src/main/kotlin/com/pingidentity/davinci/collector/ImageCollector.ktdavinci/src/test/kotlin/com/pingidentity/davinci/ImageCollectorTest.ktsamples/pingsampleapp/src/main/java/com/pingidentity/samples/pingsampleapp/davinci/collector/DaVinciContinueNode.ktsamples/pingsampleapp/src/main/java/com/pingidentity/samples/pingsampleapp/davinci/collector/Image.kt
JIRA Ticket
SDKS-5169
Description
Add ImageCollector to display Image for DaVinci Forms.

Summary by CodeRabbit
New Features
Tests