feat(ui): redesign image CDN handling and thumbnail resizing#2531
feat(ui): redesign image CDN handling and thumbnail resizing#2531xsahil03x wants to merge 4 commits intofeat/design-refreshfrom
Conversation
* Introduce `StreamImageCDN` for centralized URL resolution and stable cache key generation * Replace raw string-based thumbnail parameters (`thumbnailSize`, `thumbnailResizeType`, `thumbnailCropType`) with a structured `ImageResize` object across `ImageAttachment`, `MediaAttachmentThumbnail`, and `ImageAttachmentThumbnail` * Add `imageCDN` to `StreamChatConfigurationData` to allow custom CDN implementations * Remove `getResizedImageUrl` extension on `String` in favor of `StreamImageCDN.resolveUrl` * Improve image caching by using `StreamImageCDN.cacheKey` to strip volatile query parameters (e.g., signed tokens) from `CachedNetworkImage` * Add comprehensive migration guide for the redesign and breaking changes
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ 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 |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
1 similar comment
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
packages/stream_chat_flutter/lib/src/utils/stream_image_cdn.dart (1)
142-149: Consider documenting theroparameter.The
'ro': '0'parameter is added without explanation. If this is for rotation (defaulting to no rotation), consider adding a brief comment for clarity, or expose it through theImageResizeconfiguration if rotation should be configurable.💡 Suggested documentation
final queryParameters = { ...uri.queryParameters, 'w': resize.width == 0 ? '*' : resize.width.floor().toString(), 'h': resize.height == 0 ? '*' : resize.height.floor().toString(), 'resize': resize.mode.value, + // Disable rotation by default 'ro': '0', if (resize.mode == ResizeMode.crop) 'crop': resize.crop.value, };🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/stream_chat_flutter/lib/src/utils/stream_image_cdn.dart` around lines 142 - 149, The queryParameters map currently sets 'ro': '0' with no explanation; update the code around queryParameters (the variable building the CDN params) to either add a concise inline comment explaining that 'ro' denotes rotation and '0' means no rotation, or modify the ImageResize model (and places that construct resize) to expose rotation as a configurable field and use resize.rotation (or similar) instead of the hardcoded '0'; ensure references include ResizeMode.crop and the queryParameters construction so reviewers can find the change.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@migrations/redesign/image_cdn.md`:
- Line 22: Remove the incorrect reference to a `stableCacheKey` String extension
in the quick reference line and leave only the `getResizedImageUrl` removal;
update the entry that currently reads "[StreamImageCDN] New class replacing
`getResizedImageUrl` and `stableCacheKey` String extensions" to mention only
`getResizedImageUrl`, and optionally add a parenthetical note that
`StreamImageCDN.cacheKey()` now provides stable cache keys (referencing
StreamImageCDN and its cacheKey() method) so readers aren’t misled about a
non-existent `stableCacheKey` String extension.
---
Nitpick comments:
In `@packages/stream_chat_flutter/lib/src/utils/stream_image_cdn.dart`:
- Around line 142-149: The queryParameters map currently sets 'ro': '0' with no
explanation; update the code around queryParameters (the variable building the
CDN params) to either add a concise inline comment explaining that 'ro' denotes
rotation and '0' means no rotation, or modify the ImageResize model (and places
that construct resize) to expose rotation as a configurable field and use
resize.rotation (or similar) instead of the hardcoded '0'; ensure references
include ResizeMode.crop and the queryParameters construction so reviewers can
find the change.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 483094b8-07d9-47d1-b0ec-dd1da44c02ab
📒 Files selected for processing (9)
migrations/redesign/README.mdmigrations/redesign/image_cdn.mdpackages/stream_chat_flutter/lib/src/attachment/image_attachment.dartpackages/stream_chat_flutter/lib/src/attachment/thumbnail/image_attachment_thumbnail.dartpackages/stream_chat_flutter/lib/src/attachment/thumbnail/media_attachment_thumbnail.dartpackages/stream_chat_flutter/lib/src/stream_chat_configuration.dartpackages/stream_chat_flutter/lib/src/utils/extensions.dartpackages/stream_chat_flutter/lib/src/utils/stream_image_cdn.dartpackages/stream_chat_flutter/lib/stream_chat_flutter.dart
💤 Files with no reviewable changes (1)
- packages/stream_chat_flutter/lib/src/utils/extensions.dart
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## feat/design-refresh #2531 +/- ##
=======================================================
+ Coverage 64.61% 64.65% +0.03%
=======================================================
Files 434 435 +1
Lines 26359 26358 -1
=======================================================
+ Hits 17032 17041 +9
+ Misses 9327 9317 -10 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@xsahil03x I've opened a new pull request, #2532, to work on those changes. Once the pull request is ready, I'll request review from you. |
…age CDN migration guide (#2532) Co-authored-by: xsahil03x <25670178+xsahil03x@users.noreply.github.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Description of the pull request
StreamImageCDNfor centralized URL resolution and stable cache key generationthumbnailSize,thumbnailResizeType,thumbnailCropType) with a structuredImageResizeobject acrossImageAttachment,MediaAttachmentThumbnail, andImageAttachmentThumbnailimageCDNtoStreamChatConfigurationDatato allow custom CDN implementationsgetResizedImageUrlextension onStringin favor ofStreamImageCDN.resolveUrlStreamImageCDN.cacheKeyto strip volatile query parameters (e.g., signed tokens) fromCachedNetworkImageSummary by CodeRabbit
New Features
Documentation
Refactor