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
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
# Upcoming

### ✅ Added
- Add message highlighting on jumping to a quoted message [#1032](https://github.com/GetStream/stream-chat-swiftui/pull/1030)
- Add message highlighting on jumping to a quoted message [#1032](https://github.com/GetStream/stream-chat-swiftui/pull/1032)

### 🐞 Fixed
- Fix composer deleting newly entered text after deleting draft text [#1030](https://github.com/GetStream/stream-chat-swiftui/pull/1030)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,9 @@ open class ChatChannelViewModel: ObservableObject, MessagesDataSource {
}
// Clear highlight after animation completes
DispatchQueue.main.asyncAfter(deadline: .now() + 0.7) { [weak self] in
self?.highlightedMessageId = nil
withAnimation {
self?.highlightedMessageId = nil
}
}
self?.messageCachingUtils.jumpToReplyId = nil
} else if messageController == nil {
Expand Down Expand Up @@ -324,9 +326,11 @@ open class ChatChannelViewModel: ObservableObject, MessagesDataSource {
DispatchQueue.main.asyncAfter(deadline: .now() + 2.0) { [weak self] in
self?.scrolledId = nil
}
// Clear highlight after animation completes (0.6s delay from StreamChatUI implementation)
// Clear highlight after animation completes
DispatchQueue.main.asyncAfter(deadline: .now() + 0.7) { [weak self] in
self?.highlightedMessageId = nil
withAnimation {
self?.highlightedMessageId = nil
}
}
return true
} else {
Expand Down Expand Up @@ -362,7 +366,9 @@ open class ChatChannelViewModel: ObservableObject, MessagesDataSource {
}
// Clear highlight after animation completes
DispatchQueue.main.asyncAfter(deadline: .now() + 0.7) {
self?.highlightedMessageId = nil
withAnimation {
self?.highlightedMessageId = nil
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,9 @@ public struct MessageContainerView<Factory: ViewFactory>: View {
.padding(.top, isLast ? paddingValue : 0)
.background(
Group {
if let highlightedMessageId = highlightedMessageId, highlightedMessageId == message.messageId {
if utils.messageListConfig.highlightMessageWhenJumping,
let highlightedMessageId = highlightedMessageId,
highlightedMessageId == message.messageId {
Color(colors.messageCellHighlightBackground)
} else if messageViewModel.isPinned {
Color(colors.pinnedBackground)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public struct MessageListConfig {
iPadSplitViewEnabled: Bool = true,
scrollingAnchor: UnitPoint = .center,
showNewMessagesSeparator: Bool = true,
highlightMessageWhenJumping: Bool = true,
handleTabBarVisibility: Bool = true,
messageListAlignment: MessageListAlignment = .standard,
uniqueReactionsEnabled: Bool = false,
Expand Down Expand Up @@ -57,6 +58,7 @@ public struct MessageListConfig {
self.iPadSplitViewEnabled = iPadSplitViewEnabled
self.scrollingAnchor = scrollingAnchor
self.showNewMessagesSeparator = showNewMessagesSeparator
self.highlightMessageWhenJumping = highlightMessageWhenJumping
self.handleTabBarVisibility = handleTabBarVisibility
self.messageListAlignment = messageListAlignment
self.uniqueReactionsEnabled = uniqueReactionsEnabled
Expand Down Expand Up @@ -121,6 +123,11 @@ public struct MessageListConfig {

/// A boolean value that determines if download action is shown for file attachments.
public let downloadFileAttachmentsEnabled: Bool

/// Highlights the message background when jumping to a message.
///
/// By default it is enabled and it uses the color from `ColorPalette.messageCellHighlightBackground`.
public let highlightMessageWhenJumping: Bool
}

/// Contains information about the message paddings.
Expand Down
5 changes: 2 additions & 3 deletions Sources/StreamChatSwiftUI/ColorPalette.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public struct ColorPalette {
public var highlightedBackground: UIColor = .streamGrayGainsboro
public var highlightedAccentBackground: UIColor = .streamAccentBlue
public var highlightedAccentBackground1: UIColor = .streamBlueAlice
public var pinnedBackground: UIColor = .streamHighlight
public var pinnedBackground: UIColor = .streamYellowBackground
public var messageCellHighlightBackground: UIColor = .streamYellowBackground

// MARK: - Borders and shadows
Expand Down Expand Up @@ -167,8 +167,7 @@ private extension UIColor {
static let streamAccentGreen = mode(0x20e070, 0x20e070)
static let streamGrayDisabledText = mode(0x72767e, 0x72767e)
static let streamInnerBorder = mode(0xdbdde1, 0x272a30)
static let streamHighlight = mode(0xfbf4dd, 0x333024)
static let streamYellowBackground = mode(0xfff2a1, 0x4a3d00)
static let streamYellowBackground = mode(0xfbf4dd, 0x333024)
static let streamDisabled = mode(0xb4b7bb, 0x4c525c)

// Currently we are not using the correct shadow color from figma's color palette. This is to avoid
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading