Skip to content

Commit e78a4bf

Browse files
authored
Add navigationBarTitle, navigationBarSubtitle, navigationBarTintColor, navigationBarBackground to ColorPalette (#939)
1 parent 034f651 commit e78a4bf

File tree

33 files changed

+252
-43
lines changed

33 files changed

+252
-43
lines changed

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
33

44
# Upcoming
55

6+
### ✅ Added
7+
- Add `ColorPalette.navigationBarTitle`, `ColorPalette.navigationBarSubtitle`, `ColorPalette.navigationBarTintColor`, `ColorPalette.navigationBarBackground` [#939](https://github.com/GetStream/stream-chat-swiftui/pull/939)
68
### 🐞 Fixed
79
- Long message with a link preview was truncated sometimes [#940](https://github.com/GetStream/stream-chat-swiftui/pull/940)
810

@@ -23,7 +25,7 @@ _September 01, 2025_
2325
_August 21, 2025_
2426

2527
### 🐞 Fixed
26-
- Fix inconsistencies in gallery view displaying images and videos [927](https://github.com/GetStream/stream-chat-swiftui/pull/927)
28+
- Fix inconsistencies in gallery view displaying images and videos [#927](https://github.com/GetStream/stream-chat-swiftui/pull/927)
2729
- Prevent audio messages increasing width in reply mode [#926](https://github.com/GetStream/stream-chat-swiftui/pull/926)
2830

2931
# [4.85.0](https://github.com/GetStream/stream-chat-swiftui/releases/tag/4.85.0)

Sources/StreamChatSwiftUI/ChatChannel/ChannelHeader/ChatChannelHeaderViewModifier.swift

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ public struct DefaultChatChannelHeader<Factory: ViewFactory>: ToolbarContent {
7777
)
7878
.offset(x: 4)
7979
}
80+
.accentColor(colors.navigationBarTintColor)
8081
.accessibilityLabel(Text(L10n.Channel.Header.Info.title))
8182

8283
NavigationLink(isActive: $isActive) {
@@ -109,26 +110,30 @@ public struct DefaultChannelHeaderModifier<Factory: ViewFactory>: ChatChannelHea
109110

110111
public func body(content: Content) -> some View {
111112
if #available(iOS 26, *) {
112-
content.toolbar {
113-
DefaultChatChannelHeader(
114-
factory: factory,
115-
channel: channel,
116-
headerImage: channelHeaderLoader.image(for: channel),
117-
isActive: $isActive
118-
)
119-
#if compiler(>=6.2)
120-
.sharedBackgroundVisibility(.hidden)
121-
#endif
122-
}
113+
content
114+
.navigationBarBackground()
115+
.toolbar {
116+
DefaultChatChannelHeader(
117+
factory: factory,
118+
channel: channel,
119+
headerImage: channelHeaderLoader.image(for: channel),
120+
isActive: $isActive
121+
)
122+
#if compiler(>=6.2)
123+
.sharedBackgroundVisibility(.hidden)
124+
#endif
125+
}
123126
} else {
124-
content.toolbar {
125-
DefaultChatChannelHeader(
126-
factory: factory,
127-
channel: channel,
128-
headerImage: channelHeaderLoader.image(for: channel),
129-
isActive: $isActive
130-
)
131-
}
127+
content
128+
.navigationBarBackground()
129+
.toolbar {
130+
DefaultChatChannelHeader(
131+
factory: factory,
132+
channel: channel,
133+
headerImage: channelHeaderLoader.image(for: channel),
134+
isActive: $isActive
135+
)
136+
}
132137
}
133138
}
134139
}
@@ -159,7 +164,7 @@ public struct ChannelTitleView: View {
159164
VStack(spacing: 2) {
160165
Text(channelNamer(channel, currentUserId) ?? "")
161166
.font(fonts.bodyBold)
162-
.foregroundColor(Color(colors.text))
167+
.foregroundColor(Color(colors.navigationBarTitle))
163168
.accessibilityIdentifier("chatName")
164169

165170
if shouldShowTypingIndicator {
@@ -170,7 +175,7 @@ public struct ChannelTitleView: View {
170175
} else {
171176
Text(channel.onlineInfoText(currentUserId: currentUserId))
172177
.font(fonts.footnote)
173-
.foregroundColor(Color(colors.textLowEmphasis))
178+
.foregroundColor(Color(colors.navigationBarSubtitle))
174179
.accessibilityIdentifier("chatOnlineInfo")
175180
}
176181
}

Sources/StreamChatSwiftUI/ChatChannel/ChannelHeader/MessageThreadHeaderViewModifier.swift

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@ public struct DefaultMessageThreadHeader: ToolbarContent {
1818
VStack {
1919
Text(L10n.Message.Actions.threadReply)
2020
.font(fonts.bodyBold)
21+
.foregroundColor(Color(colors.navigationBarTitle))
2122
Text(L10n.Message.Threads.subtitle)
2223
.font(fonts.footnote)
23-
.foregroundColor(Color(colors.textLowEmphasis))
24+
.foregroundColor(Color(colors.navigationBarSubtitle))
2425
}
2526
}
2627
}
@@ -29,8 +30,10 @@ public struct DefaultMessageThreadHeader: ToolbarContent {
2930
/// The default message thread header modifier.
3031
public struct DefaultMessageThreadHeaderModifier: MessageThreadHeaderViewModifier {
3132
public func body(content: Content) -> some View {
32-
content.toolbar {
33-
DefaultMessageThreadHeader()
34-
}
33+
content
34+
.navigationBarBackground()
35+
.toolbar {
36+
DefaultMessageThreadHeader()
37+
}
3538
}
3639
}

Sources/StreamChatSwiftUI/ChatChannel/ChannelInfo/ChatChannelInfoView.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,13 +132,14 @@ public struct ChatChannelInfoView<Factory: ViewFactory>: View, KeyboardReadable
132132
}
133133
}
134134
}
135+
.navigationBarBackground()
135136
.toolbar {
136137
ToolbarItem(placement: .principal) {
137138
Group {
138139
if viewModel.showSingleMemberDMView {
139140
Text(viewModel.displayedParticipants.first?.chatUser.name ?? "")
140141
.font(fonts.bodyBold)
141-
.foregroundColor(Color(colors.text))
142+
.foregroundColor(Color(colors.navigationBarTitle))
142143
} else {
143144
ChannelTitleView(
144145
channel: viewModel.channel,
@@ -161,6 +162,7 @@ public struct ChatChannelInfoView<Factory: ViewFactory>: View, KeyboardReadable
161162
.background(colors.tintColor)
162163
.clipShape(Circle())
163164
}
165+
.accentColor(colors.navigationBarTintColor)
164166
}
165167
}
166168
}

Sources/StreamChatSwiftUI/ChatChannel/ChannelInfo/FileAttachmentsView.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ public struct FileAttachmentsView: View {
7171
}
7272
}
7373
.navigationTitle(L10n.ChatInfo.Files.title)
74+
.navigationBarBackground()
7475
}
7576
}
7677

Sources/StreamChatSwiftUI/ChatChannel/ChannelInfo/MediaAttachmentsView.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ public struct MediaAttachmentsView<Factory: ViewFactory>: View {
9999
}
100100
}
101101
.navigationTitle(L10n.ChatInfo.Media.title)
102+
.navigationBarBackground()
102103
}
103104
}
104105

Sources/StreamChatSwiftUI/ChatChannel/ChannelInfo/PinnedMessagesView.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ public struct PinnedMessagesView<Factory: ViewFactory>: View {
7272
}
7373
}
7474
.navigationTitle(L10n.ChatInfo.PinnedMessages.title)
75+
.navigationBarBackground()
7576
}
7677

7778
private func makeMessageDestination(message: ChatMessage) -> ChatChannelView<Factory> {

Sources/StreamChatSwiftUI/ChatChannel/MessageList/FileAttachmentPreview.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import SwiftUI
88
public struct FileAttachmentPreview: View {
99
@Environment(\.presentationMode) var presentationMode
1010

11+
@Injected(\.colors) private var colors
1112
@Injected(\.fonts) private var fonts
1213
@Injected(\.images) private var images
1314
@Injected(\.utils) private var utils
@@ -63,10 +64,12 @@ public struct FileAttachmentPreview: View {
6364
}
6465
}
6566
.navigationBarTitleDisplayMode(.inline)
67+
.navigationBarBackground()
6668
.toolbar {
6769
ToolbarItem(placement: .principal) {
6870
Text(navigationTitle)
6971
.font(fonts.bodyBold)
72+
.foregroundColor(Color(colors.navigationBarTitle))
7073
.lineLimit(1)
7174
}
7275

@@ -75,7 +78,9 @@ public struct FileAttachmentPreview: View {
7578
presentationMode.wrappedValue.dismiss()
7679
} label: {
7780
Image(uiImage: images.close)
81+
.renderingMode(.template)
7882
}
83+
.accentColor(colors.navigationBarTintColor)
7984
}
8085
}
8186
}

Sources/StreamChatSwiftUI/ChatChannel/MessageList/Polls/PollAllOptionsView.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ struct PollAllOptionsView<Factory: ViewFactory>: View {
1616
let factory: Factory
1717

1818
var body: some View {
19-
NavigationView {
19+
NavigationContainerView(embedInNavigationView: true) {
2020
ScrollView {
2121
VStack(alignment: .leading, spacing: 32) {
2222
HStack {
@@ -43,10 +43,12 @@ struct PollAllOptionsView<Factory: ViewFactory>: View {
4343
}
4444
.padding()
4545
}
46+
.navigationBarBackground()
4647
.toolbar {
4748
ToolbarItem(placement: .principal) {
4849
Text(L10n.Message.Polls.Toolbar.optionsTitle)
4950
.bold()
51+
.foregroundColor(Color(colors.navigationBarTitle))
5052
}
5153

5254
ToolbarItem(placement: .navigationBarLeading) {
@@ -55,6 +57,7 @@ struct PollAllOptionsView<Factory: ViewFactory>: View {
5557
} label: {
5658
Image(systemName: "xmark")
5759
}
60+
.accentColor(colors.navigationBarTintColor)
5861
}
5962
}
6063
.navigationBarTitleDisplayMode(.inline)

Sources/StreamChatSwiftUI/ChatChannel/MessageList/Polls/PollCommentsView.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ struct PollCommentsView<Factory: ViewFactory>: View {
2929
}
3030

3131
var body: some View {
32-
NavigationView {
32+
NavigationContainerView(embedInNavigationView: true) {
3333
ScrollView {
3434
LazyVStack(alignment: .leading) {
3535
ForEach(viewModel.comments) { comment in
@@ -82,10 +82,12 @@ struct PollCommentsView<Factory: ViewFactory>: View {
8282
isPresented: $viewModel.errorShown,
8383
action: viewModel.refresh
8484
)
85+
.navigationBarBackground()
8586
.toolbar {
8687
ToolbarItem(placement: .principal) {
8788
Text(L10n.Message.Polls.Toolbar.commentsTitle)
8889
.bold()
90+
.foregroundColor(Color(colors.navigationBarTitle))
8991
}
9092

9193
ToolbarItem(placement: .navigationBarLeading) {
@@ -94,6 +96,7 @@ struct PollCommentsView<Factory: ViewFactory>: View {
9496
} label: {
9597
Image(systemName: "xmark")
9698
}
99+
.accentColor(colors.navigationBarTintColor)
97100
}
98101
}
99102
.navigationBarTitleDisplayMode(.inline)

0 commit comments

Comments
 (0)