Skip to content

Commit 1365a41

Browse files
committed
Use @mainactor in ReactionsIconProvider
1 parent 4de3548 commit 1365a41

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

Sources/StreamChatSwiftUI/ChatChannel/MessageList/ReactionsIconProvider.swift

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,20 @@ import StreamChat
66
import SwiftUI
77

88
class ReactionsIconProvider {
9-
static var images: Images { InjectedValues[\.images] }
9+
@MainActor static var colors: ColorPalette = InjectedValues[\.colors]
10+
@MainActor static var images: Images = InjectedValues[\.images]
1011

11-
static func icon(for reaction: MessageReactionType, useLargeIcons: Bool) -> UIImage? {
12+
@MainActor static func icon(for reaction: MessageReactionType, useLargeIcons: Bool) -> UIImage? {
1213
if useLargeIcons {
1314
return images.availableReactions[reaction]?.largeIcon
1415
} else {
1516
return images.availableReactions[reaction]?.smallIcon
1617
}
1718
}
1819

19-
static func color(for reaction: MessageReactionType, userReactionIDs: Set<MessageReactionType>) -> Color? {
20+
@MainActor static func color(for reaction: MessageReactionType, userReactionIDs: Set<MessageReactionType>) -> Color? {
2021
let containsUserReaction = userReactionIDs.contains(reaction)
21-
let color = containsUserReaction ?
22-
InjectedValues[\.colors].reactionCurrentUserColor :
23-
InjectedValues[\.colors].reactionOtherUserColor
22+
let color = containsUserReaction ? colors.reactionCurrentUserColor : colors.reactionOtherUserColor
2423

2524
if let color = color {
2625
return Color(color)

0 commit comments

Comments
 (0)