Skip to content

Commit 5fa98d2

Browse files
committed
Do not pass colors to the view factory
1 parent 1fb573b commit 5fa98d2

File tree

4 files changed

+2
-9
lines changed

4 files changed

+2
-9
lines changed

Sources/StreamChatSwiftUI/ChatChannelList/ChatChannelList.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,6 @@ public struct ChannelsLazyVStack<Factory: ViewFactory>: View {
172172
leadingSwipeButtonTapped: leadingSwipeButtonTapped
173173
)
174174
.background(factory.makeChannelListItemBackground(
175-
colors: colors,
176175
channel: channel,
177176
isSelected: selectedChannel?.channel.id == channel.id
178177
))

Sources/StreamChatSwiftUI/ChatThreadList/ChatThreadList.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ public struct ThreadsLazyVStack<Factory: ViewFactory>: View {
9494
selectedThread: $selectedThread
9595
)
9696
.background(factory.makeThreadListItemBackground(
97-
colors: colors,
9897
thread: thread,
9998
isSelected: selectedThread?.id == thread.id)
10099
)

Sources/StreamChatSwiftUI/DefaultViewFactory.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,10 @@ extension ViewFactory {
101101
}
102102

103103
public func makeChannelListItemBackground(
104-
colors: ColorPalette,
105104
channel: ChatChannel,
106105
isSelected: Bool
107106
) -> some View {
107+
let colors = InjectedValues[\.colors]
108108
if isSelected && isIPad {
109109
return Color(colors.background6)
110110
}
@@ -990,7 +990,6 @@ extension ViewFactory {
990990
}
991991
}
992992

993-
994993
public func makeThreadListItem(
995994
thread: ChatThread,
996995
threadDestination: @escaping (ChatThread) -> ThreadDestination,
@@ -1039,10 +1038,10 @@ extension ViewFactory {
10391038
}
10401039

10411040
public func makeThreadListItemBackground(
1042-
colors: ColorPalette,
10431041
thread: ChatThread,
10441042
isSelected: Bool
10451043
) -> some View {
1044+
let colors = InjectedValues[\.colors]
10461045
if isSelected && isIPad {
10471046
return Color(colors.background6)
10481047
}

Sources/StreamChatSwiftUI/ViewFactory.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,10 @@ public protocol ViewFactory: AnyObject {
6767

6868
associatedtype ChannelListItemBackground: View
6969
/// Creates the background for the channel list item.
70-
/// - Parameter colors: The colors palette used in the SDK.
7170
/// - Parameter channel: The channel which the item view belongs to.
7271
/// - Parameter isSelected: Whether the current item is selected or not.
7372
/// - Returns: The view shown as a background of the channel list item.
7473
func makeChannelListItemBackground(
75-
colors: ColorPalette,
7674
channel: ChatChannel,
7775
isSelected: Bool
7876
) -> ChannelListItemBackground
@@ -1056,12 +1054,10 @@ public protocol ViewFactory: AnyObject {
10561054

10571055
associatedtype ThreadListItemBackground: View
10581056
/// Creates the background for the thread list item.
1059-
/// - Parameter colors: The colors palette used in the SDK.
10601057
/// - Parameter thread: The thread which the item view belongs to.
10611058
/// - Parameter isSelected: Whether the current item is selected or not.
10621059
/// - Returns: The view shown as a background of the thread list item.
10631060
func makeThreadListItemBackground(
1064-
colors: ColorPalette,
10651061
thread: ChatThread,
10661062
isSelected: Bool
10671063
) -> ThreadListItemBackground

0 commit comments

Comments
 (0)