Skip to content

Commit 12ab83b

Browse files
Exposed changing reaction colors
1 parent 3097453 commit 12ab83b

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

Sources/StreamChatSwiftUI/ChatChannel/Composer/MessageComposerViewModel.swift

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -387,12 +387,11 @@ open class MessageComposerViewModel: ObservableObject {
387387
DispatchQueue.main.asyncAfter(deadline: .now() + 0.25) { [weak self] in
388388
self?.imageAssets = assets
389389
}
390-
case .denied, .restricted:
391-
self.imageAssets = PHFetchResult<PHAsset>()
392-
log.debug("Access to photos is denied, showing the no permissions screen.")
393-
case .notDetermined:
394-
self.imageAssets = PHFetchResult<PHAsset>()
395-
log.debug("Access to photos is still not determined.")
390+
case .denied, .restricted, .notDetermined:
391+
DispatchQueue.main.async { [weak self] in
392+
self?.imageAssets = PHFetchResult<PHAsset>()
393+
}
394+
log.debug("Access to photos is denied or not determined, showing the no permissions screen.")
396395
@unknown default:
397396
log.debug("Unknown authorization status.")
398397
}

Sources/StreamChatSwiftUI/ChatChannel/Reactions/ReactionUserView.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,14 +110,15 @@ struct ReactionImageView: View {
110110
var isSentByCurrentUser: Bool
111111
var backgroundColor: Color
112112

113-
private var reactionColor: Color {
114-
isSentByCurrentUser ? colors.tintColor : Color(colors.textLowEmphasis)
113+
private var reactionColor: UIColor? {
114+
var colors = colors
115+
return isSentByCurrentUser ? colors.reactionCurrentUserColor : colors.reactionOtherUserColor
115116
}
116117

117118
var body: some View {
118119
Image(uiImage: image)
119120
.resizable()
120-
.foregroundColor(reactionColor)
121+
.foregroundColor(reactionColor != nil ? Color(reactionColor!) : nil)
121122
.frame(width: 16, height: 16)
122123
.padding(.all, 8)
123124
.background(backgroundColor)

Sources/StreamChatSwiftUI/ColorPalette.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ public struct ColorPalette {
7474
public lazy var messageOtherUserTextColor: UIColor = text
7575
public lazy var quotedMessageBackgroundCurrentUser: UIColor = background8
7676
public lazy var quotedMessageBackgroundOtherUser: UIColor = background8
77+
public lazy var reactionCurrentUserColor: UIColor? = UIColor(tintColor)
78+
public lazy var reactionOtherUserColor: UIColor? = textLowEmphasis
7779
}
7880

7981
// Those colors are default defined stream constants, which are fallback values if you don't implement your color theme.

0 commit comments

Comments
 (0)