Skip to content

Commit

Permalink
Fix composer command view not Themable (#710)
Browse files Browse the repository at this point in the history
  • Loading branch information
nuno-vieira authored Jan 10, 2025
1 parent 48a6970 commit 00c91d8
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### 🐞 Fixed
- Use bright color for typing indicator animation in dark mode [#702](https://github.com/GetStream/stream-chat-swiftui/pull/702)
- Refresh quoted message preview when the quoted message is deleted [#705](https://github.com/GetStream/stream-chat-swiftui/pull/705)
- Fix composer command view not Themable [#710](https://github.com/GetStream/stream-chat-swiftui/pull/710)

# [4.69.0](https://github.com/GetStream/stream-chat-swiftui/releases/tag/4.69.0)
_December 18, 2024_
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -345,13 +345,15 @@ public struct ComposerInputView<Factory: ViewFactory>: View, KeyboardReadable {
displayInfo.isInstant == true {
HStack(spacing: 0) {
Image(uiImage: images.smallBolt)
.renderingMode(.template)
.foregroundColor(Color(colors.staticColorText))
Text(displayInfo.displayName.uppercased())
}
.padding(.horizontal, 8)
.font(fonts.footnoteBold)
.frame(height: 24)
.background(Color.blue)
.foregroundColor(.white)
.background(colors.tintColor)
.foregroundColor(Color(colors.staticColorText))
.cornerRadius(16)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -402,4 +402,41 @@ class MessageComposerView_Tests: StreamChatTestCase {
// Then
assertSnapshot(matching: view, as: .image(perceptualPrecision: precision))
}

func test_composerInputView_command() {
let factory = DefaultViewFactory.shared
let size = CGSize(width: defaultScreenSize.width, height: 100)

let view = ComposerInputView(
factory: factory,
text: .constant(""),
selectedRangeLocation: .constant(0),
command: .constant(.init(
id: .unique,
typingSuggestion: .empty,
displayInfo: CommandDisplayInfo(
displayName: "Giphy",
icon: Images().commandGiphy,
format: "",
isInstant: true
)
)),
addedAssets: [],
addedFileURLs: [],
addedCustomAttachments: [],
quotedMessage: .constant(nil),
cooldownDuration: 0,
onCustomAttachmentTap: { _ in },
removeAttachmentWithId: { _ in }
)
.environmentObject(MessageComposerTestUtils.makeComposerViewModel(chatClient: chatClient))
.frame(width: size.width, height: size.height)

AssertSnapshot(view, variants: .onlyUserInterfaceStyles, size: size)

// Themed
streamChat?.appearance.colors.tintColor = .mint
streamChat?.appearance.colors.staticColorText = .black
AssertSnapshot(view, variants: .onlyUserInterfaceStyles, size: size, suffix: "themed")
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 00c91d8

Please sign in to comment.