Skip to content

Commit 00c91d8

Browse files
authored
Fix composer command view not Themable (#710)
1 parent 48a6970 commit 00c91d8

File tree

7 files changed

+42
-2
lines changed

7 files changed

+42
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
66
### 🐞 Fixed
77
- Use bright color for typing indicator animation in dark mode [#702](https://github.com/GetStream/stream-chat-swiftui/pull/702)
88
- Refresh quoted message preview when the quoted message is deleted [#705](https://github.com/GetStream/stream-chat-swiftui/pull/705)
9+
- Fix composer command view not Themable [#710](https://github.com/GetStream/stream-chat-swiftui/pull/710)
910

1011
# [4.69.0](https://github.com/GetStream/stream-chat-swiftui/releases/tag/4.69.0)
1112
_December 18, 2024_

Sources/StreamChatSwiftUI/ChatChannel/Composer/MessageComposerView.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -345,13 +345,15 @@ public struct ComposerInputView<Factory: ViewFactory>: View, KeyboardReadable {
345345
displayInfo.isInstant == true {
346346
HStack(spacing: 0) {
347347
Image(uiImage: images.smallBolt)
348+
.renderingMode(.template)
349+
.foregroundColor(Color(colors.staticColorText))
348350
Text(displayInfo.displayName.uppercased())
349351
}
350352
.padding(.horizontal, 8)
351353
.font(fonts.footnoteBold)
352354
.frame(height: 24)
353-
.background(Color.blue)
354-
.foregroundColor(.white)
355+
.background(colors.tintColor)
356+
.foregroundColor(Color(colors.staticColorText))
355357
.cornerRadius(16)
356358
}
357359

StreamChatSwiftUITests/Tests/ChatChannel/MessageComposerView_Tests.swift

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,4 +402,41 @@ class MessageComposerView_Tests: StreamChatTestCase {
402402
// Then
403403
assertSnapshot(matching: view, as: .image(perceptualPrecision: precision))
404404
}
405+
406+
func test_composerInputView_command() {
407+
let factory = DefaultViewFactory.shared
408+
let size = CGSize(width: defaultScreenSize.width, height: 100)
409+
410+
let view = ComposerInputView(
411+
factory: factory,
412+
text: .constant(""),
413+
selectedRangeLocation: .constant(0),
414+
command: .constant(.init(
415+
id: .unique,
416+
typingSuggestion: .empty,
417+
displayInfo: CommandDisplayInfo(
418+
displayName: "Giphy",
419+
icon: Images().commandGiphy,
420+
format: "",
421+
isInstant: true
422+
)
423+
)),
424+
addedAssets: [],
425+
addedFileURLs: [],
426+
addedCustomAttachments: [],
427+
quotedMessage: .constant(nil),
428+
cooldownDuration: 0,
429+
onCustomAttachmentTap: { _ in },
430+
removeAttachmentWithId: { _ in }
431+
)
432+
.environmentObject(MessageComposerTestUtils.makeComposerViewModel(chatClient: chatClient))
433+
.frame(width: size.width, height: size.height)
434+
435+
AssertSnapshot(view, variants: .onlyUserInterfaceStyles, size: size)
436+
437+
// Themed
438+
streamChat?.appearance.colors.tintColor = .mint
439+
streamChat?.appearance.colors.staticColorText = .black
440+
AssertSnapshot(view, variants: .onlyUserInterfaceStyles, size: size, suffix: "themed")
441+
}
405442
}
Loading
Loading
Loading
Loading

0 commit comments

Comments
 (0)