Fix message attachments sizes and message content width on iPad#1335
Fix message attachments sizes and message content width on iPad#1335
Conversation
π WalkthroughWalkthroughAdds a configurable attachment preview width and enforces it through view factories and attachment views; tightens logic for quoted-message bubbles with single attachments; adjusts content-width/layout calculations for avatars, spacers, and action labels; updates snapshot tests and CHANGELOG. Changes
Estimated code review effortπ― 3 (Moderate) | β±οΈ ~22 minutes Poem
π₯ Pre-merge checks | β 2 | β 1β Failed checks (1 warning)
β Passed checks (2 passed)
βοΈ Tip: You can configure your own custom pre-merge checks in the settings. β¨ Finishing Touchesπ Generate docstrings
π§ͺ 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 |
# Conflicts: # StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageItemView_Tests/test_messageItemView_incomingAvatarHidden_snapshot.small-dark.png # StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewPendingGiphy_snapshot.small-dark.png # StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewVoiceRecordingFromMeTheming_snapshot.default-light.png # StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewVoiceRecordingFromMe_snapshot.default-light.png # StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewVoiceRecordingFromMe_snapshot.extraExtraExtraLarge-light.png # StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewVoiceRecordingFromMe_snapshot.rightToLeftLayout-default.png # StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewVoiceRecordingFromMe_snapshot.small-dark.png # StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewVoiceRecordingFromParticipant_snapshot.default-light.png # StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewVoiceRecordingFromParticipant_snapshot.extraExtraExtraLarge-light.png # StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewVoiceRecordingFromParticipant_snapshot.rightToLeftLayout-default.png # StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewVoiceRecordingFromParticipant_snapshot.small-dark.png # StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewVoiceRecordingWithTextFromMeMultiple_snapshot.default-light.png # StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewVoiceRecordingWithTextFromMeMultiple_snapshot.extraExtraExtraLarge-light.png # StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewVoiceRecordingWithTextFromMeMultiple_snapshot.rightToLeftLayout-default.png # StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewVoiceRecordingWithTextFromMeMultiple_snapshot.small-dark.png # StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewVoiceRecordingWithTextFromMe_snapshot.default-light.png # StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewVoiceRecordingWithTextFromMe_snapshot.extraExtraExtraLarge-light.png # StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewVoiceRecordingWithTextFromMe_snapshot.rightToLeftLayout-default.png # StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewVoiceRecordingWithTextFromMe_snapshot.small-dark.png # StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewVoiceRecordingWithTextFromParticipantMultiple_snapshot.default-light.png # StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewVoiceRecordingWithTextFromParticipantMultiple_snapshot.extraExtraExtraLarge-light.png # StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewVoiceRecordingWithTextFromParticipantMultiple_snapshot.rightToLeftLayout-default.png # StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewVoiceRecordingWithTextFromParticipantMultiple_snapshot.small-dark.png # StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewVoiceRecordingWithTextFromParticipant_snapshot.default-light.png # StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewVoiceRecordingWithTextFromParticipant_snapshot.extraExtraExtraLarge-light.png # StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewVoiceRecordingWithTextFromParticipant_snapshot.rightToLeftLayout-default.png # StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewVoiceRecordingWithTextFromParticipant_snapshot.small-dark.png
44302cb to
2a72a64
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
π§Ή Nitpick comments (3)
Sources/StreamChatSwiftUI/ViewFactory/Options/ComposerViewFactoryOptions.swift (1)
491-498: Source-breaking API change inPollViewOptions.Adding
availableWidthas a required parameter without a default value is a source-breaking change. External integrators usingPollViewOptions(message:poll:isFirst:)will encounter compile errors.Since this is a v5 beta release (per CHANGELOG), API changes may be acceptable. However, if backward compatibility is desired, consider adding a default value or a deprecated convenience initializer:
public init(message: ChatMessage, poll: Poll, isFirst: Bool, availableWidth: CGFloat = 256) { ... }π€ Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@Sources/StreamChatSwiftUI/ViewFactory/Options/ComposerViewFactoryOptions.swift` around lines 491 - 498, The new initializer for PollViewOptions/ComposerViewFactoryOptions added a required availableWidth parameter and breaks callers using PollViewOptions(message:poll:isFirst:); update the API to restore backward compatibility by giving availableWidth a sensible default (e.g., 256) in the public init (the init(message: ChatMessage, poll: Poll, isFirst: Bool, availableWidth: CGFloat) initializer) or add a deprecated convenience initializer overload that omits availableWidth and forwards to the new init with a default value so existing call sites continue to compile.Sources/StreamChatSwiftUI/ChatMessageList/MessageListConfig.swift (1)
118-120: Consider documenting the default value.The documentation comment could mention the default value (256 points) to help developers understand the baseline behavior without needing to check the initializer.
π Suggested improvement
- /// The width used for attachment previews in the message list. + /// The width used for attachment previews in the message list. + /// + /// The default value is 256 points. public let attachmentPreviewWidth: CGFloatπ€ Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@Sources/StreamChatSwiftUI/ChatMessageList/MessageListConfig.swift` around lines 118 - 120, Add the default value (256 points) to the documentation for MessageListConfig's attachmentPreviewWidth property: update the doc comment for attachmentPreviewWidth to state that its default is 256 (used when not overridden in the MessageListConfig initializer), referencing the MessageListConfig type and the attachmentPreviewWidth property so readers can quickly find the initializer and understand the baseline behavior.Sources/StreamChatSwiftUI/ChatMessageList/GiphyAttachmentView.swift (1)
15-15: Remove unused injection.The
@Injected(\.utils)property is added but never used in this view. This adds unnecessary overhead.π§ Suggested fix
- `@Injected`(\.utils) private var utilsπ€ Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@Sources/StreamChatSwiftUI/ChatMessageList/GiphyAttachmentView.swift` at line 15, Remove the unused `@Injected`(\.utils) private var utils property from GiphyAttachmentView.swift: locate the declaration of utils in the GiphyAttachmentView type and delete that property (and any now-unreferenced imports or comments related only to utils) so the view no longer contains an unused injection.
π€ Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@Sources/StreamChatSwiftUI/ChatMessageList/Polls/PollAttachmentView.swift`:
- Line 13: The file declares an unused dependency injection property
`@Injected`(\.utils) var utils in PollAttachmentView which is never referenced;
remove that property declaration from the PollAttachmentView implementation to
eliminate the unused symbol and clean up imports/usages (ensure no other code in
the file relies on utils after removal).
---
Nitpick comments:
In `@Sources/StreamChatSwiftUI/ChatMessageList/GiphyAttachmentView.swift`:
- Line 15: Remove the unused `@Injected`(\.utils) private var utils property from
GiphyAttachmentView.swift: locate the declaration of utils in the
GiphyAttachmentView type and delete that property (and any now-unreferenced
imports or comments related only to utils) so the view no longer contains an
unused injection.
In `@Sources/StreamChatSwiftUI/ChatMessageList/MessageListConfig.swift`:
- Around line 118-120: Add the default value (256 points) to the documentation
for MessageListConfig's attachmentPreviewWidth property: update the doc comment
for attachmentPreviewWidth to state that its default is 256 (used when not
overridden in the MessageListConfig initializer), referencing the
MessageListConfig type and the attachmentPreviewWidth property so readers can
quickly find the initializer and understand the baseline behavior.
In
`@Sources/StreamChatSwiftUI/ViewFactory/Options/ComposerViewFactoryOptions.swift`:
- Around line 491-498: The new initializer for
PollViewOptions/ComposerViewFactoryOptions added a required availableWidth
parameter and breaks callers using PollViewOptions(message:poll:isFirst:);
update the API to restore backward compatibility by giving availableWidth a
sensible default (e.g., 256) in the public init (the init(message: ChatMessage,
poll: Poll, isFirst: Bool, availableWidth: CGFloat) initializer) or add a
deprecated convenience initializer overload that omits availableWidth and
forwards to the new init with a default value so existing call sites continue to
compile.
πͺ 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: defaults
Review profile: CHILL
Plan: Pro
Run ID: 6d953d8f-2cee-410b-81c8-8ad2f25bd77f
β Files ignored due to path filters (58)
StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageItemView_Tests/test_messageContainerCurrentUserColor_snapshot.1.pngis excluded by!**/*.pngStreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageItemView_Tests/test_messageContainerEditedAIGenerated_snapshot.1.pngis excluded by!**/*.pngStreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageItemView_Tests/test_messageContainerEdited_snapshot.1.pngis excluded by!**/*.pngStreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageItemView_Tests/test_messageContainerViewSentThisUser_snapshot.1.pngis excluded by!**/*.pngStreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageItemView_Tests/test_messageItemView_incomingAvatarHidden_snapshot.small-dark.pngis excluded by!**/*.pngStreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageItemView_Tests/test_singleImageNoCaption_notFirstInGroup_snapshot.1.pngis excluded by!**/*.pngStreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageItemView_Tests/test_singleImageNoCaption_outgoing_firstInGroup_snapshot.1.pngis excluded by!**/*.pngStreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageItemView_Tests/test_singleImageNoCaption_portrait_outgoing_snapshot.1.pngis excluded by!**/*.pngStreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageItemView_Tests/test_singleImageWithCaption_outgoing_snapshot.1.pngis excluded by!**/*.pngStreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageItemView_Tests/test_singleVideoNoCaption_outgoing_firstInGroup_snapshot.1.pngis excluded by!**/*.pngStreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_linkAttachmentView_shouldNotRenderLinkPreviewWithOtherAttachments.1.pngis excluded by!**/*.pngStreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_linkAttachmentView_snapshot.1.pngis excluded by!**/*.pngStreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewFileText_snapshot.1.pngis excluded by!**/*.pngStreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewFile_snapshot.1.pngis excluded by!**/*.pngStreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewGiphy_snapshot.1.pngis excluded by!**/*.pngStreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewImage_snapshot.1.pngis excluded by!**/*.pngStreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewImage_snapshot2Images.1.pngis excluded by!**/*.pngStreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewImage_snapshot3Images.1.pngis excluded by!**/*.pngStreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewImage_snapshot3ImagesAndVideo.1.pngis excluded by!**/*.pngStreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewImage_snapshotQuoted.1.pngis excluded by!**/*.pngStreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewPendingGiphy_snapshot.default-light.pngis excluded by!**/*.pngStreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewPendingGiphy_snapshot.extraExtraExtraLarge-light.pngis excluded by!**/*.pngStreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewPendingGiphy_snapshot.rightToLeftLayout-default.pngis excluded by!**/*.pngStreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewPendingGiphy_snapshot.small-dark.pngis excluded by!**/*.pngStreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewQuoted_singleFileAttachment_snapshot.default-light.pngis excluded by!**/*.pngStreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewQuoted_singleFileAttachment_snapshot.extraExtraExtraLarge-light.pngis excluded by!**/*.pngStreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewQuoted_singleFileAttachment_snapshot.rightToLeftLayout-default.pngis excluded by!**/*.pngStreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewQuoted_singleFileAttachment_snapshot.small-dark.pngis excluded by!**/*.pngStreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewQuoted_singleImageAttachment_snapshot.default-light.pngis excluded by!**/*.pngStreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewQuoted_singleImageAttachment_snapshot.extraExtraExtraLarge-light.pngis excluded by!**/*.pngStreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewQuoted_singleImageAttachment_snapshot.rightToLeftLayout-default.pngis excluded by!**/*.pngStreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewQuoted_singleImageAttachment_snapshot.small-dark.pngis excluded by!**/*.pngStreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewVideo_snapshot.1.pngis excluded by!**/*.pngStreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewVoiceRecordingFromMeTheming_snapshot.default-light.pngis excluded by!**/*.pngStreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewVoiceRecordingFromMe_snapshot.default-light.pngis excluded by!**/*.pngStreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewVoiceRecordingFromMe_snapshot.extraExtraExtraLarge-light.pngis excluded by!**/*.pngStreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewVoiceRecordingFromMe_snapshot.rightToLeftLayout-default.pngis excluded by!**/*.pngStreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewVoiceRecordingFromMe_snapshot.small-dark.pngis excluded by!**/*.pngStreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewVoiceRecordingFromParticipant_snapshot.default-light.pngis excluded by!**/*.pngStreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewVoiceRecordingFromParticipant_snapshot.extraExtraExtraLarge-light.pngis excluded by!**/*.pngStreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewVoiceRecordingFromParticipant_snapshot.rightToLeftLayout-default.pngis excluded by!**/*.pngStreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewVoiceRecordingFromParticipant_snapshot.small-dark.pngis excluded by!**/*.pngStreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewVoiceRecordingWithTextFromMeMultiple_snapshot.default-light.pngis excluded by!**/*.pngStreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewVoiceRecordingWithTextFromMeMultiple_snapshot.extraExtraExtraLarge-light.pngis excluded by!**/*.pngStreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewVoiceRecordingWithTextFromMeMultiple_snapshot.rightToLeftLayout-default.pngis excluded by!**/*.pngStreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewVoiceRecordingWithTextFromMeMultiple_snapshot.small-dark.pngis excluded by!**/*.pngStreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewVoiceRecordingWithTextFromMe_snapshot.default-light.pngis excluded by!**/*.pngStreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewVoiceRecordingWithTextFromMe_snapshot.extraExtraExtraLarge-light.pngis excluded by!**/*.pngStreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewVoiceRecordingWithTextFromMe_snapshot.rightToLeftLayout-default.pngis excluded by!**/*.pngStreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewVoiceRecordingWithTextFromMe_snapshot.small-dark.pngis excluded by!**/*.pngStreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewVoiceRecordingWithTextFromParticipantMultiple_snapshot.default-light.pngis excluded by!**/*.pngStreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewVoiceRecordingWithTextFromParticipantMultiple_snapshot.extraExtraExtraLarge-light.pngis excluded by!**/*.pngStreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewVoiceRecordingWithTextFromParticipantMultiple_snapshot.rightToLeftLayout-default.pngis excluded by!**/*.pngStreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewVoiceRecordingWithTextFromParticipantMultiple_snapshot.small-dark.pngis excluded by!**/*.pngStreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewVoiceRecordingWithTextFromParticipant_snapshot.default-light.pngis excluded by!**/*.pngStreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewVoiceRecordingWithTextFromParticipant_snapshot.extraExtraExtraLarge-light.pngis excluded by!**/*.pngStreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewVoiceRecordingWithTextFromParticipant_snapshot.rightToLeftLayout-default.pngis excluded by!**/*.pngStreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewVoiceRecordingWithTextFromParticipant_snapshot.small-dark.pngis excluded by!**/*.png
π Files selected for processing (13)
CHANGELOG.mdSources/StreamChatSwiftUI/ChatMessageList/GiphyAttachmentView.swiftSources/StreamChatSwiftUI/ChatMessageList/MessageAttachmentsView.swiftSources/StreamChatSwiftUI/ChatMessageList/MessageItemView.swiftSources/StreamChatSwiftUI/ChatMessageList/MessageListConfig.swiftSources/StreamChatSwiftUI/ChatMessageList/MessageView.swiftSources/StreamChatSwiftUI/ChatMessageList/Polls/PollAttachmentView.swiftSources/StreamChatSwiftUI/ChatMessageList/QuotedMessageView/ChatQuotedMessageView.swiftSources/StreamChatSwiftUI/ViewFactory/DefaultViewFactory.swiftSources/StreamChatSwiftUI/ViewFactory/Options/ComposerViewFactoryOptions.swiftStreamChatSwiftUITests/Tests/ChatChannel/MessageView_Tests.swiftStreamChatSwiftUITests/Tests/ChatChannel/PollAttachmentView_Tests.swiftStreamChatSwiftUITests/Tests/Utils/ViewFactory_Tests.swift
| @Injected(\.fonts) var fonts | ||
| @Injected(\.colors) var colors | ||
| @Injected(\.tokens) var tokens | ||
| @Injected(\.utils) var utils |
There was a problem hiding this comment.
π§© Analysis chain
π Script executed:
#!/bin/bash
# Check if utils is actually used anywhere in PollAttachmentView.swift
rg -n 'utils\.' Sources/StreamChatSwiftUI/ChatMessageList/Polls/PollAttachmentView.swiftRepository: GetStream/stream-chat-swiftui
Length of output: 55
Remove unused utils injection.
The @Injected(\.utils) var utils property at line 13 is declared but never used in this file. Remove it.
π€ Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@Sources/StreamChatSwiftUI/ChatMessageList/Polls/PollAttachmentView.swift` at
line 13, The file declares an unused dependency injection property
`@Injected`(\.utils) var utils in PollAttachmentView which is never referenced;
remove that property declaration from the PollAttachmentView implementation to
eliminate the unused symbol and clean up imports/usages (ensure no other code in
the file relies on utils after removal).
martinmitrevski
left a comment
There was a problem hiding this comment.
some checks are failing here
There was a problem hiding this comment.
π§Ή Nitpick comments (1)
StreamChatSwiftUITests/Tests/ChatChannel/MessageItemView_Tests.swift (1)
1061-1061: Consider adding explicit size for consistency with otherAssertSnapshotusages.All other
AssertSnapshotcalls in this file pass an explicitsizeparameter (e.g.,AssertSnapshot(view, size: CGSize(width: 375, height: 200))). While the view is already framed at 375Γ340, adding the explicit size maintains consistency.Suggested change
// Then - AssertSnapshot(view) + AssertSnapshot(view, size: CGSize(width: 375, height: 340))π€ Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@StreamChatSwiftUITests/Tests/ChatChannel/MessageItemView_Tests.swift` at line 1061, The AssertSnapshot call is missing an explicit size argument; update the AssertSnapshot(view) invocation to include the explicit CGSize matching the view's frame (use AssertSnapshot(view, size: CGSize(width: 375, height: 340))) so it matches other usages and the view's framed dimensions; change the call where AssertSnapshot is invoked for this test in MessageItemView_Tests.swift.
π€ Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@StreamChatSwiftUITests/Tests/ChatChannel/MessageItemView_Tests.swift`:
- Line 1061: The AssertSnapshot call is missing an explicit size argument;
update the AssertSnapshot(view) invocation to include the explicit CGSize
matching the view's frame (use AssertSnapshot(view, size: CGSize(width: 375,
height: 340))) so it matches other usages and the view's framed dimensions;
change the call where AssertSnapshot is invoked for this test in
MessageItemView_Tests.swift.
βΉοΈ Review info
βοΈ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 648e2f59-dc7a-44c7-bcda-7c37dce31063
β Files ignored due to path filters (31)
StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageItemView_Tests/test_portraitImageWithOneReaction_snapshot.default-light.pngis excluded by!**/*.pngStreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageItemView_Tests/test_portraitImageWithOneReaction_snapshot.extraExtraExtraLarge-light.pngis excluded by!**/*.pngStreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageItemView_Tests/test_portraitImageWithOneReaction_snapshot.rightToLeftLayout-default.pngis excluded by!**/*.pngStreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageItemView_Tests/test_portraitImageWithOneReaction_snapshot.small-dark.pngis excluded by!**/*.pngStreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_linkAttachmentView_snapshot.1.pngis excluded by!**/*.pngStreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewGiphy_snapshot.1.pngis excluded by!**/*.pngStreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewVoiceRecordingFromMeTheming_snapshot.default-light.pngis excluded by!**/*.pngStreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewVoiceRecordingFromMe_snapshot.default-light.pngis excluded by!**/*.pngStreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewVoiceRecordingFromMe_snapshot.extraExtraExtraLarge-light.pngis excluded by!**/*.pngStreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewVoiceRecordingFromMe_snapshot.rightToLeftLayout-default.pngis excluded by!**/*.pngStreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewVoiceRecordingFromMe_snapshot.small-dark.pngis excluded by!**/*.pngStreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewVoiceRecordingFromParticipant_snapshot.default-light.pngis excluded by!**/*.pngStreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewVoiceRecordingFromParticipant_snapshot.extraExtraExtraLarge-light.pngis excluded by!**/*.pngStreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewVoiceRecordingFromParticipant_snapshot.rightToLeftLayout-default.pngis excluded by!**/*.pngStreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewVoiceRecordingFromParticipant_snapshot.small-dark.pngis excluded by!**/*.pngStreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewVoiceRecordingWithTextFromMeMultiple_snapshot.default-light.pngis excluded by!**/*.pngStreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewVoiceRecordingWithTextFromMeMultiple_snapshot.extraExtraExtraLarge-light.pngis excluded by!**/*.pngStreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewVoiceRecordingWithTextFromMeMultiple_snapshot.rightToLeftLayout-default.pngis excluded by!**/*.pngStreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewVoiceRecordingWithTextFromMeMultiple_snapshot.small-dark.pngis excluded by!**/*.pngStreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewVoiceRecordingWithTextFromMe_snapshot.default-light.pngis excluded by!**/*.pngStreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewVoiceRecordingWithTextFromMe_snapshot.extraExtraExtraLarge-light.pngis excluded by!**/*.pngStreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewVoiceRecordingWithTextFromMe_snapshot.rightToLeftLayout-default.pngis excluded by!**/*.pngStreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewVoiceRecordingWithTextFromMe_snapshot.small-dark.pngis excluded by!**/*.pngStreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewVoiceRecordingWithTextFromParticipantMultiple_snapshot.default-light.pngis excluded by!**/*.pngStreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewVoiceRecordingWithTextFromParticipantMultiple_snapshot.extraExtraExtraLarge-light.pngis excluded by!**/*.pngStreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewVoiceRecordingWithTextFromParticipantMultiple_snapshot.rightToLeftLayout-default.pngis excluded by!**/*.pngStreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewVoiceRecordingWithTextFromParticipantMultiple_snapshot.small-dark.pngis excluded by!**/*.pngStreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewVoiceRecordingWithTextFromParticipant_snapshot.default-light.pngis excluded by!**/*.pngStreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewVoiceRecordingWithTextFromParticipant_snapshot.extraExtraExtraLarge-light.pngis excluded by!**/*.pngStreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewVoiceRecordingWithTextFromParticipant_snapshot.rightToLeftLayout-default.pngis excluded by!**/*.pngStreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_messageViewVoiceRecordingWithTextFromParticipant_snapshot.small-dark.pngis excluded by!**/*.png
π Files selected for processing (5)
Sources/StreamChatSwiftUI/ChatMessageList/AsyncVoiceMessages/VoiceRecordingContainerView.swiftSources/StreamChatSwiftUI/ChatMessageList/LinkAttachmentView.swiftSources/StreamChatSwiftUI/ChatMessageList/MessageAttachmentsView.swiftSources/StreamChatSwiftUI/ViewFactory/DefaultViewFactory.swiftStreamChatSwiftUITests/Tests/ChatChannel/MessageItemView_Tests.swift
π§ Files skipped from review as they are similar to previous changes (2)
- Sources/StreamChatSwiftUI/ViewFactory/DefaultViewFactory.swift
- Sources/StreamChatSwiftUI/ChatMessageList/MessageAttachmentsView.swift
There was a problem hiding this comment.
π§Ή Nitpick comments (1)
Sources/StreamChatSwiftUI/ChatMessageList/Reactions/ReactionsOverlayView.swift (1)
249-250: LGTM β layout fix aligns with design spec.The combination of
.frame(minWidth: 250)with.fixedSize(horizontal: true, vertical: false)correctly constrains the message actions to at least 250 points while allowing natural content-based sizing. This addresses the reported issue of message actions growing too wide.Optional: Consider extracting
250into a named constant (e.g.,private let messageActionsMinWidth: CGFloat = 250) to document the Figma spec and ease future adjustments.,
π€ Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@Sources/StreamChatSwiftUI/ChatMessageList/Reactions/ReactionsOverlayView.swift` around lines 249 - 250, Replace the magic literal 250 used in ReactionsOverlayView within the .frame(minWidth: 250, alignment: ...) call with a named constant to document the layout spec and make adjustments easier; introduce a private let (e.g., messageActionsMinWidth: CGFloat = 250) scoped near the ReactionsOverlayView type and update the .frame call to use messageActionsMinWidth, leaving .fixedSize(horizontal: true, vertical: false) unchanged.
π€ Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In
`@Sources/StreamChatSwiftUI/ChatMessageList/Reactions/ReactionsOverlayView.swift`:
- Around line 249-250: Replace the magic literal 250 used in
ReactionsOverlayView within the .frame(minWidth: 250, alignment: ...) call with
a named constant to document the layout spec and make adjustments easier;
introduce a private let (e.g., messageActionsMinWidth: CGFloat = 250) scoped
near the ReactionsOverlayView type and update the .frame call to use
messageActionsMinWidth, leaving .fixedSize(horizontal: true, vertical: false)
unchanged.
βΉοΈ Review info
βοΈ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 784301f9-74fe-4105-a126-8ddcb2d73e8c
β Files ignored due to path filters (4)
StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/ReactionsOverlayView_Tests/test_reactionsOverlayView_noReactions.1.pngis excluded by!**/*.pngStreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/ReactionsOverlayView_Tests/test_reactionsOverlayView_snapshot.1.pngis excluded by!**/*.pngStreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/ReactionsOverlayView_Tests/test_reactionsOverlayView_translated.1.pngis excluded by!**/*.pngStreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/ReactionsOverlayView_Tests/test_reactionsOverlay_veryLongMessage.1.pngis excluded by!**/*.png
π Files selected for processing (1)
Sources/StreamChatSwiftUI/ChatMessageList/Reactions/ReactionsOverlayView.swift
SDK Size
|
StreamChatSwiftUI XCSize
Show 8 more objects
|
Public Interface public struct PollAttachmentView: View
- public init(factory: Factory,message: ChatMessage,poll: Poll,isFirst: Bool)
+ public init(factory: Factory,message: ChatMessage,poll: Poll,isFirst: Bool,width: CGFloat)
public final class PollViewOptions: Sendable
-
+ public let availableWidth: CGFloat
-
+
- public init(message: ChatMessage,poll: Poll,isFirst: Bool)
+
+ public init(message: ChatMessage,poll: Poll,isFirst: Bool,availableWidth: CGFloat)
@MainActor public final class MessageListConfig
- public let bouncedMessagesAlertActionsEnabled: Bool
+ public let attachmentPreviewWidth: CGFloat
- public let skipEditedMessageLabel: (ChatMessage) -> Bool
+ public let bouncedMessagesAlertActionsEnabled: Bool
- public let draftMessagesEnabled: Bool
+ public let skipEditedMessageLabel: (ChatMessage) -> Bool
- public let downloadFileAttachmentsEnabled: Bool
+ public let draftMessagesEnabled: Bool
- public let highlightMessageWhenJumping: Bool
+ public let downloadFileAttachmentsEnabled: Bool
- public var navigationBarDisplayMode: NavigationBarItem.TitleDisplayMode
+ public let highlightMessageWhenJumping: Bool
- public var supportedMessageActions: @MainActor (SupportedMessageActionsOptions) -> [MessageAction]
+ public var navigationBarDisplayMode: NavigationBarItem.TitleDisplayMode
-
+ public var supportedMessageActions: @MainActor (SupportedMessageActionsOptions) -> [MessageAction]
-
+
- public init(messageListType: MessageListType = .messaging,typingIndicatorPlacement: TypingIndicatorPlacement = .automatic,groupMessages: Bool = true,messageDisplayOptions: MessageDisplayOptions = MessageDisplayOptions(),messagePaddings: MessagePaddings = MessagePaddings(),dateIndicatorPlacement: DateIndicatorPlacement = .overlay,pageSize: Int = 25,messagePopoverEnabled: Bool = true,doubleTapOverlayEnabled: Bool = false,becomesFirstResponderOnOpen: Bool = false,resignsFirstResponderOnScrollDown: Bool = true,updateChannelsFromMessageList: Bool = false,maxTimeIntervalBetweenMessagesInGroup: TimeInterval = 60,cacheSizeOnChatDismiss: Int = 1024 * 1024 * 100,iPadSplitViewEnabled: Bool = true,scrollingAnchor: UnitPoint = .center,showNewMessagesSeparator: Bool = true,highlightMessageWhenJumping: Bool = true,handleTabBarVisibility: Bool = true,messageListAlignment: MessageListAlignment = .standard,uniqueReactionsEnabled: Bool = false,localLinkDetectionEnabled: Bool = true,isMessageEditedLabelEnabled: Bool = true,markdownSupportEnabled: Bool = true,userBlockingEnabled: Bool = false,bouncedMessagesAlertActionsEnabled: Bool = true,skipEditedMessageLabel: @escaping (ChatMessage) -> Bool = { _ in false },draftMessagesEnabled: Bool = false,downloadFileAttachmentsEnabled: Bool = false,hidesCommandsOverlayOnMessageListTap: Bool = true,hidesAttachmentsPickersOnMessageListTap: Bool = true,navigationBarDisplayMode: NavigationBarItem.TitleDisplayMode = .inline,supportedMessageActions: @escaping @MainActor (SupportedMessageActionsOptions) -> [MessageAction] = MessageAction.defaultActions(for:))
+
+ public init(messageListType: MessageListType = .messaging,typingIndicatorPlacement: TypingIndicatorPlacement = .automatic,groupMessages: Bool = true,messageDisplayOptions: MessageDisplayOptions = MessageDisplayOptions(),messagePaddings: MessagePaddings = MessagePaddings(),dateIndicatorPlacement: DateIndicatorPlacement = .overlay,pageSize: Int = 25,messagePopoverEnabled: Bool = true,doubleTapOverlayEnabled: Bool = false,becomesFirstResponderOnOpen: Bool = false,resignsFirstResponderOnScrollDown: Bool = true,updateChannelsFromMessageList: Bool = false,maxTimeIntervalBetweenMessagesInGroup: TimeInterval = 60,cacheSizeOnChatDismiss: Int = 1024 * 1024 * 100,iPadSplitViewEnabled: Bool = true,scrollingAnchor: UnitPoint = .center,showNewMessagesSeparator: Bool = true,highlightMessageWhenJumping: Bool = true,handleTabBarVisibility: Bool = true,messageListAlignment: MessageListAlignment = .standard,uniqueReactionsEnabled: Bool = false,localLinkDetectionEnabled: Bool = true,isMessageEditedLabelEnabled: Bool = true,markdownSupportEnabled: Bool = true,userBlockingEnabled: Bool = false,bouncedMessagesAlertActionsEnabled: Bool = true,skipEditedMessageLabel: @escaping (ChatMessage) -> Bool = { _ in false },draftMessagesEnabled: Bool = false,downloadFileAttachmentsEnabled: Bool = false,hidesCommandsOverlayOnMessageListTap: Bool = true,hidesAttachmentsPickersOnMessageListTap: Bool = true,attachmentPreviewWidth: CGFloat = 256,navigationBarDisplayMode: NavigationBarItem.TitleDisplayMode = .inline,supportedMessageActions: @escaping @MainActor (SupportedMessageActionsOptions) -> [MessageAction] = MessageAction.defaultActions(for:)) |
|




π Issue Links
Fixes IOS-1552
π― Goal
Fix issues with message attachment sizes
π Summary
MessageListConfig.attachmentPreviewWidthfor easily changing attachment preview sizesπ Implementation
π¨ Showcase
Attachment resize and content width issue on iPad
Attachment size issues
There are subtle size issues where attachments appeared wider than they should have.
π§ͺ Manual Testing Notes
Result: attachment size does not change
βοΈ Contributor Checklist
docs-contentrepoSummary by CodeRabbit
New Features
Bug Fixes
Tests
Documentation