Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Add support for overriding `onImageTap` in `LinkAttachmentView` [#986](https://github.com/GetStream/stream-chat-swiftui/pull/986)
- Add support for customizing text colors in `LinkAttachmentView` [#992](https://github.com/GetStream/stream-chat-swiftui/pull/992)
- Expose `MediaAttachment` properties and initializer [#1000](https://github.com/GetStream/stream-chat-swiftui/pull/1000)
- Add `ColorPalette.navigationBarGlyph` for configuring the glyph color for buttons in navigation bars [#999](https://github.com/GetStream/stream-chat-swiftui/pull/999)
- Allow overriding `ChatChannelInfoViewModel` properties: `shouldShowLeaveConversationButton`, `canRenameChannel`, and `shouldShowAddUserButton` [#995](https://github.com/GetStream/stream-chat-swiftui/pull/995)

### 🐞 Fixed
- Fix openChannel not working when searching or another chat shown [#975](https://github.com/GetStream/stream-chat-swiftui/pull/975)
Expand All @@ -20,6 +22,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Fix random scroll after marking a message unread [#989](https://github.com/GetStream/stream-chat-swiftui/pull/989)
- Fix marking channel read when the user scrolls to the bottom after marking a message as unread [#989](https://github.com/GetStream/stream-chat-swiftui/pull/989)
- Fix replying to unread messages marking them instantly as read [#989](https://github.com/GetStream/stream-chat-swiftui/pull/989)
- Fix rendering of the add users button on iOS 26 [#999](https://github.com/GetStream/stream-chat-swiftui/pull/999)
- Use `ColorPalette.navigationBarTint` for the background of the add users button [#999](https://github.com/GetStream/stream-chat-swiftui/pull/999)

# [4.89.1](https://github.com/GetStream/stream-chat-swiftui/releases/tag/4.89.1)
_September 23, 2025_
Expand Down
2 changes: 1 addition & 1 deletion DemoAppSwiftUI/ChannelHeader/CustomChannelHeader.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public struct CustomChannelHeader: ToolbarContent {
.resizable()
.scaledToFit()
.frame(width: 24, height: 24)
.foregroundColor(Color.white)
.foregroundColor(Color(colors.navigationBarGlyph))
.padding(.all, 8)
.background(colors.navigationBarTintColor)
.clipShape(Circle())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,38 +141,7 @@ public struct ChatChannelInfoView<Factory: ViewFactory>: View, KeyboardReadable
}
}
}
.toolbarThemed {
ToolbarItem(placement: .principal) {
Group {
if viewModel.showSingleMemberDMView {
Text(viewModel.displayedParticipants.first?.chatUser.name ?? "")
.font(fonts.bodyBold)
.foregroundColor(Color(colors.navigationBarTitle))
} else {
ChannelTitleView(
channel: viewModel.channel,
shouldShowTypingIndicator: false
)
.id(viewModel.channelId)
}
}
}

ToolbarItem(placement: .navigationBarTrailing) {
if viewModel.shouldShowAddUserButton {
Button {
viewModel.addUsersShown = true
} label: {
Image(systemName: "person.badge.plus")
.customizable()
.foregroundColor(Color.white)
.padding(.all, 8)
.background(colors.tintColor)
.clipShape(Circle())
}
}
}
}
.modifier(ChatChannelInfoViewHeaderViewModifier(viewModel: viewModel))
.onReceive(keyboardWillChangePublisher) { visible in
viewModel.keyboardShown = visible
}
Expand All @@ -184,3 +153,61 @@ public struct ChatChannelInfoView<Factory: ViewFactory>: View, KeyboardReadable
viewModel.addUsersShown || viewModel.selectedParticipant != nil
}
}

struct ChatChannelInfoViewHeaderViewModifier: ViewModifier {
@Injected(\.colors) private var colors
@Injected(\.fonts) private var fonts

let viewModel: ChatChannelInfoViewModel

func body(content: Content) -> some View {
if #available(iOS 26.0, *) {
content
.toolbarThemed {
toolbar(glyphSize: 24)
#if compiler(>=6.2)
.sharedBackgroundVisibility(.hidden)
#endif
}
} else {
content
.toolbarThemed {
toolbar()
}
}
}

@ToolbarContentBuilder func toolbar(glyphSize: CGFloat? = nil) -> some ToolbarContent {
ToolbarItem(placement: .principal) {
Group {
if viewModel.showSingleMemberDMView {
Text(viewModel.displayedParticipants.first?.chatUser.name ?? "")
.font(fonts.bodyBold)
.foregroundColor(Color(colors.navigationBarTitle))
} else {
ChannelTitleView(
channel: viewModel.channel,
shouldShowTypingIndicator: false
)
.id(viewModel.channelId)
}
}
}

ToolbarItem(placement: .navigationBarTrailing) {
if viewModel.shouldShowAddUserButton {
Button {
viewModel.addUsersShown = true
} label: {
Image(systemName: "person.badge.plus")
.customizable()
.frame(width: glyphSize, height: glyphSize)
.foregroundColor(Color(colors.navigationBarGlyph))
.padding(.all, 8)
.background(colors.navigationBarTintColor)
.clipShape(Circle())
}
}
}
}
}
3 changes: 3 additions & 0 deletions Sources/StreamChatSwiftUI/ColorPalette.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import UIKit
/// Provides the colors used throughout the SDK.
public struct ColorPalette {
public init() {
navigationBarGlyph = .white
navigationBarTitle = text
navigationBarSubtitle = textLowEmphasis
navigationBarTintColor = tintColor
Expand Down Expand Up @@ -104,6 +105,8 @@ public struct ColorPalette {

// MARK: - Navigation Bar

public var navigationBarGlyph: UIColor

public var navigationBarTitle: UIColor {
didSet {
let attributes: [NSAttributedString.Key: Any] = [.foregroundColor: navigationBarTitle]
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions StreamChatSwiftUITests/Tests/StreamChatTestCase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ open class StreamChatTestCase: XCTestCase {
appearance.colors.navigationBarTitle = .blue
appearance.colors.navigationBarSubtitle = .cyan
appearance.colors.navigationBarBackground = .yellow
appearance.colors.navigationBarGlyph = .green
}
}
}
Loading