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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### 🔄 Changed
- Uploading a HEIC photo from the library is now converted to JPEG for better compatibility [#767](https://github.com/GetStream/stream-chat-swiftui/pull/767)
- Customizing the message avatar view is reflected in all views that use it [#772](https://github.com/GetStream/stream-chat-swiftui/pull/772)
- Move `ChangeBarsVisibilityModifier` into `ViewFactory` for better customization [#774](https://github.com/GetStream/stream-chat-swiftui/pull/774)

# [4.73.0](https://github.com/GetStream/stream-chat-swiftui/releases/tag/4.73.0)
_February 28, 2025_
Expand Down
4 changes: 2 additions & 2 deletions Sources/StreamChatSwiftUI/ChatChannel/ChatChannelView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,10 @@ public struct ChatChannelView<Factory: ViewFactory>: View, KeyboardReadable {
Divider()
.navigationBarBackButtonHidden(viewModel.reactionsShown)
.if(viewModel.reactionsShown, transform: { view in
view.changeBarsVisibility(shouldShow: false)
view.modifier(factory.makeChannelBarsVisibilityViewModifier(shouldShow: false))
})
.if(!viewModel.reactionsShown, transform: { view in
view.changeBarsVisibility(shouldShow: true)
view.modifier(factory.makeChannelBarsVisibilityViewModifier(shouldShow: true))
})
.if(viewModel.channelHeaderType == .regular) { view in
view.modifier(factory.makeChannelHeaderViewModifier(for: channel))
Expand Down
4 changes: 4 additions & 0 deletions Sources/StreamChatSwiftUI/DefaultViewFactory.swift
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,10 @@ extension ViewFactory {
DefaultChannelHeaderModifier(factory: self, channel: channel)
}

public func makeChannelBarsVisibilityViewModifier(shouldShow: Bool) -> some ViewModifier {
ChangeChannelBarsVisibilityModifier(shouldShow: shouldShow)
}

public func makeChannelLoadingView() -> some View {
LoadingView()
}
Expand Down
6 changes: 1 addition & 5 deletions Sources/StreamChatSwiftUI/Utils/Modifiers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ struct IconOverImageModifier: ViewModifier {
}
}

struct ChangeBarsVisibilityModifier: ViewModifier {
struct ChangeChannelBarsVisibilityModifier: ViewModifier {

@Injected(\.utils) private var utils

Expand Down Expand Up @@ -110,10 +110,6 @@ extension View {
public func applyDefaultIconOverlayStyle() -> some View {
modifier(IconOverImageModifier())
}

public func changeBarsVisibility(shouldShow: Bool) -> some View {
modifier(ChangeBarsVisibilityModifier(shouldShow: shouldShow))
}
}

extension Image {
Expand Down
6 changes: 6 additions & 0 deletions Sources/StreamChatSwiftUI/ViewFactory.swift
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,12 @@ public protocol ViewFactory: AnyObject {
/// - Parameter channel: the displayed channel.
func makeChannelHeaderViewModifier(for channel: ChatChannel) -> ChatHeaderViewModifier

associatedtype ChangeBarsVisibilityModifier: ViewModifier
/// Creates a view modifier that changes the visibility of bars.
/// - Parameter shouldShow: A Boolean value indicating whether the bars should be shown.
/// - Returns: A view modifier that changes the visibility of bars.
func makeChannelBarsVisibilityViewModifier(shouldShow: Bool) -> ChangeBarsVisibilityModifier

associatedtype ChannelLoadingViewType: View
/// Creates a loading view for the channel.
func makeChannelLoadingView() -> ChannelLoadingViewType
Expand Down
Loading